diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3268b3..d77878a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,11 +42,14 @@ jobs: # Keep explicit typecheck for fast fail before full build/bundle. run: bun run tsc --noEmit + - name: Test suite (source) + run: bun run test:fast + - name: Build (bundle) run: bun run build - - name: Test suite - run: bun run test:fast + - name: Dist smoke suite + run: bun run test:smoke:dist - name: Build docs run: bun run docs:build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34e0b5f..39962b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,10 +44,14 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile - - name: Build + test - run: | - bun run build - bun run test:fast + - name: Test suite (source) + run: bun run test:fast + + - name: Build (bundle) + run: bun run build + + - name: Dist smoke suite + run: bun run test:smoke:dist build-linux: needs: [quality-gate] diff --git a/docs/development.md b/docs/development.md index a79f36f..ee94a56 100644 --- a/docs/development.md +++ b/docs/development.md @@ -61,21 +61,22 @@ electron . --background # tray/background mode, minimal de ## Testing ```bash -bun run test:config # Config schema and validation tests (build + run) -bun run test:core # Core service tests (~67 tests) (build + run) +bun run test:config # Source-level config schema/validation tests +bun run test:core # Source-level core regression tests (default lane) bun run test:subtitle # Subtitle pipeline tests (build + run) +bun run test:fast # Source-level config + core lane (no build prerequisite) ``` -All legacy test commands build first, then run via Node's built-in test runner (`node --test`). +Dist-level tests are now an explicit smoke lane used to validate compiled/runtime assumptions. -For faster iteration while editing test code: +Smoke and optional deep dist commands: ```bash -bun run build # one-time compile -bun run test:config:dist # no rebuild -bun run test:core:dist # no rebuild -bun run test:subtitle:dist # no rebuild -bun run test:fast # run all tests without rebuild (assumes build is already current) +bun run build # compile dist artifacts +bun run test:smoke:dist # explicit smoke scope for compiled runtime +bun run test:config:dist # optional full dist config suite +bun run test:core:dist # optional full dist core suite +bun run test:subtitle:dist # subtitle dist lane (currently placeholder) ``` ## Config Generation @@ -117,6 +118,7 @@ Run `make help` for a full list of targets. Key ones: - To add or change a config option, update `src/config/definitions.ts` first. Defaults, runtime-option metadata, and generated `config.example.jsonc` are derived from this centralized source. - Overlay window/visibility state is owned by `src/core/services/overlay-manager.ts`. - Main process composition is split across `src/main/` modules plus focused runtime composers under `src/main/runtime/composers/*` (for example AniList tracking and MPV runtime assembly clusters). +- Runtime composer contracts should use shared helpers in `src/main/runtime/composers/contracts.ts` (`ComposerInputs`, `ComposerOutputs`, and `BuiltMainDeps`) so required deps remain compile-time enforced. - Runtime domain imports for `src/main.ts` should route through `src/main/runtime/domains/*`; shared domain access point is `src/main/runtime/registry.ts`. - Linux packaged desktop launches pass `--background` using electron-builder `build.linux.executableArgs` in `package.json`. - MPV service has been split into transport, protocol, state, and properties layers in `src/core/services/`. diff --git a/docs/subagents/INDEX.md b/docs/subagents/INDEX.md index 4d18447..ccd038e 100644 --- a/docs/subagents/INDEX.md +++ b/docs/subagents/INDEX.md @@ -33,5 +33,8 @@ Read first. Keep concise. | `opencode-task-94-20260221T033647Z-7ou2` | `opencode-task-94` | `Finish TASK-94 thin composition root refactor and close acceptance criteria` | `done` | `docs/subagents/agents/opencode-task-94-20260221T033647Z-7ou2.md` | `2026-02-21T04:12:45Z` | | `codex-task71-round2-20260221T043541Z-k9t3` | `codex-task71-round2` | `Execute TASK-71 round 2 split of main.ts into domain runtime modules` | `done` | `docs/subagents/agents/codex-task71-round2-20260221T043541Z-k9t3.md` | `2026-02-21T04:57:00Z` | | `codex-task85-20260221T051308Z-164g` | `codex-task85-exec` | `Execute TASK-85 remaining AC/DoD with writing-plans and executing-plans flow` | `done` | `docs/subagents/agents/codex-task85-20260221T051308Z-164g.md` | `2026-02-21T05:45:50Z` | -| `codex-review-refactor-20260221T062353Z-p6k2` | `codex-review-refactor` | `Perform code review for current refactor changes and report actionable findings` | `done` | `docs/subagents/agents/codex-review-refactor-20260221T062353Z-p6k2.md` | `2026-02-21T06:25:27Z` | +| `codex-review-refactor-20260221T062353Z-p6k2` | `codex-review-refactor` | `Perform code review for current refactor changes and report actionable findings` | `done` | `docs/subagents/agents/codex-review-refactor-20260221T062353Z-p6k2.md` | `2026-02-21T07:16:33Z` | | `opencode-task93-sync-20260221T070842Z-71c6` | `opencode-task93-sync` | `Synchronize TASK-85 closure tracking and child-task status in Backlog` | `done` | `docs/subagents/agents/opencode-task93-sync-20260221T070842Z-71c6.md` | `2026-02-21T07:11:58Z` | +| `opencode-task97-runtime-composer-20260221T094150Z-r8k3` | `opencode-task97-runtime-composer` | `Execute TASK-97 normalize runtime composer contracts end-to-end without commit` | `done` | `docs/subagents/agents/opencode-task97-runtime-composer-20260221T094150Z-r8k3.md` | `2026-02-21T10:06:59Z` | +| `opencode-task96-config-resolve-20260221T094119Z-mbfo` | `opencode-task96-config-resolve` | `Execute TASK-96 split config resolve into domain modules with plan-first workflow` | `planning` | `docs/subagents/agents/opencode-task96-config-resolve-20260221T094119Z-mbfo.md` | `2026-02-21T09:41:19Z` | +| `opencode-task98-source-tests-20260221T094524Z-kzvd` | `opencode-task98-source-tests` | `Execute TASK-98 shift core tests to source level and trim dist coupling without commit` | `blocked` | `docs/subagents/agents/opencode-task98-source-tests-20260221T094524Z-kzvd.md` | `2026-02-21T09:56:47Z` | diff --git a/docs/subagents/agents/opencode-task98-source-tests-20260221T094524Z-kzvd.md b/docs/subagents/agents/opencode-task98-source-tests-20260221T094524Z-kzvd.md new file mode 100644 index 0000000..42b577c --- /dev/null +++ b/docs/subagents/agents/opencode-task98-source-tests-20260221T094524Z-kzvd.md @@ -0,0 +1,48 @@ +# Agent Session: opencode-task98-source-tests-20260221T094524Z-kzvd + +- alias: `opencode-task98-source-tests` +- mission: `Execute TASK-98 shift core tests to source level and trim dist coupling without commit` +- status: `blocked` +- started_utc: `2026-02-21T09:45:24Z` +- backlog_task: `TASK-98` + +## Intent + +- Load TASK-98 context from Backlog MCP. +- Build execution plan via `writing-plans` skill. +- Execute with `executing-plans` skill. +- Use parallel subagents where slices are independent. + +## Planned Files + +- `src/**/*.test.ts` +- `scripts/**/*.mjs` +- `package.json` +- `docs/**/*.md` + +## Files Touched + +- `package.json` +- `.github/workflows/ci.yml` +- `.github/workflows/release.yml` +- `docs/development.md` +- `docs/plans/2026-02-21-task-98-source-tests-dist-smoke-split.md` +- `docs/subagents/INDEX.md` +- `docs/subagents/collaboration.md` + +## Assumptions + +- Backlog task exists and is actionable. +- No commit requested. +- Existing TASK-96/TASK-97 in-flight workspace changes may affect `bun run build` verification. + +## Next Step + +- Unblock `bun run build` from unrelated in-flight composer/type errors, then rerun CI-equivalent gate and close TASK-98 DoD #2. + +## Heartbeat Log + +- `2026-02-21T09:45:24Z` session start; subagent + backlog context loading. +- `2026-02-21T09:51:00Z` plan written to `docs/plans/2026-02-21-task-98-source-tests-dist-smoke-split.md` and recorded in Backlog. +- `2026-02-21T09:55:00Z` migrated default scripts to source lane; added explicit `test:smoke:dist`; rewired CI/release quality gate. +- `2026-02-21T09:56:47Z` verification: source lane PASS; dist smoke PASS; `bun run build` blocked by unrelated pre-existing TS errors in `src/main.ts` and `src/main/runtime/composers/mpv-runtime-composer.test.ts`. diff --git a/docs/subagents/collaboration.md b/docs/subagents/collaboration.md index 922f351..855b68f 100644 --- a/docs/subagents/collaboration.md +++ b/docs/subagents/collaboration.md @@ -35,3 +35,8 @@ Shared notes. Append-only. - [2026-02-21T05:45:50Z] [codex-task85-20260221T051308Z-164g|codex-task85-exec] completed TASK-85 pass: enforced launcher generated-artifact workflow across verifier + CI/release + docs, ran full build/test/guardrails, and finalized TASK-85 status to Done in Backlog MCP. - [2026-02-21T07:08:42Z] [opencode-task93-sync-20260221T070842Z-71c6|opencode-task93-sync] starting TASK-93 backlog synchronization pass: align TASK-85 closure tracking, AC/DoD mapping, and child-task ownership; backlog-only edits expected. - [2026-02-21T07:11:58Z] [opencode-task93-sync-20260221T070842Z-71c6|opencode-task93-sync] completed TASK-93: updated TASK-85 description/notes with explicit AC/DoD ownership + remaining-scope order; finalized TASK-93 AC/DoD and status Done. +- [2026-02-21T09:42:20Z] [opencode-task97-runtime-composer-20260221T094150Z-r8k3|opencode-task97-runtime-composer] starting TASK-97 execution: loading backlog context, writing plan via writing-plans, executing via executing-plans, no commit. +- [2026-02-21T10:06:59Z] [opencode-task97-runtime-composer-20260221T094150Z-r8k3|opencode-task97-runtime-composer] completed TASK-97: normalized shared composer contracts across runtime composers, added compile-time contract assertions, updated docs conventions, ran build + fan-in + core-dist gates, and finalized Backlog task as Done. +- [2026-02-21T09:41:19Z] [opencode-task96-config-resolve-20260221T094119Z-mbfo|opencode-task96-config-resolve] starting TASK-96 via Backlog MCP + writing-plans/executing-plans workflow; scope expected around `src/config/resolve.ts`, new config-resolve domain modules, seam tests, and budget checks. +- [2026-02-21T09:45:24Z] [opencode-task98-source-tests-20260221T094524Z-kzvd|opencode-task98-source-tests] starting TASK-98 via Backlog MCP + writing-plans/executing-plans workflow; targeting source-level test entrypoints and dist-coupling cleanup, no commit. +- [2026-02-21T09:56:47Z] [opencode-task98-source-tests-20260221T094524Z-kzvd|opencode-task98-source-tests] TASK-98 implementation pass complete: source test lane (`test:fast`) moved to `bun test` source entrypoints, explicit `test:smoke:dist` added, CI/release updated, docs+timing evidence recorded; blocked final DoD on unrelated pre-existing `bun run build` TS errors from in-flight TASK-96/97 files. diff --git a/package.json b/package.json index fd23f4e..60a7e50 100644 --- a/package.json +++ b/package.json @@ -20,14 +20,19 @@ "check:file-budgets:strict": "bun run scripts/check-file-budgets.ts --strict", "check:main-fanin": "bun run scripts/check-main-runtime-fanin.ts", "check:main-fanin:strict": "bun run scripts/check-main-runtime-fanin.ts --strict", + "test:config:src": "bun test src/config/config.test.ts src/config/path-resolution.test.ts", "test:config:dist": "node --test dist/config/config.test.js dist/config/path-resolution.test.js", + "test:config:smoke:dist": "node --test dist/config/path-resolution.test.js", + "test:core:src": "bun test src/cli/args.test.ts src/cli/help.test.ts src/core/services/cli-command.test.ts src/core/services/field-grouping-overlay.test.ts src/core/services/numeric-shortcut-session.test.ts src/core/services/secondary-subtitle.test.ts src/core/services/mpv-render-metrics.test.ts src/core/services/overlay-content-measurement.test.ts src/core/services/mpv-control.test.ts src/core/services/mpv.test.ts src/core/services/runtime-options-ipc.test.ts src/core/services/runtime-config.test.ts src/core/services/config-hot-reload.test.ts src/core/services/tokenizer.test.ts src/core/services/subsync.test.ts src/core/services/overlay-bridge.test.ts src/core/services/overlay-shortcut-handler.test.ts src/core/services/mining.test.ts src/core/services/anki-jimaku.test.ts src/core/services/jellyfin.test.ts src/core/services/jellyfin-remote.test.ts src/core/services/immersion-tracker-service.test.ts src/core/services/app-ready.test.ts src/core/services/startup-bootstrap.test.ts src/core/services/subtitle-processing-controller.test.ts src/core/services/anilist/anilist-update-queue.test.ts src/renderer/error-recovery.test.ts src/subsync/utils.test.ts src/main/anilist-url-guard.test.ts src/window-trackers/x11-tracker.test.ts", "test:core:dist": "node --test dist/cli/args.test.js dist/cli/help.test.js dist/core/services/cli-command.test.js dist/core/services/ipc.test.js dist/core/services/field-grouping-overlay.test.js dist/core/services/numeric-shortcut-session.test.js dist/core/services/secondary-subtitle.test.js dist/core/services/mpv-render-metrics.test.js dist/core/services/overlay-content-measurement.test.js dist/core/services/mpv-control.test.js dist/core/services/mpv.test.js dist/core/services/runtime-options-ipc.test.js dist/core/services/runtime-config.test.js dist/core/services/config-hot-reload.test.js dist/core/services/tokenizer.test.js dist/core/services/subsync.test.js dist/core/services/overlay-bridge.test.js dist/core/services/overlay-manager.test.js dist/core/services/overlay-shortcut-handler.test.js dist/core/services/mining.test.js dist/core/services/anki-jimaku.test.js dist/core/services/jellyfin.test.js dist/core/services/jellyfin-remote.test.js dist/core/services/immersion-tracker-service.test.js dist/core/services/app-ready.test.js dist/core/services/startup-bootstrap.test.js dist/core/services/subtitle-processing-controller.test.js dist/core/services/anilist/anilist-token-store.test.js dist/core/services/anilist/anilist-update-queue.test.js dist/renderer/error-recovery.test.js dist/subsync/utils.test.js dist/main/anilist-url-guard.test.js dist/window-trackers/x11-tracker.test.js", + "test:core:smoke:dist": "node --test dist/cli/help.test.js dist/core/services/runtime-config.test.js dist/core/services/ipc.test.js dist/core/services/overlay-manager.test.js dist/core/services/anilist/anilist-token-store.test.js dist/core/services/startup-bootstrap.test.js dist/renderer/error-recovery.test.js dist/main/anilist-url-guard.test.js dist/window-trackers/x11-tracker.test.js", + "test:smoke:dist": "bun run test:config:smoke:dist && bun run test:core:smoke:dist", "test:subtitle:dist": "echo \"Subtitle tests are currently not configured\"", "test": "bun run test:config && bun run test:core", - "test:config": "bun run build && bun run test:config:dist", - "test:core": "bun run build && bun run test:core:dist", + "test:config": "bun run test:config:src", + "test:core": "bun run test:core:src", "test:subtitle": "bun run build && bun run test:subtitle:dist", - "test:fast": "bun run test:config:dist && bun run test:core:dist", + "test:fast": "bun run test:config:src && bun run test:core:src", "generate:config-example": "bun run build && node dist/generate-config-example.js", "start": "bun run build && electron . --start", "dev": "bun run build && electron . --start --dev",