Skip to content

fix: expand extras self-refs, drop PEP 517 fallback#5992

Open
baszalmstra wants to merge 3 commits intoprefix-dev:mainfrom
baszalmstra:claude/fix-workspace-variants-test-utTkw
Open

fix: expand extras self-refs, drop PEP 517 fallback#5992
baszalmstra wants to merge 3 commits intoprefix-dev:mainfrom
baszalmstra:claude/fix-workspace-variants-test-utTkw

Conversation

@baszalmstra
Copy link
Copy Markdown
Contributor

@baszalmstra baszalmstra commented May 1, 2026

After the lockfile-v7 refactor (#5607) pixi install --locked started reporting false drift on a couple of common shapes. This PR fixes the satisfiability check end-to-end and adapts one stale test path along the way.

Changes

test_workspace_variants_separate_work_directories: work directories moved from .pixi/build/work/<pkg>--<hash>/ to .pixi/bld/<pkg>/<workspace_key>/ in the lockfile-v7 refactor. Test now looks in the new location.

Expand pkg[group] self-references in static requires_dist: UV's static database.requires_dist keeps pkg[group] self-references from [project.optional-dependencies] as-is, while build backends like hatchling write the expanded contents into the wheel METADATA at lock time. The two views compare as different, so satisfiability falsely reports the lock-file as out-of-date for any project that composes its extras (e.g. Deltares/Ribasim's all = ["pkg[a]", "pkg[b]"]).

We now run the same expansion ourselves: each pkg[a, b]; <outer marker> is replaced by the raw entries of groups a and b carrying the outer marker. Cycles in the optional-deps graph (e.g. a → b → a) are broken on the path that closes them.

Also dedups the requires-dist diff message and includes extras, so added: [pkg, pkg, pkg] becomes added: [pkg[a], pkg[b]].

Skip PEP 517 build during the satisfiability check: read_local_package_metadata previously fell back to get_or_build_wheel_metadata when uv's static requires_dist declined. That fallback needs the host conda prefix to have Python, but cross-platform satisfiability runs on platforms that may not be in the lock at all. The resulting PythonMissingError panicked through LazyBuildDispatch::interpreter past this path's missing catch_unwind, aborting pixi run / pixi reinstall on hosts whose platform was missing from the lock (e.g. macOS arm64 against a linux-64-only lock).

The function is now restricted to uv's static path. Ok(Some) feeds drift detection (then runs through the self-extras expansion); Ok(None) (uv's "static doesn't apply" classification) trusts the lock; Err surfaces as PlatformUnsat::FailedToReadLocalMetadata to force a re-solve.

Verified for uv 0.9.5 that database.requires_dist itself does not invoke the interpreter.

Verification

  • All 131 satisfiability unit tests pass; new unit tests cover the Ribasim-shape expansion, non-self-references, unknown extras, and the cycle-break case (inline insta snapshots).
  • Built target/release/pixi from the branch, ran pixi install --locked against Deltares/Ribasim@main (v6 lockfile): exit 0, install completes, no lock-file not up-to-date and no metadata for local package 'ribasim' has changed in the trace. Static-only path is exercised for ribasim, ribasim-api, and ribasim-testmodels per the debug log.

@baszalmstra baszalmstra added the test:extra_slow Run the extra slow tests label May 1, 2026
claude added 2 commits May 1, 2026 18:12
The lockfile-v7 refactor moved per-package backend workspaces from
`.pixi/build/work/` to `.pixi/bld/<package>/<workspace_key>/`.

https://claude.ai/code/session_018Wo78WYzQZBRWQQ3zNSsE4
UV's static `database.requires_dist` keeps `pkg[group]` self-references
from `[project.optional-dependencies]` as-is, while build backends like
hatchling write the expanded contents into the wheel METADATA at lock
time. The two views compare as different, so the satisfiability check
falsely reports the lock-file as out-of-date for projects that compose
their extras (e.g. Deltares/Ribasim's `all = ["pkg[a]", "pkg[b]"]`).

Run the same expansion ourselves on the static-parse output: each
`pkg[a, b]; <outer marker>` is replaced by the raw entries of groups
`a` and `b` carrying the outer marker. Cycles in the optional-deps
graph are broken on the path that closes them.

Also dedup the requires_dist diff display and include extras so the
"added: [pkg, pkg, pkg]" output becomes "added: [pkg[a], pkg[b]]".

https://claude.ai/code/session_018Wo78WYzQZBRWQQ3zNSsE4
@baszalmstra baszalmstra force-pushed the claude/fix-workspace-variants-test-utTkw branch 2 times, most recently from a60f984 to 91d9d6c Compare May 1, 2026 19:01
The lockfile-v7 refactor (prefix-dev#5607) introduced `read_local_package_metadata`
which fell back to `get_or_build_wheel_metadata` when uv's static
`requires_dist` declined. That fallback needs the host conda prefix to
have Python, but cross-platform satisfiability runs on platforms that
may not be in the lock at all. The resulting `PythonMissingError`
panicked out through `LazyBuildDispatch::interpreter` past this path's
missing `catch_unwind`, aborting `pixi run` / `pixi reinstall` on
hosts whose platform was missing from the lock (e.g. macOS arm64
against a linux-64-only lock).

Restrict the function to uv's static path. `Ok(Some)` feeds drift
detection; `Ok(None)` (uv's "static doesn't apply" classification)
trusts the lock; `Err` surfaces as
`PlatformUnsat::FailedToReadLocalMetadata` to force a re-solve.

Verified for uv 0.9.5 that `database.requires_dist` itself does not
invoke the interpreter.

Co-authored-by: Bas Zalmstra <4995967+baszalmstra@users.noreply.github.com>

https://claude.ai/code/session_018Wo78WYzQZBRWQQ3zNSsE4
@baszalmstra baszalmstra force-pushed the claude/fix-workspace-variants-test-utTkw branch from 91d9d6c to 9dd1b71 Compare May 1, 2026 19:05
@baszalmstra
Copy link
Copy Markdown
Contributor Author

@nichmor The last two commits in this PR touch some of the code you wrote. Would you be able to take a look whether the changes make sense to you?

@baszalmstra baszalmstra changed the title test: update workspace variants test to new bld/ layout fix: expand extras self-refs, drop PEP 517 fallback May 1, 2026
@baszalmstra baszalmstra requested a review from nichmor May 1, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:extra_slow Run the extra slow tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants