Skip to content

chore: split files exceeding 500-line limit (gate:arch failure) #4534

@OneStepAt4time

Description

@OneStepAt4time

Problem

The gate:arch check fails because 35+ files exceed the 500-line threshold. This is a pre-existing condition on develop and blocks the full gate from passing.

Files Exceeding 500 Lines

Source files (most impactful to fix first):

  • src/services/acp/backend.ts — 1306 lines
  • src/services/acp/local-storage.ts — 1192 lines
  • src/commands/init.ts — 1085 lines
  • src/acp-lifecycle/ndjson-rpc-transport.ts — 1030 lines
  • src/services/acp/terminal-bridge.ts — 857 lines
  • src/services/acp/redis-coordination.ts — 783 lines
  • src/routes/sessions.ts — 826 lines
  • src/commands/run.ts — 841 lines
  • src/services/auth/AuthManager.ts — 904 lines
  • src/config/index.ts — 734 lines
  • src/services/acp/json-rpc-client.ts — 696 lines
  • src/services/acp/event-mapper.ts — 637 lines
  • src/services/acp/session-service.ts — 641 lines
  • src/services/acp/postgres-action-queue.ts — 581 lines
  • src/routes/context.ts — 577 lines
  • src/services/acp/postgres-pause-intervention-store.ts — 559 lines
  • src/services/auth/OIDCManager.ts — 532 lines

Test files:

  • src/__tests__/pipeline.test.ts — 1986 lines
  • src/__tests__/mcp-server.test.ts — 1687 lines
  • src/__tests__/acp-backend.test.ts — 1195 lines
  • src/__tests__/events.test.ts — 1188 lines
  • src/__tests__/local-storage.ts — 1192 lines (wait, this is a test?)
  • Plus 20+ more test files

Acceptance Criteria

  • All source files ≤500 lines OR explicitly approved by Argus+Hephaestus
  • All test files ≤500 lines OR explicitly approved
  • npm run gate:arch passes
  • No functional changes (pure refactoring)
  • All tests still pass

Priority

P2 — This is tech debt that should be addressed incrementally. Does not block current sprint work since the gate failure is pre-existing.

Notes

Per AGENTS.md: "No file >500 lines without justification. Flag during review. If a file is bloated, refactor it."

The gate script is at scripts/check-file-size.sh with threshold 500.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions