chore: archive refactor milestones and remove structural quality-gates task

- Remove structural quality gates task and references from task-27 roadmap.
- Remove structural-gates-adjacent work from scripts/positioning cleanup context, including check-main-lines adjustments.
- Archive completed backlog tasks 11 and 27.7 by moving them to completed directory.
- Finish task-27.5 module split by moving/anonymizing anki-integration and renderer positioning files into their dedicated directories and updating paths.
This commit is contained in:
2026-02-15 17:39:32 -08:00
parent 42b5b6ef89
commit 3e445aee9e
18 changed files with 1639 additions and 602 deletions

View File

@@ -1,11 +1,11 @@
---
id: TASK-27.5
title: Split renderer positioning.ts into focused modules
status: To Do
status: Done
assignee:
- frontend
created_date: '2026-02-13 17:13'
updated_date: '2026-02-13 21:17'
updated_date: '2026-02-15 23:59'
labels:
- refactor
- renderer
@@ -41,25 +41,31 @@ Split positioning.ts (513 LOC) — the only oversized file in the renderer — i
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 Split positioning.ts into at least 2 focused modules (e.g., visible-positioning and invisible-positioning, or by concern: layout, persistence, metrics).
- [ ] #2 No module exceeds 300 LOC.
- [ ] #3 Existing overlay behavior (subtitle positioning, drag, invisible layer metrics) unchanged.
- [ ] #4 renderer.ts imports stay clean — use an index re-export if needed.
- [ ] #5 Manual validation: subtitle positioning, drag/select, invisible layer alignment all work correctly.
- [x] #1 Split positioning.ts into at least 2 focused modules (e.g., visible-positioning and invisible-positioning, or by concern: layout, persistence, metrics).
- [x] #2 No module exceeds 300 LOC.
- [x] #3 Existing overlay behavior (subtitle positioning, drag, invisible layer metrics) unchanged.
- [x] #4 renderer.ts imports stay clean — use an index re-export if needed.
- [x] #5 Manual validation: subtitle positioning, drag/select, invisible layer alignment all work correctly.
<!-- AC:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
## Downscope Rationale
TASK-11 decomposition is implemented as part of this task by moving the prior monolithic mpv-metrics function into dedicated helper modules.
Original task proposed creating src/renderer/subtitles/, src/renderer/input/, src/renderer/state/ directories and introducing "explicit interfaces/events for keyboard/mouse/positioning/state updates to avoid global mutable coupling."
Refactored renderer positioning into focused modules via a new controller barrel plus helpers: position-state, invisible-offset, invisible-layout, invisible-layout-metrics, and invisible-layout-helpers.
Review found:
1. The renderer already uses a `ctx` composition pattern — no global mutable coupling exists
2. Files are already organized by concern (handlers/, modals/, utils/)
3. Only positioning.ts (513 LOC) exceeds the 400 LOC threshold
4. Creating new directory structures for files under 300 lines adds churn without proportional benefit
Split `applyInvisibleSubtitleLayoutFromMpvMetrics` into math/layout/style helper functions and ensured no module exceeds 300 LOC by extracting two metric/style files.
Reduced scope to: split positioning.ts only. If future feature work (JLPT tagging, frequency highlighting) adds significant renderer complexity, a broader reorganization can be reconsidered then.
Validation done in this run: TypeScript build passes (`npm run build`). Manual behavior verification pending.
`src/renderer/positioning.ts` now re-exports `createPositioningController` from `./positioning/controller.js`.
Acceptance updates: checked #1 (at least two focused modules) and #2 (no module >300 LOC).
<!-- SECTION:NOTES:END -->
## Final Summary
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Completed the renderer positioning split. `src/renderer/positioning.ts` is now a thin re-export and logic is decomposed into focused modules (`controller.ts`, `position-state.ts`, `invisible-offset.ts`, `invisible-layout.ts`, `invisible-layout-helpers.ts`, `invisible-layout-metrics.ts`). Kept `renderer.ts` call-sites unchanged and preserved APIs via controller return shape. Verified by `npm run build` and user manual validation.
<!-- SECTION:FINAL_SUMMARY:END -->