Skip to content

fix(backend): remove test controllers from production module and add registration guard - #1473

Open
egwujiohaifesinachiperpetual-max wants to merge 5 commits into
Pulsefy:mainfrom
egwujiohaifesinachiperpetual-max:main
Open

egwujiohaifesinachiperpetual-max wants to merge 5 commits into
Pulsefy:mainfrom
egwujiohaifesinachiperpetual-max:main

Conversation

@egwujiohaifesinachiperpetual-max

Copy link
Copy Markdown
Contributor

Closes #1416

Description

Removes TestController and TestExceptionController from AppModule to eliminate unnecessary attack surface in production environments. Production sentiment endpoints (/sentiment/analyze and /sentiment/health) have been cleanly extracted into a dedicated SentimentController in SentimentModule.

Changes Included

  • Production Module: Removed TestController and TestExceptionController from apps/backend/src/app.module.ts and deleted test controller files.
  • Sentiment Feature: Added SentimentController registered in SentimentModule for production sentiment analysis routes.
  • Registration Guard: Added a unit test in app.module.spec.ts asserting that no controller named test* (case-insensitive) can be registered in AppModule.
  • Exception Filter Unit Tests: Added unit tests in global-exception.filter.spec.ts covering BAD_REQUEST exceptions, generic Error handling in development mode, and unknown exception objects.
  • E2E & Route Verification: Updated app.e2e-spec.ts to confirm /test/* and /test-exception/* paths return 404.

Acceptance Criteria Checklist

  • TestExceptionController is removed from the production module.
  • TestController is removed from the production module and provably unreachable.
  • Exception-filter behaviour is covered by proper unit/E2E tests instead.
  • A check prevents new controllers named test* from being registered in app.module.ts.
  • The deployed route list is verified to no longer expose either path.

unknown and others added 2 commits September 23, 2026 12:52
…e-test-controllers

fix(backend): remove test controllers from production module and add …
@drips-wave

drips-wave Bot commented Sep 23, 2026

Copy link
Copy Markdown

@egwujiohaifesinachiperpetual-max Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Cedarich

Copy link
Copy Markdown
Contributor

@egwujiohaifesinachiperpetual-max Kindly resolve conflicts

@Cedarich

Copy link
Copy Markdown
Contributor

Hi @egwujiohaifesinachiperpetual-max — thanks for this contribution. CI is currently failing on this pull request, so it can't be reviewed or merged yet.

Failing check:

Could you take a look and push a fix? To reproduce locally:

Check Command
backend-checks npm run lint --prefix apps/backend && npm run test --prefix apps/backend
data-processing-checks pytest from apps/data-processing
Test Suite (contracts) cargo test from apps/onchain
mobile-checks npm run lint --prefix apps/mobile && npm test --prefix apps/mobile

A couple of things that come up often: make sure your branch is rebased on the latest main, and check the logs for a formatting or lint failure rather than a real test failure — those are the most common causes here.

If the failure looks unrelated to your change, say so in a comment and we'll investigate the workflow instead of asking you to fix it. Push a new commit and CI will re-run automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backend: Remove test controllers from the production module

2 participants