Remove legacy api.ts monolith (1,134 lines dead code) #125

Merged
Copilot merged 3 commits from copilot/remove-legacy-api-ts into main 2026-02-15 10:41:23 -06:00
Copilot commented 2026-02-15 09:31:58 -06:00 (Migrated from github.com)

Removes scripts/api.ts (1,134 lines), superseded by the refactored scripts/app.ts + modular routes/services architecture. The legacy file lacked input validation, structured logging, Sentry integration, and Swagger docs present in the refactored path.

Changes

Deleted

  • scripts/api.ts - Legacy monolithic API file with known security issues (path injection, request forgery)

Updated entry points

  • package.json - start:apiscripts/start-api-server.ts
  • Dockerfile.api - CMD → start-api-server.ts
  • .nycrc - Removed from exclude list

Updated references (10 files)

  • CONTRIBUTING.md - Test examples now use createApp from scripts/app
  • Documentation in docs/ - Updated all references from scripts/api.ts to refactored architecture
  • Ops guides - Updated startup code examples

Verification

  • No code imports or requires the deleted file
  • Tests already use refactored createApp from scripts/app.ts
  • npm run start:api correctly invokes start-api-server.ts
Original prompt

This section details on the original issue you should resolve

<issue_title>Remove legacy api.ts monolith (dead code)</issue_title>
<issue_description>## Summary
The legacy scripts/api.ts (1,134 lines) is dead code superseded by the refactored scripts/app.ts + modular routes/services architecture. It lacks validation, structured logging, Sentry integration, and Swagger docs that exist in the refactored path.

Problem

  • Two competing API entry points create confusion
  • Legacy file has no input validation (Zod schemas exist but are unused)
  • No structured logging or observability
  • Auth middleware bypass patterns

Current Status

  • start:api script has been updated to point to scripts/start-api-server.ts (the refactored entry)
  • Deprecation notice added to scripts/api.ts

Remaining Work

  • Verify no other scripts/tests import from scripts/api.ts directly
  • Remove scripts/api.ts after confirming no dependencies
  • Update any documentation references

Acceptance Criteria

  • scripts/api.ts is removed from the codebase
  • No imports/requires reference the deleted file
  • All tests pass
  • npm run start:api works correctly with start-api-server.ts</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Removes `scripts/api.ts` (1,134 lines), superseded by the refactored `scripts/app.ts` + modular routes/services architecture. The legacy file lacked input validation, structured logging, Sentry integration, and Swagger docs present in the refactored path. ## Changes **Deleted** - `scripts/api.ts` - Legacy monolithic API file with known security issues (path injection, request forgery) **Updated entry points** - `package.json` - `start:api` → `scripts/start-api-server.ts` - `Dockerfile.api` - CMD → `start-api-server.ts` - `.nycrc` - Removed from exclude list **Updated references** (10 files) - `CONTRIBUTING.md` - Test examples now use `createApp` from `scripts/app` - Documentation in `docs/` - Updated all references from `scripts/api.ts` to refactored architecture - Ops guides - Updated startup code examples ## Verification - No code imports or requires the deleted file - Tests already use refactored `createApp` from `scripts/app.ts` - `npm run start:api` correctly invokes `start-api-server.ts` <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Remove legacy api.ts monolith (dead code)</issue_title> > <issue_description>## Summary > The legacy `scripts/api.ts` (1,134 lines) is dead code superseded by the refactored `scripts/app.ts` + modular routes/services architecture. It lacks validation, structured logging, Sentry integration, and Swagger docs that exist in the refactored path. > > ## Problem > - Two competing API entry points create confusion > - Legacy file has no input validation (Zod schemas exist but are unused) > - No structured logging or observability > - Auth middleware bypass patterns > > ## Current Status > - `start:api` script has been updated to point to `scripts/start-api-server.ts` (the refactored entry) ✅ > - Deprecation notice added to `scripts/api.ts` ✅ > > ## Remaining Work > - [ ] Verify no other scripts/tests import from `scripts/api.ts` directly > - [ ] Remove `scripts/api.ts` after confirming no dependencies > - [ ] Update any documentation references > > ## Acceptance Criteria > - `scripts/api.ts` is removed from the codebase > - No imports/requires reference the deleted file > - All tests pass > - `npm run start:api` works correctly with `start-api-server.ts`</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes subculture-collective/internet-id#117 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.
