refactor(daemon): own the replay script source fixture where it is used

Merged
TH
8h ago
+145-96

What

Removes replay-port/replay-script-source-fixtures (replay-port exports 30 → 29), the last fixture export in the replay packages. The loader-based helpers can't live in test-kit: they need replay-port, and replay-port now depends on test-kit, which would be a project-reference cycle. Each consumer therefore owns a private copy of only what it uses.

Fixture decision

HelperImporters by packageOutcomeReason
withClientReplayScriptSources, replayScriptSourceBundleFor, maestroScriptSourceBundleFordaemon 22 files (20 tests, 2 support harnesses)daemon-private packages/daemon/src/__tests__/support/replay-script-source-fixture.ts (the original file, git mv)Used by daemon handler/router/replay-runtime tests (SessionStore, replay command); none is a replay-port test. Imports the loader through replay-port's existing production exports (script-source-bundle, source-discovery).
replayScriptSourceBundleFor, withClientReplayScriptSourcesroot: 2 daemon-composition tests (specifier-only edits) and test/integration/provider-scenarios/harness.tsroot-private src/__tests__/test-utils/replay-script-source.fixtures.tsOnly the two helpers root uses. 45 lines in total, about 34 of code; written compactly rather than copied, same behaviour (passes through a request that already carries sources, or that has none to collect).
replayScriptSourceBundleFor, maestroScriptSourceBundleForreplay-port 1 (session-test-source-discovery-inspection.test.ts)replay-port-private src/replay-script-source.fixtures.ts, not exportedMoved there in #3650; keeps only the two helpers it uses.
noMaestroIncludeSources0 (maestro keeps its own in daemon-runtime-port-fixtures.ts)deletedDead.

Commits

  1. git mv packages/replay-port/src/replay-script-source.fixtures.ts packages/daemon/src/__tests__/support/replay-script-source-fixture.ts (pure).
  2. The daemon file's own imports (production exports of replay-port) and noMaestroIncludeSources removed; the 22 daemon importers point at it relatively; the root fixture, the slim replay-port fixture and the three root specifiers; the replay-port export dropped.

Test-count parity

All 19 test files that import the fixture, run with AGENT_DEVICE_VITEST_MAX_WORKERS=1 --testTimeout=60000: 119 passed / 0 failed here. On origin/main, the same 19 files under normal timeouts: 107 passed / 12 failed, 119 total — the 12 are 5 s timeouts and the failing set changed between runs (host load average 150-580 while I measured), so I read the totals (119 = 119) as parity and the 60 s run as the pass evidence. CI is authoritative for green on this head. No vi.mock was added; the fixture files contain none.

Surface

replay-port exports 30 → 29; no new subpath, barrel or export *; test-kit untouched. replay-port, daemon and root each import only production exports of replay-port.

Gates

check:layering, check:gate-manifest, pnpm format, pnpm lint and tsc -b clean. check:affected --run not run locally: the shared host gate lock was queued behind other threads and load was extreme; CI runs it.

šŸ¤– Generated with Claude Code