mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
feat: finish TASK-27.4 mpv-service protocol transport split
This commit is contained in:
@@ -5,7 +5,7 @@ status: In Progress
|
||||
assignee:
|
||||
- backend
|
||||
created_date: '2026-02-13 17:13'
|
||||
updated_date: '2026-02-14 09:41'
|
||||
updated_date: '2026-02-14 23:59'
|
||||
labels:
|
||||
- 'owner:backend'
|
||||
- 'owner:architect'
|
||||
@@ -72,4 +72,8 @@ Extracted app-ready startup dependency object into `createAppReadyRuntimeDeps():
|
||||
Added `SubsyncRuntimeDeps` typing to `getSubsyncRuntimeDeps()` for clearer composition-root contracts around subsync IPC/dependency wiring (`runSubsyncManualFromIpcRuntimeService`/`triggerSubsyncFromConfigRuntimeService` path).
|
||||
|
||||
Extracted additional composition-root dependency composition for IPC command handlers into src/main/dependencies.ts: createCliCommandRuntimeServiceDeps(...) and createMpvCommandRuntimeServiceDeps(...). main.ts now inlines stateful callbacks into these shared builders while preserving behavior. Next step should be extracting startup/app-ready/lifecycle/overlay wiring into dedicated modules under src/main/.
|
||||
|
||||
Progress update (2026-02-14): committed `bbfe2a9` (`refactor: extract overlay shortcuts runtime for task 27.2`). `src/main/overlay-shortcuts-runtime.ts` now owns overlay shortcut registration/lifecycle/fallback orchestration; `src/main.ts` and `src/main/cli-runtime.ts` now consume factory helpers with stricter typed async contracts. Build verified via `pnpm run build`.
|
||||
|
||||
Remaining for TASK-27.2: continue extracting remaining `main.ts` composition-root concerns into dedicated modules (ipc/runtime/bootstrap/app-ready), while keeping behavior unchanged; no status change yet because split is not complete.
|
||||
<!-- SECTION:NOTES:END -->
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
---
|
||||
id: TASK-27.4
|
||||
title: 'Split mpv-service.ts into protocol, transport, property, and facade layers'
|
||||
status: In Progress
|
||||
status: Done
|
||||
assignee:
|
||||
- backend
|
||||
created_date: '2026-02-13 17:13'
|
||||
updated_date: '2026-02-14 21:19'
|
||||
updated_date: '2026-02-15 00:31'
|
||||
labels:
|
||||
- 'owner:backend'
|
||||
dependencies:
|
||||
@@ -37,13 +37,13 @@ Split mpv-service.ts (773 LOC) into thin, testable layers without changing wire
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- AC:BEGIN -->
|
||||
- [ ] #1 MpvIpcClient deps interface reduced to protocol-level concerns only (from current 22 properties).
|
||||
- [ ] #2 Application-level reactions (subtitle broadcast, overlay sync, timing) handled via event emitter or external listeners registered by main.ts.
|
||||
- [ ] #3 Create submodules for protocol parsing/dispatch, connection lifecycle/retry, and property subscriptions/state mapping.
|
||||
- [ ] #4 The public mpv service API (MpvClient interface) remains compatible for all existing consumers.
|
||||
- [ ] #5 MpvIpcClient is testable without mocking 22 callbacks — protocol layer tests need only socket-level mocks.
|
||||
- [ ] #6 Add at least one focused regression check for reconnect + property update flow.
|
||||
- [ ] #7 Document expected event flow in docs/structure-roadmap.md.
|
||||
- [x] #1 MpvIpcClient deps interface reduced to protocol-level concerns only (from current 22 properties).
|
||||
- [x] #2 Application-level reactions (subtitle broadcast, overlay sync, timing) handled via event emitter or external listeners registered by main.ts.
|
||||
- [x] #3 Create submodules for protocol parsing/dispatch, connection lifecycle/retry, and property subscriptions/state mapping.
|
||||
- [x] #4 The public mpv service API (MpvClient interface) remains compatible for all existing consumers.
|
||||
- [x] #5 MpvIpcClient is testable without mocking 22 callbacks — protocol layer tests need only socket-level mocks.
|
||||
- [x] #6 Add at least one focused regression check for reconnect + property update flow.
|
||||
- [x] #7 Document expected event flow in docs/structure-roadmap.md.
|
||||
<!-- AC:END -->
|
||||
|
||||
## Implementation Notes
|
||||
@@ -71,4 +71,18 @@ Milestone progress: extracted protocol buffer parsing into `src/core/services/mp
|
||||
Protocol extraction completed: full `MpvMessage` handling moved into `src/core/services/mpv-protocol.ts` via `splitMpvMessagesFromBuffer` + `dispatchMpvProtocolMessage`; `MpvIpcClient` now delegates all message parsing/dispatch through `MpvProtocolHandleMessageDeps` and resolves pending requests through `tryResolvePendingRequest`. `main.ts` wiring remains unchanged.
|
||||
|
||||
Updated `docs/structure-roadmap.md` expected mpv flow snapshot to reflect protocol parse/dispatch extraction (`splitMpvMessagesFromBuffer` + `dispatchMpvProtocolMessage`) and façade delegation path via `MpvProtocolHandleMessageDeps`.
|
||||
|
||||
Progress update: extracted socket connect/data/error/close/send/reconnect scheduling responsibilities into `MpvSocketTransport` (`src/core/services/mpv-transport.ts`) and wired `MpvIpcClient` to delegate connection lifecycle/send through it. Added `MpvSocketTransport` lifecycle tests in `src/core/services/mpv-transport.test.ts` covering connect/send/error/close behavior. Still in-progress on broader architectural refactor and API boundary reduction for `MpvIpcClient` deps beyond this transport split.
|
||||
|
||||
Added focused transport lifecycle regression coverage in `src/core/services/mpv-transport.test.ts`: connect/connect-idempotence, lifecycle callback ordering, and `shutdown()` resets connection/socket state. This covers reconnect/edge-case behavior at transport layer as part of criterion #6 toward protocol + lifecycle regression protection.
|
||||
|
||||
Added mpv-service unit regression for close lifecycle: `MpvIpcClient onClose resolves outstanding pending requests and triggers reconnect scheduling path via client transport callbacks (`src/core/services/mpv-service.test.ts`). This complements transport-level lifecycle tests for reconnect behavior regression coverage.
|
||||
<!-- SECTION:NOTES:END -->
|
||||
|
||||
## Final Summary
|
||||
|
||||
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
|
||||
Split mpv-service internals into protocol, transport, and property/state-mapping boundaries; reduced MpvIpcClient deps to protocol-level concerns with event-based app reactions in main.ts; added mpv-service/mpv-transport tests for protocol dispatch, reconnect scheduling, and lifecycle regressions; documented expected event flow in docs/structure-roadmap.md.
|
||||
|
||||
Added mpv-service reconnect regression test that asserts a reconnect lifecycle replays mpv property bootstrap commands (`secondary-sub-visibility` reset, `observe_property`, and initial `get_property` state fetches) during reconnection.
|
||||
<!-- SECTION:FINAL_SUMMARY:END -->
|
||||
|
||||
@@ -4,7 +4,7 @@ title: Extract main.ts global state into an AppState container
|
||||
status: In Progress
|
||||
assignee: []
|
||||
created_date: '2026-02-11 08:20'
|
||||
updated_date: '2026-02-14 08:45'
|
||||
updated_date: '2026-02-14 23:59'
|
||||
labels:
|
||||
- refactor
|
||||
- main
|
||||
@@ -41,4 +41,6 @@ Consolidate into a typed AppState object (or small set of domain-specific state
|
||||
Started centralizing module-level application state in `src/main.ts` via `appState` container and routing most state reads/writes through it. Initial rewrite completed; behavior verification pending and dependency-surface shrink pass still needed.
|
||||
|
||||
Implemented Task-7 state migration to `appState` in main.ts and removed module-scope mutable state declarations; fixed a broken regression where several appState references were left as bare expressions in object literals (e.g., `appState.autoStartOverlay`), restoring valid typed dependency construction.
|
||||
|
||||
Build-safe continuation: overlay-shortcuts extraction in this commit (`bbfe2a9`) depends on `appState` usage established by TASK-7 but did not finalize TASK-7 acceptance criteria; stateful migration remains active and should be treated as prerequisite before full `main.ts` module extraction per task sequencing.
|
||||
<!-- SECTION:NOTES:END -->
|
||||
|
||||
Reference in New Issue
Block a user