Name the compilation cache when a damaged object fails the build - #139
Merged
Conversation
Xcode fails the dependency scan when a compilation cache object has the wrong node kind, and reports it per source file. The targets it names are whichever ones reach the damaged object first, so the failure reads as a pod incompatibility. The line that identifies the cache, `CAS-based dependency scan failed: not a IncludeTreeRoot node kind`, stays in the transcript. Match that line in `remedyFor` so the build names the cache and the command that empties it. `gc --delete --all` empties every shared cache, which costs the build cache and the Metro caches to recover from a damaged compilation cache. Add `gc --cache <name>`: it acts on the caches whose name or directory carries <name>, and leaves every other cache, device and project entry untouched. A name that no cache carries reports the caches the machine holds. Closes #138
A cache-scoped run inspects no device, project entry or lock, so the report must not claim the machine is clean. Carry the scope in the report and say what the run did not inspect. Reject a blank `--cache` value. An empty string fell through to a full machine-wide run, and a whitespace string selected every cache, so both widened what `--delete --all` reaches. Skip the EAS session sweep for a cache-scoped run. It shells out to eas-cli and takes the EAS project lock to produce a result the report discards. Narrow the compilation cache match to the node-kind line. Other CAS scan failures have other causes, and the remedy is wrong for them. Document the failure in the `errors` guide topic, which is where a user who reads pod names in the error looks, and cover the new flag in the guide contract test and the field test protocol.
The remedy reaches the user through a diagnostic list capped at MAX_DIAGNOSTICS, so it survives only while the scan failure leads the transcript. A real failing transcript puts it first, ahead of the module failures it causes. Pin that with a test that caps a long transcript. Cover the blank `--cache` rejection, which had no test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #138.
Description
A damaged compilation cache fails the build with an error that points at the wrong thing:
The pods are innocent. The transcript carries the line that identifies the cause, which Stim does not surface:
The modules it cannot build are SDK modules, which is what marks the cache rather than the project. The targets it names change from run to run, because they are whichever ones reach the damaged object first, so the failure reads as a pod incompatibility and survives a CLI upgrade.
Solution
remedyFormatches the CAS scan line, so the build names the cache and the command that empties it.gc --delete --allempties every shared cache, which costs the build cache and the Metro caches to recover one damaged cache.gc --cache <name>selects the caches whose name or directory carries<name>, and reports and empties only those. A name no cache carries reports the caches the machine holds instead of printing "Nothing to reclaim".A scoped run inspects no device, project entry or lock, so it says so rather than reporting a clean machine it never looked at. It also skips the EAS session sweep, which otherwise shells out to
eas-cliand takes the EAS project lock to produce a result the scoped report discards.The failure is documented in the
errorsguide topic, since a user who reads pod names in the error looks there before reading a flag list.The selector is deliberately a substring over name and directory, not a fixed list of cache ids:
discoverCachesmixes registered and detected caches whose names come from the manifest, so a fixed list would go stale.Risk
--cachenarrows whatgcacts on and defaults to today's behavior when absent, so the destructive path only ever gets smaller. A blank value is rejected: an empty string fell through to a full machine-wide run and a whitespace string selected every cache, so both widened what--delete --allreaches.The match is the
not a IncludeTreeRoot node kindline alone. A CAS scan can fail for other reasons, and telling those users to empty a cache and pay a cold build would be wrong.Test plan
Reproduced on a real Expo app (tlon-apps, RN 0.86.3, Xcode 26.5):
pod install, then build with a damaged cache: fails, exit 65, targets vary per rungc --all --cache "compilation cache"reports only the two compilation caches, leaving the build cache, Gradle and Metro maps untouched, and reports no devices or projectsgc --cache nopereports the four caches the machine holdsgc --all --cache "compilation cache"states which state it did not inspectgc --cache ""andgc --cache " "are rejected instead of widening the run