refactor(platform-apple): colocate sixteen tests with the modules they test
Summary
Colocation renames for platform-apple: 16 of the 19 test files that were not beside a module they are named for (my recount matched the coordinator's 19). No fixture export is touched. The remaining three are explained below.
The rule thread's baseline is now a merge-base ratchet, so there is nothing to delete; counts are from my scan (/tmp/coloc/scan.mjs, same definition as the coordinator's numbers).
Commits
refactor(tests): name platform-apple tests for the module they test—git mvplus specifier changes. Beyond import specifiers: the Swift-sources path ininteractions.test.ts(moved up two directories), and references to the old paths in.github/workflows/macos.yml(the native-proof lane listscache-native-runtime.test.ts), two docs, an ADR, a few comments, the command-coverage evidence intest/integration/command-coverage/declarations.ts, and the boundary-fault evidence inpackages/test-kit/src/boundary-fault-matrix.ts.refactor(platform-apple): split the runner response test by the module it covers—decodeRunnerResponseBodyand siblings live inrunner-contract.ts,parseRunnerResponseinrunner-exchange.ts.refactor(platform-apple): name the runner dispatch-disclosure driver for the runner entry— per the coordinator's decision; the contracts fixture's owning path follows.
Renames (all under packages/platform-apple/src)
| Old | New | Module under test |
|---|---|---|
runner/__tests__/runner-close-finalization | runner-session-close-finalization | runner-session.ts (releaseIosRunnerOnClose, stopIosRunnerSession) |
runner/__tests__/runner-command-busy-resend | runner-client-busy-resend | runner-client.ts (runAppleRunnerCommand) |
runner/__tests__/runner-command-retry | runner-client-command-retry | runner-client.ts |
runner/__tests__/runner-recovery-wiring | runner-client-recovery-wiring | runner-client.ts (header: enters at runAppleRunnerCommand on purpose) |
runner/__tests__/runner-early-exit-diagnosis | runner-startup-transport-early-exit | runner-startup-transport.ts (buildRunnerEarlyExitError) |
runner/__tests__/runner-readiness-routing | runner-command-traits-readiness-routing | runner-command-traits.ts |
runner/__tests__/runner-request-cancellation | runner-lifecycle-request-cancellation | runner-lifecycle.ts |
runner/__tests__/runner-start-admission | runner-xctestrun-start-admission | runner-xctestrun.ts (start-admission functions) |
runner/__tests__/runner-startup-failure-reasons | runner-xctestrun-startup-failure-reasons | runner-xctestrun.ts (ensureXctestrunArtifact) |
runner/__tests__/runner-response | split → runner-contract-response, runner-exchange-response | runner-contract.ts, runner-exchange.ts |
runner/__tests__/runner-dispatch-disclosure | index-dispatch-disclosure | runner entry (drives several runner modules against the contracts table) |
__tests__/screenshot-backend | __tests__/interactor-screenshot-backend | interactor.ts |
__tests__/watchos-sentinel | __tests__/interactor-watchos-sentinel | interactor.ts |
core/__tests__/interactions | src/interactions.test.ts | src/interactions.ts (+ the Swift route-parity test) |
core/__tests__/runner-mac-arch | core/__tests__/runner-client-mac-arch | core/runner-client.ts (see below) |
snapshot-source/native-runtime | snapshot-source/cache-native-runtime | snapshot-source/cache.ts (buildSnapshotBridgeCompileArgv) |
Not changed
runner-mac-archstays undercore/. I first moved it besideapple-runner-platform.ts, and R77 (apple-runner-host-port) rejected it: the test imports@agent-device/host-kit/commandand/processdirectly, which is forbidden underrunner/. Itsimport '../runner-client.ts'is also the production host binding it relies on, sorunner-client-mac-archis the honest name incore/__tests__.runner/__tests__/runner-requests.test.tsand__tests__/runner-requests.test.ts: cross-module request-site conformance drivers whose*runner-requests.test.tsname is a contract (runner-requests.jsonproducer paths and theendsWithcheck). Unrenamed; flagged to the coordinator.core/__tests__/apps.test.ts(24 tests over 6 modules) needs a real split; it is the next PR.
Test-count parity (vitest --reporter=json, passed/total)
| Before | After |
|---|---|
runner-close-finalization 18 | runner-session-close-finalization 18 |
runner-command-busy-resend 7 | runner-client-busy-resend 7 |
runner-command-retry 33 | runner-client-command-retry 33 |
runner-recovery-wiring 47 | runner-client-recovery-wiring 47 |
runner-early-exit-diagnosis 11 | runner-startup-transport-early-exit 11 |
runner-readiness-routing 1 | runner-command-traits-readiness-routing 1 |
runner-request-cancellation 8 | runner-lifecycle-request-cancellation 8 |
runner-start-admission 12 | runner-xctestrun-start-admission 12 |
runner-startup-failure-reasons 33 | runner-xctestrun-startup-failure-reasons 33 |
runner-response 11 | runner-contract-response 8 + runner-exchange-response 3 |
screenshot-backend 1 | interactor-screenshot-backend 1 |
watchos-sentinel 2 | interactor-watchos-sentinel 2 |
core/__tests__/interactions 25 | interactions 25 |
runner-mac-arch 1 | runner-client-mac-arch 1 |
native-runtime 47 | cache-native-runtime 47 |
runner-dispatch-disclosure 31 | index-dispatch-disclosure 31 |
| 257 (+31) in 15 (+1) files | 257 (+31) in 16 (+1) files |
Selection: runner/** files run in the apple-runner project, everything else in unit-core; no file changed project. check:affected --run selected 336 test files (2,519 tests, all passed) including the renamed ones. The macOS workflow lane that lists cache-native-runtime.test.ts is updated.
vi.mock effectiveness
Pointed each mock path at a nonexistent module, one at a time, and reverted:
| File | Mock | Result |
|---|---|---|
runner-session-close-finalization | ../runner-io.ts | 11 failed / 18 |
../runner-startup-transport.ts | 15 failed / 18 | |
../runner-transport.ts | 2 failed / 18 | |
../runner-xctestrun.ts | 16 failed / 18 | |
runner-client-busy-resend | ../runner-session.ts | 7 failed / 7 |
runner-client-command-retry | ../runner-session.ts | 33 failed / 33 |
../runner-xctestrun.ts | 33 passed / 33 | |
runner-client-recovery-wiring | ../runner-session.ts | 42 failed / 47 |
runner-lifecycle-request-cancellation | ../runner-io.ts | 8 passed / 8 |
../runner-startup-transport.ts | 6 failed / 8 | |
../runner-xctestrun.ts | 8 failed / 8 | |
interactions | ./core/runner-client.ts | 25 failed / 25 |
interactor-screenshot-backend | ../core/screenshot.ts | 1 failed / 1 |
Two mocks (bold) are not load-bearing for any current case. They are unchanged by this PR; I'll spy-check them and remove the dead ones in a follow-up unless you want them here.
Surface
exportscounts: platform-apple 21 → 21 (no subpath added or removed).- Colocation offenders: platform-apple 19 → 3 (
apps.test.tsand the tworunner-requests.test.tsdrivers described above).
Gates
check:quick, check:layering, check:fallow, check:gate-manifest, check:affected --run all pass on the commit before the dispatch-disclosure rename; the rename is covered by index-dispatch-disclosure (31) and contracts/dispatch-disclosure (3) passing, and pnpm format is clean. I'll rerun the full set on the final head if you want it before merge.
🤖 Generated with Claude Code