test: move root src tests off the daemon's testing exports
Summary
Removes the daemon testing-export imports from the 15 owned root src/** test files. Root behavior remains beside root modules; daemon logic now has package-local tests; composed CLI/client cases start the daemon through public startDaemonRuntime. No public daemon entry, test export, barrel, or export * was added. R78/R82 remain satisfied.
Placement and test counts
Counts are expanded Vitest cases (test.each rows expanded). The 15 source paths on origin/main total 108. Vitest lists 101 declarations; the HarmonyOS selection table adds 2 cases and the gateway lifecycle/mismatch tables add 5.
Source on origin/main | Cases | Destination(s) on this head; full file cases | Class |
|---|---|---|---|
src/__tests__/cli-remote-diagnostics.test.ts | 4 | Same path: 3; packages/remote/src/__tests__/remote-request-diagnostics.test.ts: 4 (existing) | b |
src/__tests__/lease-provider-profile-fields.test.ts | 2 | Same path: 2 | b |
src/__tests__/limrun-runtime.test.ts | 25 | Same path: 25; daemon retry behavior remains in packages/daemon/src/server/__tests__/provider-lease-expiry.test.ts: 4 (existing) | c |
src/__tests__/platform-runtime-runtime-hints.test.ts | 15 | Same path: 15; packages/daemon/src/sessions/session-runtime-transport-hints.test.ts: 4 | a+c |
src/__tests__/remote-connection-harmonyos.test.ts | 6 | Same path: 6 | c |
src/__tests__/remote-connection-macos-app.test.ts | 8 | Same path: 8 | c |
src/__tests__/takeover-command.test.ts | 5 | Same path: 5; human-control fixture now lives in src/client/human-control.fixtures.ts | c |
src/cli/replay-test/__tests__/session-test-reporter-values-maestro.test.ts | 2 | packages/daemon/src/sessions/handlers/session-progress.test.ts: 3; existing reporter projection src/cli/replay-test/reporters/__tests__/progress.test.ts: 10 | a+c |
src/cli/replay-test/__tests__/session-test-reporter-values.test.ts | 4 | Same package progress test: 3; existing reporter projection: 10; existing reporters/__tests__/registry.test.ts: 20 | a+c |
src/client/lease-client.test.ts | 4 | Same path: 4; human-control fixture now lives in src/client/human-control.fixtures.ts | c |
src/commands/cli-grammar/flag-declaration-admission.test.ts | 4 | Same path: 3; packages/daemon/src/core/session-action-recorder-admission.test.ts: 1 | a+c |
src/daemon-client/__tests__/daemon-client-abort-default-transport.test.ts | 2 | Same path: 2 | b |
src/daemon-client/__tests__/daemon-client-abort-timeout.test.ts | 3 | Same path: 3 | c |
src/daemon-client/__tests__/daemon-client-abort.test.ts | 4 | Same path: 4 | b |
src/platform-runtime-gateway.test.ts | 20 | Same path: 20; packages/daemon/src/sessions/handlers/__tests__/session-appstate-facts.test.ts: 1 | a+c |
The lease-profile, HarmonyOS, and macOS-app tests still assert root connection and lease command behavior; their persisted-state imports now come from @agent-device/remote. The package helper is covered by its existing packages/remote/src/__tests__/remote-connection-state.test.ts; none of these files tests plugin-package internals.
Destination counts for existing files are their full head counts; those files were already selected before this change. The remote request-diagnostics assertion is owned by packages/remote/src/__tests__/remote-request-diagnostics.test.ts, test “an unreachable record leaves no path and names the daemon and request instead.” The Limrun daemon-retry assertion is owned by provider-lease-expiry.test.ts, test “retries a persisted expired provider lease after daemon restart.” Recorder and appstate assertions now live in the new package tests named “recorder sanitization follows the declaration: an undeclared key is dropped, a planted declaration is recorded” and “appstate refuses unavailable provider facts before binding the device.”
The two deleted reporter files were split, not moved wholesale. Daemon event production is covered by the three tests in session-progress.test.ts: “native suite progress carries skip, retry hint, and attempt session values,” “Maestro progress carries its title, step payload, and retry attempt identity,” and “sharded suite progress carries each device and shard-scoped session.” Reporter projection remains in the existing progress.test.ts tests for suite start, test start, steps, pass/fail/skip status, and skipped entries. Exit-code assertions remain in registry tests “getExitCode sees the same suite value onSuiteEnd received” and “reporter exit codes can raise but never lower the suite exit code.” No assertion was dropped.
The daemon fixture rewrites daemon.json after public startup to publish currentDaemonCodeSignature(), matching existing client fixtures that publish that same signature so those clients accept the test daemon.
Selection
vitest.config.ts project unit-core includes src/**/*.test.ts and packages/*/src/**/*.test.ts, which select every root destination and all four new daemon tests. CI selects that project through the registered unit-ci gate (test:coverage:ci) in scripts/check-affected/checks.ts and .github/workflows/ci.yml; check:gate-manifest passed.
Mocks and spies
takeover-command.test.ts: shared-output mock resolves the latch the foreground test awaits; the test then asserts the recorded renew/release requests.limrun-runtime.test.ts:@limrun/apimock has positive create/list/delete call and argument assertions.limrun-runtime.test.ts: iOS instance-client mock factory has positive call/argument assertions.limrun-runtime.test.ts: Android instance-client mock factory has positive call/argument assertions.limrun-runtime.test.ts: partialhost-kit/commandmock recordsrunCmdcalls and arguments asserted by the tests.lease-provider-profile-fields.test.ts:@limrun/apifail-fastiosCreatemock is guarded by negative assertions; its break-proof bypassedrejectRefusedLimrunProfileFieldsand the focused test failed.daemon-client-abort-timeout.test.ts: timeout-seam mock has a positive no-signal control (handleRequestTimeoutcalled once); breaking abort timer clearing makes the paired abort test fail.platform-runtime-gateway.test.ts:inspectFactsspy has a positive once assertion.platform-runtime-gateway.test.ts:bindspy is negative-only; its break-proof injected an owner bind and the focused test failed.
The former snapshot-interactor-capture mock was deleted with the rewritten reporter test; no mock for that subpath survives in this scope.
Mutation checks
Each listed behavior was broken, its focused test failed, and the mutation was reverted (18 destination checks):
src/__tests__/cli-remote-diagnostics.test.ts—localizeRemoteDaemonError.src/__tests__/lease-provider-profile-fields.test.ts—rejectRefusedLimrunProfileFields.src/__tests__/limrun-runtime.test.ts—recoverExpiredLease.src/__tests__/platform-runtime-runtime-hints.test.ts—applyRuntimeHintValues.src/__tests__/remote-connection-harmonyos.test.ts—resolveRequestedLeaseBackend.src/__tests__/remote-connection-macos-app.test.ts—materializeRemoteConnectionForCommand.src/__tests__/takeover-command.test.ts—takeoverCommand.src/client/lease-client.test.ts—createAgentDeviceClient.src/commands/cli-grammar/flag-declaration-admission.test.ts—resolveConfigBackedFlagDefaults.src/daemon-client/__tests__/daemon-client-abort-default-transport.test.ts—sendRequest.src/daemon-client/__tests__/daemon-client-abort-timeout.test.ts—sendRequest.src/daemon-client/__tests__/daemon-client-abort.test.ts—sendRequest.src/platform-runtime-gateway.test.ts—createComposedPlatformRuntimeGateway.packages/daemon/src/core/session-action-recorder-admission.test.ts—recordActionEntry.packages/daemon/src/sessions/handlers/__tests__/session-appstate-facts.test.ts—handleAppStateCommand.packages/daemon/src/sessions/handlers/session-progress.test.ts—handleReplayTestCommand.packages/daemon/src/sessions/session-runtime-transport-hints.test.ts—applyDeviceDefaultMetroHost.src/cli/replay-test/reporters/__tests__/progress.test.ts—toReplayTestReporterProgressEvent.
Exports and remaining owners
Daemon exports go from 78 to 71 total (77 to 70 ./testing/* entries). This PR removes:
./testing/__tests__/human-control-fixtures./testing/__tests__/platform-services-fixture./testing/handlers/__tests__/*./testing/handlers/lease./testing/handlers/session-appstate./testing/server/transport./testing/session-runtime
These ten original subpaths remain in use by other owners:
./testing/__tests__/support/session-factories— provider scenariosios-fold.test.tsandios-wait-selector.test.ts../testing/__tests__/support/store-factory— stale provider-admission fixture../testing/lease-registry— nightly concurrency torture and provider-scenario harness/parity tests../testing/provider-lease-expiry— cloud WebDriver runtime scenario../testing/request-dispatch-ledger— stale provider-admission fixture../testing/request-runtime-binding— stale provider-admission fixture../testing/server/http-server— provider-scenario HTTP, remote-proxy, and artifact tests../testing/session-action-recorder— iOS fold integration../testing/session-store— nightly concurrency torture and provider-scenario harness../testing/snapshot-interactor-capture—src/__tests__/daemon-composition/**, owner threadmcp:57b5c3dd, branchrefactor/daemon-testing-exports-composition.
Validation
Before the rebase, head e4ff5146e passed pnpm install --frozen-lockfile && pnpm build, repository-wide pnpm format, pnpm check:quick, pnpm check:layering, pnpm check:fallow, pnpm check:gate-manifest, and pnpm check:affected --run. That check:affected run passed the full unit run (1,854 files; 15,564 passed, 1 skipped), integration-node (137 passed, 12 skipped), and all other selected gates. On rebased head 549ee5168, CI=true pnpm install --frozen-lockfile && pnpm build, pnpm check:quick, and pnpm check:layering passed; the 18 affected Vitest files passed (119 tests). The full check:affected --run is being rerun on this rebased head.
Commits
git diff -M90% --summary origin/main...HEAD reports no renames: the two reporter files were rewritten/split and the four daemon tests were added. No file moved wholesale, so the rebased test migration commit a653fe44e did not need splitting. The export deletion is isolated in 549ee5168.
🤖 Generated with Claude Code