ci: build cmuxTests without the compilation cache so it rebuilds incrementally

Merged
TE
2mo ago
+19-4

A PR admission recompiled every cmuxTests file (about 1,100) even when the change touched one test file: 139 s of cmuxTests on 12vcpu, 1,355 CPU s. cmuxTests now builds without the compilation cache, so swift-driver's incremental build decides what to recompile. The app and every package keep the cache and their exact compiler arguments.

Why the cache defeats incremental builds here

With -driver-show-incremental on the cached build, all 1,073 inputs are Invalidated externally by Newer: cmuxTests-…-ChainedBridgingHeader.h. Under the cache the driver chains the app's cmux-Bridging-Header.h, which cmuxTests reaches through @testable import cmux_DEV, into a generated header and rewrites it on every build. cmuxTests has no bridging header of its own, so there is nothing in the project to change. COMPILATION_CACHE_ENABLE_CACHING=$(CMUX_CI_COMPILATION_CACHE_$(TARGET_NAME):default=YES) is evaluated per target, so only cmuxTests opts out.

Measurements

Canary #14249, run 36081880621, blacksmith-12vcpu-macos-26, Xcode 26.6. Each row is a cmux-unit rebuild after the one before, on the admission's DerivedData.

EditcmuxTests, cache oncmuxTests, cache off for cmuxTests onlytotal rebuild, off
app function body only1 s, 0 files1 s, 0 files49 s
one test file body139 s, all files (1,355 CPU s)31 s, 1 task44 s
signature change inside an existing extensionall files (round 1, 6vcpu)30 s, 0 files66 s
new top-level private func in an app file135 s, all files117 s, all files164 s
new top-level extension on Workspaceall files (round 1)110 s, all files234 s

The app target stays incremental with the per-target setting: the body edit compiled 2 app tasks, the same as with the cache on. Building cmux-numeric-locale and then cmux-unit again was a 13 s no-op, so the scheme order in this script does not reset the build record.

What this does not fix

  • Adding or removing any top-level declaration in the app still recompiles all of cmuxTests, with or without the cache. The driver remarks trace it through interface of source file from cmux_DEV to types every test file uses (NSObject, String), because the imported module's top-level names carry no per-declaration fingerprints. On 100 six-commit windows of main, 27 added or removed a top-level app declaration.
  • What's left of a small rebuild is mostly cmuxTests' own emit-module (26 s of the 31 s). Xcode 26 has no setting that skips module emission for a test bundle.
  • Splitting cmuxTests into per-area bundles would not help with app edits. The invalidation covers the whole module, and 915 of 1,068 test files import cmux_DEV.
  • On the macOS 15 pool (Xcode 26.3) the app itself recompiled all 5,218 files on a body-only edit under the cache (run 36035657899). That is separate from this change.

The first admissions after this lands rebuild cmuxTests once, because its arguments differ from the current seeds. The seeds pick up the new arguments from the next seed build, since seed-derived-data.yml builds through this script.

Validation

tests/test_ci_test_compilation_cache_seed.sh passes with the new arguments. The measurements above come from the canary. This PR's own admission shows the setting in real CI.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Builds cmuxTests without the compilation cache so edits recompile only what changed instead of all ~1,100 test files. A one-test-file edit dropped from 139 s (1,355 CPU s, all files) to 31 s (one task). The app and every package keep the cache; the setting is evaluated per target, so this only affects cmuxTests.

Under the cache, the driver regenerates cmuxTests' chained bridging header (the app's header reached through @testable import) on every build, which invalidates every input. Without the cache, swift-driver's incremental build works normally.

What this does not fix

  • Adding or removing a top-level declaration in the app still recompiles all of cmuxTests, with or without the cache.
  • The first admissions after this lands rebuild cmuxTests once because its build arguments change.

Summary by CodeRabbit

  • Chores
    • Updated build configuration to keep compilation caching enabled by default while disabling it for the cmuxTests target. This adjustment applies to the CI build process; no changes to app features or behavior are included.