Feat/cleanup dead code#12
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR focuses on removing dead/unused code paths and tightening up the project’s developer tooling/docs, primarily by deleting unused infrastructure, cleaning up imports/formatting, and adding lint scripts plus several task/design docs.
Changes:
- Removed unused exports/imports and deleted an unused in-memory rate limiter implementation.
- Refactored a few files for consistency (imports/formatting) and updated unit tests to match current entity signatures.
- Added
oxlint+lintscripts and introduced multiple new task/design markdown docs (plus a domain context document).
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/use-cases/auth/verify-email.test.ts | Removes an unused ErrorCode import in the verify-email unit test. |
| tests/unit/use-cases/auth/me.test.ts | Removes unused ErrorCode import and updates UserEntity construction to include isVerified. |
| tests/unit/services/token.service.test.ts | Removes unused beforeAll import; keeps token service tests. |
| src/server/infrastructure/services/in-memory-rate-limiter.service.ts | Deletes an unused in-memory rate limiter service implementation. |
| src/server/infrastructure/persistence/user.pg.repository.ts | Removes unused isDbError import and reformats queries/entity construction for readability. |
| src/server/infrastructure/http/health/health.routes.ts | Removes unused AppContext import and a dead healthRouter export. |
| src/server/infrastructure/http/auth/auth.routes.ts | Removes unused requireRole import and reformats dependency destructuring. |
| src/server/core/use-cases/auth/me.ts | Simplifies error imports to a single AppError, ErrorCode import. |
| src/server/core/use-cases/admin/remove-role.ts | Changes execute() signature (drops requestingUserId). |
| package.json | Adds lint / lint:fix scripts and adds oxlint dev dependency. |
| docs/tasks/split-route-files.md | New planning doc for splitting large auth route files. |
| docs/tasks/setup-lint-ci.md | New planning doc for adding lint + typecheck to CI. |
| docs/tasks/prod-addon-metrics.md | New planning doc for adding Prometheus metrics. |
| docs/tasks/prod-addon-file-upload.md | New planning doc for multipart file upload + storage abstraction. |
| docs/tasks/prod-addon-cursor-pagination.md | New planning doc for cursor pagination in repositories/routes. |
| docs/tasks/prod-addon-caching.md | New planning doc for cache-aside + invalidation. |
| docs/tasks/prod-addon-background-jobs.md | New planning doc for background jobs via BullMQ. |
| docs/tasks/implement-soft-delete.md | New planning doc for soft-deleting users. |
| docs/tasks/implement-audit-logging.md | New planning doc for adding audit logs via repository decoration. |
| docs/tasks/add-second-business-domain.md | New planning doc for introducing a second bounded context/domain. |
| docs/api-test-findings/_auth_logout.md | Removes a stray one-line test finding doc. |
| CONTEXT.md | Adds a domain/context overview + architecture invariants. |
| bun.lock | Locks oxlint and its platform bindings. |
Comments suppressed due to low confidence (1)
tests/unit/services/token.service.test.ts:8
- This test sets
process.env.JWT_*after importingTockTokenService, buttoken.service.tsimportsenvfromsrc/server/config/env.ts, which parses/validatesprocess.envat import time and exports a frozenenvobject. As a result, theseprocess.envassignments won’t affect whatTockTokenServiceuses, making the test configuration ineffective/non-deterministic. Set the env vars before importing the service (e.g., via dynamic import), or mock theenvmodule so the service reads the intended test values.
import { describe, it, expect } from "bun:test";
import { TockTokenService } from "../../../src/server/infrastructure/services/token.service";
import { AppError } from "../../../src/server/core/errors";
process.env.JWT_ACCESS_SECRET = "test-access-secret-for-unit-tests-only";
process.env.JWT_REFRESH_SECRET = "test-refresh-secret-for-unit-tests-only";
process.env.JWT_ACCESS_EXPIRES_IN = "15m";
process.env.JWT_REFRESH_EXPIRES_IN = "7d";
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) {} | ||
|
|
||
| async execute(userId: string, roleName: string, requestingUserId: string) { | ||
| async execute(userId: string, roleName: string) { |
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.
No description provided.