PatrickFanella (Migrated from github.com) reviewed 2026-02-15 09:31:58 -06:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-02-15 10:36:26 -06:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This pull request successfully removes the legacy monolithic scripts/api.ts file (1,134 lines of dead code) that has been superseded by a refactored modular architecture. The refactored system uses scripts/start-api-server.ts as the entry point and scripts/app.ts as the app factory, with proper separation of concerns through services, routes, and middleware.

Changes:

  • Removed the legacy scripts/api.ts monolith that lacked input validation, structured logging, and modern security features
  • Updated all entry points and configuration files to reference the refactored architecture
  • Updated documentation across 8 files to reflect the new architecture and provide historical context for resolved security issues

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/api.ts Complete removal of 1,134-line legacy monolithic API file
package.json Updated start:api script to use scripts/start-api-server.ts
Dockerfile.api Updated CMD to execute scripts/start-api-server.ts
.nycrc Removed scripts/api.ts from coverage exclude list
CONTRIBUTING.md Updated test example to use createApp() from refactored architecture
docs/ops/HASHICORP_VAULT.md Updated code example reference to start-api-server.ts
docs/ops/AWS_SECRETS_MANAGER.md Updated code example reference to start-api-server.ts
docs/SECURITY_HEADERS_SUMMARY.md Updated architecture references to reflect entry point and app factory
docs/RATE_LIMITING_SECURITY_SUMMARY.md Clarified historical context of resolved security vulnerabilities
docs/DEVELOPMENT_SETUP.md Updated codebase exploration guide with new architecture
docs/DEBUGGING.md Updated debugging examples to use start-api-server.ts
docs/CONTRIBUTOR_ONBOARDING.md Updated project structure and port configuration examples
docs/CACHING_IMPLEMENTATION_SUMMARY.md Updated integration points to reflect current architecture
docs/API_REFACTORING.md Updated to clarify legacy file removal and document current architecture

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview This pull request successfully removes the legacy monolithic `scripts/api.ts` file (1,134 lines of dead code) that has been superseded by a refactored modular architecture. The refactored system uses `scripts/start-api-server.ts` as the entry point and `scripts/app.ts` as the app factory, with proper separation of concerns through services, routes, and middleware. **Changes:** - Removed the legacy `scripts/api.ts` monolith that lacked input validation, structured logging, and modern security features - Updated all entry points and configuration files to reference the refactored architecture - Updated documentation across 8 files to reflect the new architecture and provide historical context for resolved security issues ### Reviewed changes Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | `scripts/api.ts` | Complete removal of 1,134-line legacy monolithic API file | | `package.json` | Updated `start:api` script to use `scripts/start-api-server.ts` | | `Dockerfile.api` | Updated CMD to execute `scripts/start-api-server.ts` | | `.nycrc` | Removed `scripts/api.ts` from coverage exclude list | | `CONTRIBUTING.md` | Updated test example to use `createApp()` from refactored architecture | | `docs/ops/HASHICORP_VAULT.md` | Updated code example reference to `start-api-server.ts` | | `docs/ops/AWS_SECRETS_MANAGER.md` | Updated code example reference to `start-api-server.ts` | | `docs/SECURITY_HEADERS_SUMMARY.md` | Updated architecture references to reflect entry point and app factory | | `docs/RATE_LIMITING_SECURITY_SUMMARY.md` | Clarified historical context of resolved security vulnerabilities | | `docs/DEVELOPMENT_SETUP.md` | Updated codebase exploration guide with new architecture | | `docs/DEBUGGING.md` | Updated debugging examples to use `start-api-server.ts` | | `docs/CONTRIBUTOR_ONBOARDING.md` | Updated project structure and port configuration examples | | `docs/CACHING_IMPLEMENTATION_SUMMARY.md` | Updated integration points to reflect current architecture | | `docs/API_REFACTORING.md` | Updated to clarify legacy file removal and document current architecture | </details> --- 💡 <a href="/subculture-collective/internet-id/new/main/.github/instructions?filename=*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: subculture-collective/internet-id#125