refactor(replay): move four daemon tests of replay-port code into replay-port

Merged
TH
7h ago
+9-13

What

Four daemon tests that only exercise replay-port modules move into replay-port, beside the module they test and importing it relatively. Their package export (./session-test-source-discovery) loses its last importer and is dropped. Second slice of the replay-package sweep (first: #3647, independent).

Commits

  1. refactor(replay): move four daemon tests of replay-port code beside their modules — git mv only. git diff -M --stat: four renames, 0 insertions / 0 deletions.
  2. refactor(replay): import the moved tests relatively — specifier rewrites only, plus one type: attachRemoteReplayTestArtifacts takes DaemonWireRequest, which daemon-private DaemonRequest only widened, so the test's req() helper is typed DaemonWireRequest from @agent-device/contracts/command.
  3. chore(gates): drop the replay-port session-test-source-discovery export.

Moves

From (packages/daemon/src/sessions/__tests__/replay-suite/)To (packages/replay-port/src/daemon-port/__tests__/)Module
session-test-suite-command-cancellation.test.tstest-command-cancellation.test.tstest-command.ts (bindReplayTestAttemptCancellation)
session-test-suite-command-nested-flags.test.tstest-command-nested-flags.test.tstest-command.ts (buildNestedReplayFlags)
session-test-suite-command-remote-artifacts.test.tstest-command-remote-artifacts.test.tstest-command.ts (attachRemoteReplayTestArtifacts)
session-test-source-discovery.test.tssession-test-source-discovery-inspection.test.tssession-test-source-discovery.ts

The last one takes an -inspection aspect suffix because replay-port already has a different session-test-source-discovery.test.ts (the lazy-backend-resolution cases). Both stay; the existing one is untouched.

None of them uses vi.mock.

Fixture decision (these tests' fixture imports)

FixtureImporters movedOutcome
test-kit/tmp-dir mkdtempForTestSync2 testsreplay-port's own tmp-dir.fixtures.ts (already there for the package's tests)
replay-port/replay-script-source-fixtures1 testrelative import of ../../replay-script-source.fixtures.ts; the export itself stays until test-kit's single entry lands (20 daemon + root importers remain)

Test-count parity (vitest run <files> --reporter=json, passed/failed)

TestBefore (daemon path, a907a919a)After (replay-port path)
cancellation5/05/0
nested-flags6/06/0
remote-artifacts3/03/0
source-discovery(-inspection)4/04/0
existing session-test-source-discovery.test.ts (untouched)n/a3/0

Total moved 18 → 18. Selection: destination is under packages/*/src/**/*.test.ts (unit-core include); vitest collected all five files by path. check:gate-manifest ok; check:affected selected the moved files (they appear in its related-test command).

Surface

replay-port exports 32 → 31 (cumulative with #3647: 33 → 31 against main). No new subpath, barrel or export *. bindReplayTestAttemptCancellation and buildNestedReplayFlags keep their module-level export for the colocated tests; their package subpath (./test-command) still has production and integration importers.

Remaining non-package importer of attachRemoteReplayTestArtifacts: test/integration/provider-scenarios/remote-test-artifacts-materialization.test.ts (root worker's file). Not touched.

Gates (on 1162edeac)

check:quick, check:layering, check:fallow, check:gate-manifest, pnpm format: clean. check:affected --run: all pass except scripts/__tests__/eager-closure-budgets.test.ts > no APPROVED_OVER_CEILING row is stale, which names packages/daemon/src/index.ts and fails on any branch off a907a919a (passes on a907a919a itself only because the check is deferred when merge-base equals head). Left stale by the daemon single-entry PR #3633; daemon thread to remove that row.

R83 and the colocation baseline are not on main yet, so this only shrinks what the seed will contain.

🤖 Generated with Claude Code