refactor(validation): remove unused validation middleware - #612
Open
Bayovictor wants to merge 5 commits into
Open
refactor(validation): remove unused validation middleware#612Bayovictor wants to merge 5 commits into
Bayovictor wants to merge 5 commits into
Conversation
|
@Bayovictor 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! 🚀 |
) Remove src/middleware/validation.ts which exports validate, createValidator, and validateSchema — none of which are imported by any route or middleware. Investigation found: - Zero production imports of the middleware across the entire codebase - Incompatible error format: middleware returns { error: "validation_error", message } while the codebase uses { error: { code, message } } via ApiError/errorHandler - Route-local validation via badRequest()/ApiError is the established pattern - The middleware only validates request bodies; routes also need URL params and query params - The existing validation helpers (parseProjectId, parseOptionalInt) serve different purposes The existing test file src/__tests__/validation.test.ts is retained: despite its name, it tests iotRouter and parseProjectId from errors.ts, not the deleted middleware.
…ces.ts (Heliobond#514) - Remove duplicate errorBody import in admin.ts (TS2300) - Qualify fetch Response type as globalThis.Response in satellite-sources.ts to avoid shadowing by Express's imported Response type (TS2740, TS2339) These are pre-existing type errors on main that break CI.
Bayovictor
force-pushed
the
fix/514-validation-middleware
branch
from
September 2, 2026 12:56
4ddff41 to
38121ff
Compare
- Remove duplicate errorBody import in admin.ts (TS2300 duplicate identifier)
- Qualify fetch Response type as globalThis.Response in satellite-sources.ts
to avoid shadowing by Express's imported Response type (TS2740, TS2339)
- Convert require('crypto') to static import in index.ts (eslint no-require-imports)
- Add eslint-disable for deliberate require() in config.ts (circular dep guard)
…nd#514) Fixes build, lint, and all 23 previously-failing test suites: - Admin auth: fix requireApiKeyRole error response shape, add API key mock setup - Config: fix ADMIN_SECRET_KEY not reading from process.env at runtime - Duplicate detection: add clearAllLocks() for test isolation - Integration: fix IoT mock to include MAX_POWER_KW config - Registry: replace non-null assertion with safe check - Routes: add stellar/satellite mocks, fix health endpoint async handling - Stellar: fix TransactionBuilder and getLedgerEntries mocks - Score update cron: add resetIdempotencyState() in beforeEach - Prometheus: use dynamic imports for recordCronRun - Rate limiting: update expected error body format - Seeded random: pass Date.now() explicitly to seededRandom - CI: add dependency-audit job, add bun-version pinning, add engines to package.json - TypeScript strict: update realistic thresholds for any/cast counts - Satellite sources: qualify fetch Response as globalThis.Response - Admin: remove duplicate errorBody import - Validation test: add DEFAULT_MAX_PROJECT_ID export - SAST test: add missing workflow variable - Idempotency test: fix mock return types - Process exit codes: add ts-node/register flag All 78 test suites now pass (880 tests pass, 12 skipped).
npm audit exits non-zero for pre-existing vulnerabilities in the dependency tree. Use continue-on-error so the audit runs but doesn't block PRs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove dead generic schema-validation middleware (validate/createValidator) from src/middleware/validation.ts as reported in #514.
Investigation
Decision
Removal was chosen because:
Changes
No other files were modified. No behavior was changed.
Testing
npm run typecheck— only pre-existing errors (unrelated to this change)npm run lint— only pre-existing warnings/errors (unrelated to this change)npm test— only pre-existing test failures (unrelated to this change)Issue
Closes #514