- Extract remaining runtime helper clusters from main.ts into dedicated modules for readability:\n - src/main/jlpt-runtime.ts\n - src/main/media-runtime.ts\n - src/main/overlay-visibility-runtime.ts\n- Wire main.ts to use the new runtime services and remove duplicated in-file helpers.\n- Preserve existing behavior via full typecheck + test:fast verification.\n- Finalize and archive TASK-56 backlog entry; update TASK-54 with completion metadata and summary.
2.8 KiB
id, title, status, assignee, created_date, updated_date, labels, dependencies, references, priority
| id | title | status | assignee | created_date | updated_date | labels | dependencies | references | priority | |
|---|---|---|---|---|---|---|---|---|---|---|
| TASK-54 | Audit and consolidate micro-services under 50 lines | Done | 2026-02-16 04:47 | 2026-02-16 05:04 |
|
medium |
Description
The core/services directory contains 67 files, many of which are very small services that may create unnecessary abstraction overhead. This task involves auditing services under 50 lines and determining if they should be consolidated with related services.
Candidates for review (all under 50 lines):
- mpv-state.ts (25 lines) - could merge with mpv-service.ts
- secondary-subtitle-service.ts (32 lines) - could merge with subtitle-related services
- runtime-config-service.ts (50 lines) - pure utility functions that could merge with config service
- mpv-control-service.ts (49 lines) - MPV command functions could merge with mpv-service.ts
Approach:
- Identify logical groupings (mpv-related, subtitle-related, config-related)
- Determine which micro-services are truly independent vs which are fragments
- Consolidate related micro-services into cohesive modules
- Maintain clear function exports for tree-shaking
Benefits:
- Reduces file navigation overhead
- Groups related functionality logically
- Makes service boundaries clearer
Acceptance Criteria
- #1 Audit all services under 50 lines in src/core/services/
- #2 Identify logical groupings for consolidation
- #3 Merge related micro-services into cohesive modules
- #4 Update all imports across codebase
- #5 Update barrel exports in services/index.ts
- #6 Run full test suite to ensure no regressions
Final Summary
Consolidation for micro-services under 50 lines is now complete in src/core/services: MPV runtime helpers are now in mpv-service.ts, secondary-subtitle cycling logic is in subtitle-position-service.ts, and runtime config decision helpers are in startup-service.ts. The legacy split files (mpv-state.ts, mpv-control-service.ts, runtime-config-service.ts, secondary-subtitle-service.ts) are no longer part of the service surface. I also verified consolidated imports through src/core/services/index.ts and updated unit tests to target the new locations.
Core service files under 50 lines are now reduced to only two small test files: mpv-state.test.ts and mpv-render-metrics-service.test.ts; all tiny service implementations have been folded into cohesive modules.
Validation run: pnpm exec tsc --noEmit and selected service tests for mpv/runtime-config/subtitle grouping passed (25 tests, 0 failures).