Introduce Discord presence runtime support and continue composition-root decomposition by moving Jellyfin wiring into dedicated composer modules. This keeps main runtime orchestration thinner while preserving behavior and test coverage across config, runtime, and docs updates.
5.1 KiB
id, title, status, assignee, created_date, updated_date, labels, dependencies, priority
| id | title | status | assignee | created_date | updated_date | labels | dependencies | priority | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TASK-103 | Extract Jellyfin runtime wiring from main.ts composition root | Done |
|
2026-02-22 07:13 | 2026-02-22 22:48 |
|
|
medium |
Description
src/main.ts remains oversized (3014 LOC) and still carries a dense Jellyfin wiring block (roughly main.ts:1145-1565) despite composition-root refactors.
Goal: finish extraction of Jellyfin-specific dependency construction and command/setup orchestration into dedicated runtime composer modules so main.ts remains thin and legible.
Action Steps
- Extract Jellyfin config/client-info/auth/list/play/setup dependency builders from
src/main.tsinto focused files undersrc/main/runtime/composers/. - Create one Jellyfin composition entrypoint that returns fully wired handlers used by
main.ts. - Remove duplicated inline adapter lambdas from
main.ts; keep only high-level invocation points. - Add/expand composer seam tests for extracted Jellyfin module boundaries.
- Re-run fan-in and compile checks to ensure extraction does not regress runtime wiring.
Acceptance Criteria
- #1
src/main.tsno longer contains the full Jellyfin deps-building block. - #2 New Jellyfin composer modules have focused tests covering handler wiring.
- #3
bun run check:main-faninstays green after extraction. - #4
bun run buildandbun run test:core:srcpass.
Implementation Plan
Plan artifact: docs/plans/2026-02-22-task-103-jellyfin-runtime-wiring.md.
Execution plan:
- Add
composeJellyfinRuntimeHandlerscomposer module + seam tests and composer barrel export. - Replace inline Jellyfin deps-building block in
src/main.tswith one composer invocation while preserving existing callsites (runJellyfinCommand,openJellyfinSetupWindow, remote session lifecycle, playback). - Update architecture docs ownership bullets for Jellyfin composer boundary.
- Run required gates:
bun run check:main-fanin,bun run build,bun run test:core:src. - Record AC/DoD evidence and final summary in Backlog task (no commit).
Implementation Notes
2026-02-22T22:04:41Z: Execution started via Backlog MCP workflow. Loading task context, creating written plan artifact, then implementing extraction and focused validations without commit.
2026-02-22T22:38:58Z: Added new Jellyfin composition entrypoint src/main/runtime/composers/jellyfin-runtime-composer.ts and seam test src/main/runtime/composers/jellyfin-runtime-composer.test.ts; exported via composer barrel.
2026-02-22T22:38:58Z: Replaced inline Jellyfin deps-building block in src/main.ts with a single composeJellyfinRuntimeHandlers(...) invocation returning config/client/playback/remote/session/command/setup handlers used by existing callsites.
2026-02-22T22:38:58Z: Validation: bun test src/main/runtime/composers/jellyfin-runtime-composer.test.ts src/main/runtime/composers/jellyfin-remote-composer.test.ts PASS (2/2), bun run check:main-fanin PASS (15 import lines, 9 unique runtime paths), bun run test:core:src PASS (241 pass, 6 skip).
2026-02-22T22:38:58Z: bun run build currently FAILS in current working tree due pre-existing duplicate/invalid src/main.ts imports unrelated to TASK-103 extraction (many TS2300/TS2724 import-surface errors already present in file).
2026-02-22T22:49:05Z: Re-ran required completion gates after user fix: bun run build PASS, bun run test:core:src PASS (241 pass, 6 skip), bun run check:main-fanin PASS (14 import lines, 11 unique runtime paths).
Final Summary
Extracted Jellyfin composition-root wiring from src/main.ts into a dedicated runtime composer entrypoint (composeJellyfinRuntimeHandlers) so main now delegates Jellyfin config resolution, client-info wiring, playback orchestration, remote session handlers, command dispatch, and setup-window wiring through a single composer surface. Added focused seam coverage in src/main/runtime/composers/jellyfin-runtime-composer.test.ts, retained existing jellyfin-remote-composer coverage, and updated architecture ownership docs to declare Jellyfin composer boundaries.
Validation run: bun test src/main/runtime/composers/jellyfin-runtime-composer.test.ts src/main/runtime/composers/jellyfin-remote-composer.test.ts (pass), bun run check:main-fanin (pass), bun run build (pass), and bun run test:core:src (pass).
Definition of Done
- #1
src/main.tsLOC reduced materially from current baseline. - #2 Jellyfin runtime wiring is centralized in named composer module(s) with clear ownership docs.
- #3 No behavior regressions in Jellyfin command/setup flows.