Contain xcodebuild's derived data in the test's temp dir #3050
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.17) × (1 − Review Confidence (0.78)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.17 · 10 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.73 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.143
Real PR Conversation Timeline
4 items
Approved
Approved these changes.
The CI failures here are the pre-existing wedged-simulator flake, not this change:
HelloWorldSwiftUITests, ButtonsUITests, ios_coverage_ui_test_coverage_new_runner) is the same session-sensitive group that has been failing on other PRs whose runner-test caches get invalidated (#3026 has the full diagnosis: a previously-terminated test leaves the reused, still-booted simulator with a dead device-side session, and every later xcodebuild test-without-building against it hangs or fails to initialize).BAZEL_TEST_iPhone 16_26.0, a well-formed invocation with -derivedDataPath, then silence until the timeout SIGTERM.-derivedDataPath on every invocation.#3026 adds the recovery machinery for this (its own CI is now fully green, including the previously-failing 9.x job, because its first run self-heals a wedged agent). Suggest retrying this build after #3026 lands — no change needed here.
Approved
Good.
keith
erneestoc
Every
xcodebuild test-without-buildinginvocation creates a~/Library/Developer/Xcode/DerivedData/temporary-<hash>/directory that nothing ever deletes. When the runner does not pass-resultBundlePath— i.e. any xcodebuild-path run withoutcreate_xcresult_bundle— that directory receives a full.xcresultof the run; and passing-resultBundlePathalone does not fix it, a bookkeeping directory still leaks per run.One development machine had accumulated 267 of these directories totaling 26GB. Every CI agent running simulator tests through the xcodebuild path leaks one per test run, silently.
Fix: pass
-derivedDataPathpointed into the runner'stest_tmp_dir, which the existing EXIT trap already deletes. An explicit-resultBundlePath(fromcreate_xcresult_bundleorxcodebuild_args) still wins for the result bundle itself.Measurements
New DerivedData
temporary-*directories created per invocation (Xcode 26.2, iOS 26.2 simulator, hosted unit test):| xcodebuild flags | new dirs per run | contents |
|---|---|---|
| (none — today's runner without
create_xcresult_bundle) | 1 | 152K, including a complete orphan.xcresult||
-resultBundlePathonly | 1 | 24K bookkeeping ||
-derivedDataPath(this PR) | 0 | — || both | 0 | — |
End-to-end through the runner after this change: default mode, dir count unchanged across runs (was +1 per run); with
create_xcresult_bundle = True, the bundle still lands inTEST_UNDECLARED_OUTPUTS_DIR(verified present inoutputs.zip) and DerivedData stays untouched.Steps to reproduce the leak
Test plan
xcodebuild test-without-buildingflag matrix above (each variant run against the same xctestrun).CREATE_XCRESULT_BUNDLE=1still producestests.xcresultin undeclared outputs with DerivedData untouched.bash -n.