fix(apple): clean the runner derived path the runner uses
Merged
TH
10h ago+147+147+012345678901234567890123456789-34-34-01234567890123456789
Summary
pnpm clean:xcuitest[:ios|:macos|:tvos|:visionos] ignored AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH and always cleaned the shared ~/.agent-device/apple-runner/derived. A worker that set the override to rebuild its own runner instead removed Build/, Logs/ and the cache json that every other daemon on the host uses.
- The override is now read through
resolveRunnerDerivedOverrideinapple-runner-platform.ts, which the runner path, cache-retention and unsafe-clean guard also use. The clean script imports it through@agent-device/platform-apple/runner/operations; there is no second env parser. - The runtime has one override variable and no per-platform ones. With it set, every platform maps to that directory, as in the runner build. The script then removes only transient build entries and keeps other entries, so a mis-set override cannot delete a whole directory.
- With no override, behavior and output are unchanged. Output always names the directory.
- The default layout comes from
resolveRunnerScriptDefaultDerivedPathin the runner path owner, which the clean script imports.scripts/build-xcuitest-apple.shis shell and still spells the same default paths itself; it now trims the override like the runtime, so a blank value means "not set" in both. - The five
clean:xcuitest*scripts and the smoke test runnode --experimental-strip-types, because the script imports workspace TypeScript. Without the flag, Node 22.14 fails withERR_UNKNOWN_FILE_EXTENSION(reproduced); with it the script and all 8 smoke tests pass on Node 22.14.0 and Node 26. - CONTRIBUTING documents the behavior.
9 files touched.
Validation
Tested head: d3b3d44330 (merged with origin/main). Earlier results below are from f13251f67e.
- New tests in
test/integration/smoke-clean-xcuitest-derived.test.ts: override honored for ios and macos with the default directory untouched, and blank override falls back to the default. With the base script, the two override tests fail and the other 6 pass; with this head all 8 pass. pnpm test:smoke,vitest run packages/platform-apple/src/runner(958 tests),scripts/__tests__,scripts/layering,test/repo-guardspass.typecheck,check:layering,check:di-seams,check:fallow,check:production-exports,check:agent-guidance,check:doc-prose,check:doc-links,check:command-docs,build,check:package,check:bundle-owner-files,format:checkexit 0.pnpm check:affected --run --head d3b3d44330exits 1 only atvitest-related: 14 timeouts (5s, 10s, 20s budgets) while the host load average was about 1000. A rerun of the failed files passed all but one provider-scenario file that still timed out under that load. Lint and the other stages passed. CI is the authority for these.- CI owns coverage, Integration Tests and Apple lanes. No device run applies: no live device behavior changed.
- Manual check used an override under the worktree
.tmp/, never the real default directory.
🤖 Generated with Claude Code