mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
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.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
---
|
||||
id: TASK-100
|
||||
title: Run post-refactor dead code prune and cleanup
|
||||
status: To Do
|
||||
assignee: []
|
||||
created_date: '2026-02-21 07:15'
|
||||
updated_date: '2026-02-21 07:15'
|
||||
labels:
|
||||
- cleanup
|
||||
- maintainability
|
||||
- refactor
|
||||
dependencies:
|
||||
- TASK-96
|
||||
- TASK-97
|
||||
priority: medium
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
<!-- SECTION:DESCRIPTION:BEGIN -->
|
||||
Major refactors likely left unused exports/helpers and stale compatibility code. Perform a deliberate dead-code sweep with regression safety.
|
||||
<!-- SECTION:DESCRIPTION:END -->
|
||||
|
||||
## Action Steps
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
1. Run unused-export scans (`ts-prune` or equivalent) and collect candidate list.
|
||||
2. Manually verify each candidate to avoid false positives from dynamic loading/IPC wiring.
|
||||
3. Remove or inline confirmed dead code; simplify import surfaces/barrels accordingly.
|
||||
4. Delete stale helper paths retained only for pre-composer wiring.
|
||||
5. Add or update regression tests where removal could alter behavior.
|
||||
6. Run verification gate: `bun run build`, `bun run test:config:dist`, `bun run test:core:dist`.
|
||||
7. Publish cleanup report: removed files/exports, kept exceptions, and rationale.
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- AC:BEGIN -->
|
||||
- [ ] #1 Confirmed dead code removed without behavior regressions.
|
||||
- [ ] #2 Remaining flagged candidates either resolved or documented with justification.
|
||||
- [ ] #3 Build and core/config suites pass after cleanup.
|
||||
- [ ] #4 Import graph complexity reduced (fewer exports/entrypoints where applicable).
|
||||
<!-- AC:END -->
|
||||
|
||||
## Definition of Done
|
||||
<!-- DOD:BEGIN -->
|
||||
- [ ] #1 Dead-code report attached in task notes.
|
||||
- [ ] #2 Regression test updates included for risky removals.
|
||||
- [ ] #3 Verification gate commands complete successfully.
|
||||
<!-- DOD:END -->
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
id: TASK-101
|
||||
title: Consolidate architecture docs and archive task noise
|
||||
status: To Do
|
||||
assignee: []
|
||||
created_date: '2026-02-21 07:15'
|
||||
updated_date: '2026-02-21 07:15'
|
||||
labels:
|
||||
- documentation
|
||||
- maintainability
|
||||
dependencies:
|
||||
- TASK-96
|
||||
- TASK-97
|
||||
- TASK-98
|
||||
- TASK-99
|
||||
- TASK-100
|
||||
priority: low
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
<!-- SECTION:DESCRIPTION:BEGIN -->
|
||||
Architecture guidance is fragmented across long-lived docs and task notes. Consolidate canonical runtime architecture docs and move stale/noisy task-level detail to archive.
|
||||
<!-- SECTION:DESCRIPTION:END -->
|
||||
|
||||
## Action Steps
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
1. Audit architecture and development docs for duplicated runtime composition guidance.
|
||||
2. Select one canonical architecture section for runtime composition and dependency boundaries.
|
||||
3. Refactor duplicate sections to brief pointers to the canonical section.
|
||||
4. Move stale task-evidence prose from persistent docs to backlog/archive where appropriate.
|
||||
5. Add a compact architecture diagram and update links in contributor docs.
|
||||
6. Validate docs build and link integrity.
|
||||
7. Record what moved and why in task notes for traceability.
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- AC:BEGIN -->
|
||||
- [ ] #1 Runtime composition guidance exists in one canonical location.
|
||||
- [ ] #2 Duplicated/stale architecture notes removed from long-lived docs.
|
||||
- [ ] #3 Task evidence retained in backlog/archive, not lost.
|
||||
- [ ] #4 Docs build and links pass after consolidation.
|
||||
<!-- AC:END -->
|
||||
|
||||
## Definition of Done
|
||||
<!-- DOD:BEGIN -->
|
||||
- [ ] #1 Change log of moved/removed doc sections included in task notes.
|
||||
- [ ] #2 `bun run docs:build` passes.
|
||||
- [ ] #3 Contributor-facing entry points link to canonical architecture section.
|
||||
<!-- DOD:END -->
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
---
|
||||
id: TASK-74
|
||||
title: Add launcher regression tests for config discovery and command branching
|
||||
status: To Do
|
||||
status: Done
|
||||
assignee: []
|
||||
created_date: '2026-02-18 11:35'
|
||||
updated_date: '2026-02-18 11:35'
|
||||
updated_date: '2026-02-21 20:21'
|
||||
labels:
|
||||
- launcher
|
||||
- tests
|
||||
@@ -35,14 +35,13 @@ Launcher currently has no direct test coverage for config discovery behavior and
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- AC:BEGIN -->
|
||||
- [ ] #1 Launcher config discovery paths are regression-tested
|
||||
- [ ] #2 Core launcher command branches are regression-tested
|
||||
- [ ] #3 Tests run in CI/local test gate without external process dependencies
|
||||
- [x] #1 Launcher config discovery paths are regression-tested
|
||||
- [x] #2 Core launcher command branches are regression-tested
|
||||
- [x] #3 Tests run in CI/local test gate without external process dependencies
|
||||
<!-- AC:END -->
|
||||
|
||||
## Definition of Done
|
||||
<!-- DOD:BEGIN -->
|
||||
- [ ] #1 Launcher tests included in standard test workflow
|
||||
- [ ] #2 Documented how to run launcher tests locally
|
||||
- [x] #1 Launcher tests included in standard test workflow
|
||||
- [x] #2 Documented how to run launcher tests locally
|
||||
<!-- DOD:END -->
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
---
|
||||
id: TASK-96
|
||||
title: Split config resolve into domain modules
|
||||
status: Done
|
||||
assignee:
|
||||
- '@codex-task96-config-resolve'
|
||||
created_date: '2026-02-21 07:15'
|
||||
updated_date: '2026-02-21 20:10'
|
||||
labels:
|
||||
- architecture
|
||||
- refactor
|
||||
- maintainability
|
||||
dependencies:
|
||||
- TASK-85
|
||||
priority: high
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
<!-- SECTION:DESCRIPTION:BEGIN -->
|
||||
`src/config/resolve.ts` remains oversized and mixes unrelated concerns. Split into domain-focused modules while preserving behavior and public API.
|
||||
<!-- SECTION:DESCRIPTION:END -->
|
||||
|
||||
## Action Steps
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
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.
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- AC:BEGIN -->
|
||||
- [x] #1 `src/config/resolve.ts` reduced to orchestration/barrel role.
|
||||
- [x] #2 New domain modules exist with clear single-responsibility boundaries.
|
||||
- [x] #3 Existing config behavior preserved with passing tests.
|
||||
- [x] #4 New seam tests cover domain-specific resolution logic.
|
||||
- [x] #5 File-budget report shows measurable reduction in hotspot file size.
|
||||
<!-- AC:END -->
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
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).
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
<!-- SECTION:NOTES:BEGIN -->
|
||||
[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.
|
||||
<!-- SECTION:NOTES:END -->
|
||||
|
||||
## Final Summary
|
||||
|
||||
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
|
||||
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.
|
||||
<!-- SECTION:FINAL_SUMMARY:END -->
|
||||
|
||||
## Definition of Done
|
||||
<!-- DOD:BEGIN -->
|
||||
- [x] #1 Baseline and final LOC metrics recorded in Implementation Notes.
|
||||
- [x] #2 `bun run build` and `bun run test:config:dist` pass.
|
||||
- [x] #3 `bun run check:file-budgets` completed and attached in notes.
|
||||
<!-- DOD:END -->
|
||||
@@ -0,0 +1,87 @@
|
||||
---
|
||||
id: TASK-98
|
||||
title: Shift core tests to source level and trim dist coupling
|
||||
status: In Progress
|
||||
assignee:
|
||||
- opencode
|
||||
created_date: '2026-02-21 07:15'
|
||||
updated_date: '2026-02-21 09:56'
|
||||
labels:
|
||||
- testing
|
||||
- maintainability
|
||||
- developer-experience
|
||||
dependencies:
|
||||
- TASK-95
|
||||
priority: medium
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
<!-- SECTION:DESCRIPTION:BEGIN -->
|
||||
Core test flow is heavily coupled to `dist/` artifacts, increasing cycle time and reducing test clarity. Move the majority of tests to source-level execution while retaining minimal dist smoke coverage.
|
||||
<!-- SECTION:DESCRIPTION:END -->
|
||||
|
||||
## Action Steps
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
1. Catalog current test commands and classify tests: source-level candidates vs required dist smoke tests.
|
||||
2. Introduce/standardize source-level test runners for core suites.
|
||||
3. Migrate high-volume `dist/core/services/*` tests to source-level equivalents.
|
||||
4. Keep a small dist smoke suite for packaging/runtime sanity only.
|
||||
5. Update `package.json` scripts and CI workflow steps to use new split.
|
||||
6. Capture timing comparison (before/after) for local and CI runs.
|
||||
7. Run verification gate for both lanes: source-level tests + dist smoke tests.
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- AC:BEGIN -->
|
||||
- [x] #1 Majority of core regression tests run from source-level entrypoints.
|
||||
- [x] #2 Dist suite reduced to explicit smoke scope with documented purpose.
|
||||
- [x] #3 CI still validates packaged/runtime assumptions via smoke lane.
|
||||
- [x] #4 Total default test cycle time improves measurably.
|
||||
<!-- AC:END -->
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
1) Baseline current dist-coupled matrix and capture `time bun run test:fast` before timing.
|
||||
2) Update `package.json` scripts so default regression lanes (`test:config`, `test:core`, `test:fast`) run source-level tests (`bun test src/...`) instead of `dist` artifacts.
|
||||
3) Introduce explicit `test:smoke:dist` command for minimal compiled/runtime smoke checks; keep launcher smoke behavior intact.
|
||||
4) Update `.github/workflows/ci.yml` and `.github/workflows/release.yml` to run source lane as primary + dist smoke lane as secondary.
|
||||
5) Document command matrix in `docs/development.md`, rerun timing commands, capture before/after delta in task notes, then finalize AC/DoD.
|
||||
|
||||
Detailed execution plan: `docs/plans/2026-02-21-task-98-source-tests-dist-smoke-split.md`
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
<!-- SECTION:NOTES:BEGIN -->
|
||||
Execution updates (2026-02-21):
|
||||
- Default regression lane moved to source entrypoints in `package.json`:
|
||||
- `test:config` -> `test:config:src` (`bun test src/config/config.test.ts src/config/path-resolution.test.ts`)
|
||||
- `test:core` -> `test:core:src` (`bun test` over curated core list)
|
||||
- `test:fast` -> source config + source core
|
||||
- Dist coupling trimmed to explicit smoke lane:
|
||||
- `test:smoke:dist` -> `test:config:smoke:dist` + `test:core:smoke:dist`
|
||||
- Smoke scope validates compiled/runtime assumptions across config, IPC/electron interop (`overlay-manager`, `anilist-token-store`), startup, renderer, main URL guard, and x11 tracker.
|
||||
- CI/release wiring updated:
|
||||
- `.github/workflows/ci.yml`: `test:fast` (source) before build; `test:smoke:dist` after build.
|
||||
- `.github/workflows/release.yml` quality-gate: source tests, build, dist smoke.
|
||||
- Docs updated in `docs/development.md` with source-vs-dist command matrix and smoke rationale.
|
||||
- Timing evidence (repro commands):
|
||||
- Before: `time bun run test:fast` (dist-coupled) => `1.438 total`
|
||||
- After: `time bun run test:fast` (source lane) => `1.017 total`
|
||||
- Delta: ~`0.421s` faster (~29.3% reduction).
|
||||
- Dist smoke timing: `time bun run test:smoke:dist` => `0.206 total`.
|
||||
- Verification:
|
||||
- PASS: `bun run test:config:src && bun run test:core:src`
|
||||
- PASS: `bun run test:smoke:dist`
|
||||
- BLOCKED (pre-existing unrelated workspace errors): `bun run build` currently fails in `src/main.ts` and `src/main/runtime/composers/mpv-runtime-composer.test.ts` from in-flight TASK-96/97 changes present in working tree; not introduced by TASK-98 edits.
|
||||
<!-- SECTION:NOTES:END -->
|
||||
|
||||
## Definition of Done
|
||||
<!-- DOD:BEGIN -->
|
||||
- [x] #1 Test command matrix documented in task notes.
|
||||
- [ ] #2 CI config updated and passing with new source/dist split.
|
||||
- [x] #3 Performance delta captured with reproducible timing commands.
|
||||
<!-- DOD:END -->
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
id: TASK-99
|
||||
title: Expand maintainability guardrails and runtime cycle checks
|
||||
status: To Do
|
||||
assignee: []
|
||||
created_date: '2026-02-21 07:15'
|
||||
updated_date: '2026-02-21 07:15'
|
||||
labels:
|
||||
- quality
|
||||
- architecture
|
||||
- ci
|
||||
dependencies:
|
||||
- TASK-96
|
||||
- TASK-97
|
||||
priority: medium
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
<!-- SECTION:DESCRIPTION:BEGIN -->
|
||||
Current guardrails cover `main.ts` fan-in and broad file budgets. Add targeted checks for newly extracted hotspots and runtime import-cycle detection.
|
||||
<!-- SECTION:DESCRIPTION:END -->
|
||||
|
||||
## Action Steps
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
1. Rebaseline file-size budgets for known hotspots (including post-TASK-96 files).
|
||||
2. Extend `check:file-budgets` config to enforce thresholds on new modules and key test files.
|
||||
3. Add runtime dependency cycle detection for `src/main/runtime/**` (script + CI hook).
|
||||
4. Wire new checks into local gate commands and CI workflow.
|
||||
5. Add failure guidance output so contributors can remediate quickly.
|
||||
6. Run gates on current branch and capture pass/fail evidence in task notes.
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- AC:BEGIN -->
|
||||
- [ ] #1 Budget thresholds include new hotspot modules and prevent silent growth.
|
||||
- [ ] #2 Runtime cycle check detects at least one injected fixture cycle in tests.
|
||||
- [ ] #3 CI runs both checks and fails fast on violations.
|
||||
- [ ] #4 Contributor guidance exists for fixing guardrail failures.
|
||||
<!-- AC:END -->
|
||||
|
||||
## Definition of Done
|
||||
<!-- DOD:BEGIN -->
|
||||
- [ ] #1 Guardrail scripts and CI wiring merged with passing checks.
|
||||
- [ ] #2 Documentation updated with local commands and expected outputs.
|
||||
- [ ] #3 Baseline numbers recorded to justify thresholds.
|
||||
<!-- DOD:END -->
|
||||
|
||||
Reference in New Issue
Block a user