fix: preserve relative paths in lockfile#6029
Merged
baszalmstra merged 1 commit intoprefix-dev:mainfrom May 6, 2026
Merged
Conversation
cc19584 to
41c6203
Compare
…x-dev#4680) pep508_rs::VerbatimUrl ignores its given string for both Display and Serialize, so any tool.uv.sources path entry was getting rewritten to an absolute file:// URL by the time it reached pixi.lock. Patch convert_uv_requirements_to_pep508 to copy verbatim.given() from the uv requirement onto the resulting pep508_rs::VerbatimUrl, so rattler_lock's serializer (which checks given() first) emits the original spelling. Adds a unit test demonstrating the bug and verifying the fix.
41c6203 to
8caf02c
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.
Description
pep508_rs::VerbatimUrl'sDisplayandSerializeimpls both write the parsed (normalized) URL and ignore thegivenstring. So anypep508_rs::Requirementthat goes through a string round-trip loses its verbatim spelling. The pluralconvert_uv_requirements_to_pep508did exactly that:For a
tool.uv.sourcespath entry likemy-subdir = { path = "my_subdir" }, this produced aRequirementwhoseVerbatimUrl::given()was the absolutefile://URL of the resolved path.rattler_lock's serializer (requirement_to_string) prefersgiven(), so the absolute path ended up baked intopixi.lock, breaking sharing across machines.The sibling
to_requirements(singular, foruv_distribution_types::Requirement) already handled this by carryingverbatim.given()over onto a freshpep508_rs::VerbatimUrl::with_given(...). This PR applies the same treatment to the plural function.Before:
After:
Fixes #4680
How Has This Been Tested?
relative_path_requirement_round_trip_keeps_giveninpixi_uv_conversions::conversionsbuilds a uvRequirement<VerbatimParsedUrl>formy-subdir @ ./my_subdir, runs it throughconvert_uv_requirements_to_pep508, and asserts the resultingVerbatimUrl::given()isSome("./my_subdir"). The test fails onmainand passes after the fix.pixi_uv_conversionslib (14 tests) andpixi_corelib (225 tests) suites pass.pixi.lock, ran the patched binary, and confirmed the regenerated lockfile containsmy-subdir @ my_subdirrather than the absolutefile:///...URL.AI Disclosure
Tools: Claude Code (Opus 4.7)
Checklist: