refactor(daemon): cut daemon test edges into root data fixtures and fakes [11a-3]
Plan step 11a-3: daemon test files stop importing the root src/__tests__/test-utils/ data fixtures, and the review's copied-fake findings are resolved with one owner each.
Targeted root modules (scan edges now 0): device-inventory-gateways, replay-script-source, android-ui-hierarchy-fixtures, android-snapshot-capture, plugin.fixtures. Total daemon→root scan residue after the cut: 23 edges, all into the platform-runtime cluster owned by step 11a-2 (the only remaining 11a-1 residue).
Review resolutions:
- Inventory fake — one owner:
packages/device-selection/src/inventory-gateways.fixtures.ts, exported as@agent-device/device-selection/inventory-gateways-fixtures, withfindInstalledAppin options,createTestDeviceInventoryGatewaysexported, and the nullable-provider bridge (withTestDeviceInventoryProvider) extracted once. Daemon (37 files undersrc/daemon), root composition, device-selection's own tests, and test/integration all import it. The root wrapper and its pin are deleted: the wrapper's fail-closed pin duplicated the real composer's pin already atsrc/platform-runtime-device-inventory.test.ts, and the real adapter has its own direct tests. test-kit was not viable: the fake needs the root composition'screateDeviceInventoryContext(device-selection's production entry), which would make test-kit→device-selection while device-selection's tests need test-kit — atsc -bproject-reference cycle — so the package's own test-only subpath (the fallback) is the one owner. - Replay collector — no second implementation: the real client collector moved into replay-port (
script-source-bundle,source-discovery, byte-pure moves with their own test suites), and the bundle helpers live once inreplay-port/src/daemon-port/replay-script-source.fixtures.ts(./replay-script-source-fixtures), typed onDaemonWireRequestso it serves both trees without a production seam. Both test trees exercise the same globs, size cap, not-found AppErrors and ranking through it. The rootsrc/__tests__/test-utils/replay-script-source.tsis deleted (its exports move with it; nothing suppressed via.fallowrc). - Android captures:
snapshot-capture-fixturesandui-hierarchy-fixturesare test-only entries on@agent-device/platform-android(the Apple runner requests-fixtures pattern), with the archived raw JSONs underpackages/platform-android/src/fixtures/whereown:package-captureowns them. Contract comments kept to one line. plugin.fixturesstays in@agent-device/test-kit/plugin.fixtures(package vocabulary over the filesystem install, no platform adapters).createTestDeviceInventoryGatewaysFromProvideris used (lock-policy test + integration harness), so it stays exported; the daemon-side copy that fallow flagged is deleted.pnpm formatrun repo-wide.- Base delta is test-side only: the moved collector modules are byte-identical and the only production root edit is the two import lines in
src/commands/replay/index.ts; everything else is test/fixture moves, import retargets, and gate wiring. No limrun/CONTRIBUTING/coverage/website files in the delta against the current base.
Gates (on the pushed commit, under the host gate lock): check:affected --run clean across all selected lanes; check:quick, check:layering, check:di-seams, check:gate-manifest, check:fallow, the eager-closure budgets table (three APPROVED_OVER_CEILING rows + the mechanics-facet exception for the Android fixture entries), the R13 export-pin tests, and the test-file-size ratchet green. Targeted full runs: src/daemon, src/__tests__, packages, scripts with zero failures; vitest list src parity vs base is exact modulo the moved test files' path keys and one intentionally deleted duplicate pin (the root inventory wrapper's fail-closed case, already owned root-side).
Risk: no production behavior change (CLI startup import-closure guard green through the replay move). Eager-require weight: daemon suites now pull replay-port's real collector instead of the local test twin.
NO DOCS — test topology and fixture ownership only; no user-facing behavior or CLI surface changes.
Follow-up commit (bd49bf829, second review round): assertProviderOutcome/assertSourceFamily moved from the root composer into @agent-device/contracts/device; the fake now calls the shared assertProviderOutcome instead of restating the flow (a malformed provider outcome fails closed with provider_inventory_contract_violation in both paths, pinned by a new fixture test). The fake's local path keeps its per-family filter because the local option is a flat whole-inventory discoverer fanned out per family — that filter is the adapter to the per-family source contract, not a restated assertion site.
Design answers at e4eee6b (review follow-up round):
- Composer home (Q1): yes, moved. The composed-gateways flow now lives in
@agent-device/device-selection/composed-inventory-gatewayswith the installed-app probe injected instead of hardcoded;src/platform-runtime-device-inventory.tsstays as the production wiring that attaches the Apple probe (function-scoped import keeps the composition root's eager closure flat; the hub no-growth gate is green). The test fake composes through the real composer with fake registry sources — the root, daemon-composition, and integration consumers exercise the production flow, not a restatement. No root-side wrapper is needed anymore: the one owner is the package entry both trees build on. - Collector home (Q2): moved out of the daemon port.
script-source-bundle,source-discovery, and the request fixture now sit atpackages/replay-port/src/(client-side replay vocabulary, likesession-replay-vars), outside thedaemon-port/engine-prefix zone; the./script-source-bundle,./source-discovery, and./replay-script-source-fixturessubpaths keep their names. Caller filesystem reads stay out of the daemon's dispatch vocabulary.