Files
SubMiner/backlog/tasks/task-96 - Split-config-resolve-into-domain-modules.md
sudacode 10b94ce889 refactor(config): slim resolver facade and expand regression lanes
Collapse src/config/resolve.ts into an orchestrated pipeline over domain modules, wire launcher regression coverage into test scripts, and sync backlog/subagent tracking artifacts for completed TASK-74/TASK-96/TASK-98 follow-up planning.
2026-02-21 21:27:31 -08:00

4.5 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies, priority
id title status assignee created_date updated_date labels dependencies priority
TASK-96 Split config resolve into domain modules Done
@codex-task96-config-resolve
2026-02-21 07:15 2026-02-21 20:10
architecture
refactor
maintainability
TASK-85
high

Description

src/config/resolve.ts remains oversized and mixes unrelated concerns. Split into domain-focused modules while preserving behavior and public API.

Action Steps

  1. Capture baseline: LOC, exported symbols, and current test coverage touching config resolution.
  2. Create domain modules under src/config/resolve/:
    • env-paths.ts
    • subtitle-style.ts
    • integrations.ts
    • validation-errors.ts
  3. Keep src/config/resolve.ts as thin orchestrator/barrel that composes domain resolvers.
  4. Add seam tests per new module; keep existing config suite green.
  5. Verify no call-site changes required outside config service layer.
  6. Run verification gate: bun run build, bun run test:config:dist, bun run check:file-budgets.
  7. Record before/after LOC and ownership map in task notes.

Acceptance Criteria

  • #1 src/config/resolve.ts reduced to orchestration/barrel role.
  • #2 New domain modules exist with clear single-responsibility boundaries.
  • #3 Existing config behavior preserved with passing tests.
  • #4 New seam tests cover domain-specific resolution logic.
  • #5 File-budget report shows measurable reduction in hotspot file size.

Implementation Plan

Execution plan (2026-02-21 codex refresh):

  1. Capture baseline metrics (wc -l src/config/resolve.ts, bun run check:file-budgets) and keep evidence in notes.
  2. Ensure seam test coverage exists for extracted domain modules (src/config/resolve/anki-connect.test.ts, src/config/resolve/subtitle-style.test.ts, src/config/resolve/jellyfin.test.ts) and wire config test scripts so these tests run in src + dist lanes.
  3. Reduce src/config/resolve.ts to orchestration facade by composing extracted modules in stable order:
    • createResolveContext
    • applyTopLevelConfig
    • applyCoreDomainConfig
    • applySubtitleDomainConfig
    • applyIntegrationConfig
    • applyImmersionTrackingConfig
    • applyAnkiConnectResolution
  4. Verify no behavior drift with required gates: bun run build, bun run test:config:dist, bun run check:file-budgets.
  5. Record before/after LOC + budget results and finalize acceptance criteria / DoD in task metadata (no commit).

Implementation Notes

[baseline] wc -l src/config/resolve.ts => 1414 LOC.

[baseline] bun run check:file-budgets reports src/config/resolve.ts: 1415 LOC and 17 files over 500 LOC.

[implementation] Reduced src/config/resolve.ts to orchestration facade that now composes extracted domain modules in stable order: top-level -> core -> subtitle -> integrations -> immersion-tracking -> anki-connect.

[implementation] Wired config seam tests into official config lanes by updating package.json scripts test:config:src and test:config:dist to include src/config/resolve/{anki-connect,subtitle-style,jellyfin}.test.ts (and compiled dist equivalents).

[verification] bun run build && bun run test:config:dist && bun run check:file-budgets passed. Config dist lane now runs 48 tests including seam tests; all passing.

[metrics] LOC before/after: wc -l src/config/resolve.ts baseline 1414 -> final 33.

[metrics] Budget before/after: baseline report showed 18 files over 500 LOC including src/config/resolve.ts: 1415 LOC; final report shows 17 files over 500 LOC and src/config/resolve.ts no longer over budget.

Final Summary

Refactored config resolution into domain-focused modules and reduced src/config/resolve.ts to a thin orchestration facade while preserving behavior. Added/wired resolver seam tests into src+dist config test lanes and verified with required gates (build, test:config:dist, check:file-budgets) plus before/after LOC and budget evidence.

Definition of Done

  • #1 Baseline and final LOC metrics recorded in Implementation Notes.
  • #2 bun run build and bun run test:config:dist pass.
  • #3 bun run check:file-budgets completed and attached in notes.