Remove non-deterministic files from OUT_DIR to fix TreeArtifact cache misses#3973
Merged
UebelAndre merged 2 commits intobazelbuild:mainfrom Apr 22, 2026
Merged
Remove non-deterministic files from OUT_DIR to fix TreeArtifact cache misses#3973UebelAndre merged 2 commits intobazelbuild:mainfrom
UebelAndre merged 2 commits intobazelbuild:mainfrom
Conversation
UebelAndre
requested changes
Apr 16, 2026
Collaborator
UebelAndre
left a comment
There was a problem hiding this comment.
Thank! Can you add a test for this somewhere?
2bced6c to
94a2144
Compare
UebelAndre
requested changes
Apr 17, 2026
d893275 to
5ac1e80
Compare
UebelAndre
requested changes
Apr 22, 2026
5dc032c to
df32184
Compare
… misses Recursively remove files from OUT_DIR whose names appear in the `//cargo/settings:out_dir_volatile_file_basenames` string_list_flag, or have a .d or .pc extension, before Bazel captures OUT_DIR as a TreeArtifact. The flag value (default: config.log, config.log.old, config.status, Makefile, Makefile.config, config.cache, commit_hash, jemalloc-config, jemalloc.sh) is passed to the runner via the `RULES_RUST_OUT_DIR_VOLATILE_BASENAMES` env var. The runner reads the env var at runtime; if absent, no named-file removal occurs (extension-based removal of .d and .pc files is unconditional). These files embed sandbox-specific paths, timestamps, or volatile values that make the TreeArtifact hash non-deterministic, causing cache misses for all downstream rustc compilations on every action run. An integration test verifies both that legitimate outputs survive and that each category of volatile file is absent from the captured TreeArtifact.
Co-authored-by: UebelAndre <github@uebelandre.com>
df32184 to
044c39f
Compare
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.
Recursively remove files from OUT_DIR whose names appear in a known list (config.log, config.log.old, config.status, Makefile, Makefile.config, config.cache, commit_hash) or have a .d extension before Bazel captures OUT_DIR as a TreeArtifact.
These files embed sandbox-specific paths, timestamps, or volatile values that make the TreeArtifact hash non-deterministic, causing cache misses for all downstream rustc compilations on every action run.