refactor(move): move the runner's inline unit tests into UnitTests/ - #2854
Conversation
Every whole `#if AGENT_DEVICE_RUNNER_UNIT_TESTS` test block in a production runner source moves to `UnitTests/RunnerTests+<Source>Tests.swift` under the same guard, with the same test names and bodies. Production sources keep only the guarded test seams (overrides, injected failures, the recorder timestamp accessor, and RunnerTests' stored test properties). Declarations a moved test reads widen from private to internal. Fixture loaders that resolve contracts/fixtures from #filePath step up one more directory, as the existing UnitTests loaders do. Part of #2792 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… inline test RunnerTapPointPolicy.swift no longer declares a test, so the declaration scan and its test stop citing it as the file whose name hid one. Part of #2792 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
|
|
This is a pure move, and 61fcc69 checks out: I compared the multiset of test lines before and after, and the content is preserved. CI is green across all 18 checks, including the runner unit-test lanes and the xctest-selection check, which are the routes that matter here. I did not run the macOS host lane or the iOS build-for-testing myself, and the 233-test counts before and after come from the PR body and CI, not from a run I did. The multiset match proves line content survived the move, but it does not prove each test kept an equivalent guard (for example Not blocking: the PR says this is part of #2792 and the CommandExecution split under 1,000 lines (apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift) is still to do, so keep #2792 open for that follow-up, but that's optional to act on now. Nothing here stops this from merging. |
|
main (#2854, #2855) moved the runner's inline unit tests into UnitTests/ and split RunnerTests+CommandExecution.swift along command families. Rebase conflicts dropped this PR's edits from the inline blocks the rebase kept on main; relocate them into the file main now owns for each family: - RunnerTests+SnapshotTests.swift: the query-sweep slice-deadline and fail-closed-invalidation tests, and the bounded-modal-probe helper now takes a SnapshotCaptureTarget. - RunnerTests+SnapshotCapturePlanTests.swift: the tier-timeout rejection pair and the private-AX depth helper now builds a SnapshotCaptureTarget. - RunnerTests+SnapshotTimingTests.swift: the deadline-exhausted tier penalty test.
Summary
Part of #2792. Based on main: the #2825–#2845 stack merged, and main
fa3b7291fhas the same tree as60e533284.Pure move: every whole
#if AGENT_DEVICE_RUNNER_UNIT_TESTStest block in a production runner source moves toUnitTests/RunnerTests+<Source>Tests.swiftunder the same guard, with the same test names and bodies. This includes the blocks the rebased base added inRunnerTests+Lifecycle.swiftandRunnerTests+SynthesizedGesturePolicy.swift. Production files keep only test seams: overrides, injected failures, the recorder timestamp accessor, and stored test properties. The move widens 20 declarations fromprivatetointernal, each read by a moved test. Five fixture loaders step up one more directory. Comments that pointed at the old test locations now point at the new ones. The finalchore(gates)commit rewords the declaration-scan comments. 54 files.git diff -M90% --stat origin/main...HEAD: 54 files, +4088/−4033. A removed-vs-added line multiset differs only inprivate→internal, imports,extension RunnerTests {wrappers, and the five// UnitTestspath steps.Validation
Tested at
5785e206b..61fcc6969(tip61fcc6969, tree-identical to the originally testedea85fd32e):60e533284) and 233, 0 failures after.pnpm check:xctest-selection: host 233, iOS PR list 103, nightly 280, 0 unreachable, green.pnpm check:packaged-runner-swift: green.pnpm check:affected --run: all runnable checks passed. It selected the full set because of the workflow and tooling paths.build-for-testingwith the unit-test flag: succeeded.func testnames: 285 before and after, with no duplicates.An adversarial fresh-context review tried to refute the pure move and confirmed test bodies, guards, lane reach, and every access widening. It found three stale comments, which are now fixed.
🤖 Generated with Claude Code