fix: cache file path corruption when package name contains dots#5668
Merged
baszalmstra merged 1 commit intoprefix-dev:mainfrom Mar 16, 2026
Merged
Conversation
`PathBuf::with_extension("json")` replaces everything after the last
dot in the file name. When a package name contains a dot (e.g.,
"my.package"), the cache hash key becomes something like
"source-dir/my.package-osx-arm64-HASH", and `with_extension` truncates
it to "source-dir/my.json", discarding the platform and hash.
This causes all platforms to write to the same cache file, producing
spurious "Cache was updated by another process" warnings.
Fix by using string concatenation (`format!("{}.json", ...)`) instead
of `with_extension` to append the `.json` suffix.
Closes prefix-dev#5626
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 13, 2026
pavelzw
approved these changes
Mar 16, 2026
baszalmstra
approved these changes
Mar 16, 2026
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.
Description
PathBuf::with_extension("json")inMetadataCache::cache_file_pathreplaces everything after the last dot in the file name. When a package name contains a dot (e.g.,my.package), the source metadata cache hash key becomes something likesource-dir/my.package-osx-arm64-HASH, andwith_extension("json")truncates it tosource-dir/my.json— discarding the platform and hash entirely.This causes requests for different platforms (e.g.,
osx-arm64andlinux-64) to read/write the same cache file, producing spurious "Cache was updated by another process" warnings due to version conflicts.The fix uses string concatenation (
format!("{}.json", ...)) instead ofwith_extensionto append the.jsonsuffix, preserving the full file name.Fixes #5626
How Has This Been Tested?
test_cache_file_path_with_dots_in_key) that verifies cache file paths are correctly generated both with and without dots in the hash key.cargo test -p pixi_command_dispatcher— 21 passed).AI Disclosure
Tools: Claude Code (Claude Opus 4.6)
Checklist: