[3/9] feat: strip basedirs from Rust hash key for cross-machine cache hits#10
Open
mmastrac wants to merge 1 commit intovercel/crate-type-allow-hashfrom
Open
[3/9] feat: strip basedirs from Rust hash key for cross-machine cache hits#10mmastrac wants to merge 1 commit intovercel/crate-type-allow-hashfrom
mmastrac wants to merge 1 commit intovercel/crate-type-allow-hashfrom
Conversation
3f6f57a to
b1f2c15
Compare
sylvestre
reviewed
Apr 14, 2026
sylvestre
reviewed
Apr 14, 2026
|
it also needs an integration / high level test, thanks |
Collaborator
Author
|
@sylvestre I hadn't considered this one ready to land yet but I can definitely turn this into a proper patch (it's currently a very sloppy AI patch as-is, just good enough for what we needed). |
b1f2c15 to
3031523
Compare
a1ea5d5 to
9c26759
Compare
3031523 to
9bd1db6
Compare
9c26759 to
6026566
Compare
9bd1db6 to
2049b88
Compare
6026566 to
0ba527a
Compare
36ef3bf to
97e9f34
Compare
Collaborator
Author
|
@sylvestre I've upstreamed this as mozilla#2678 with your suggestions and a lot of cleanup |
SCCACHE_BASEDIRS now normalizes cwd, CARGO_MANIFEST_DIR, CARGO_WORKSPACE_DIR, CARGO_TARGET_TMPDIR, CARGO_MANIFEST_PATH, CARGO_BIN_EXE_*, dep-info env var values, and the concatenated argument string in the Rust compiler's hash key computation. This enables cache hits when the same crate is compiled from different absolute paths on different machines (e.g., CI runners with different checkout roots). strip_basedir_prefix now also matches when the value equals the basedir minus its trailing '/', so `cwd == basedir` strips to the empty string rather than passing through. Without this, two machines with different checkout paths produced different hashes even with matching basedirs -- the feature's central claim.
97e9f34 to
8c030d5
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.
Summary
SCCACHE_BASEDIRSsupport to the Rust compiler hash key, matching the existing C compiler behaviorcwd,CARGO_MANIFEST_DIR,CARGO_MANIFEST_PATH,CARGO_WORKSPACE_DIR,CARGO_TARGET_TMPDIR,CARGO_BIN_EXE_*, dep-info env var values, and the concatenated argument string (catches--remap-path-prefix,-Clinker=, etc.)Test plan
test_basedirs_strips_cwd_and_cargo_manifest_dir— verifies basedirs changes the hashtest_basedirs_deterministic— verifies same basedir produces same hashtest_generate_hash_key— existing test updated for new hash formatcargo clippyclean🤖 Generated with Claude Code