Skip to content

fix(py_venv): keep one fallback metadata owner#1215

Open
tamird wants to merge 1 commit into
aspect-build:mainfrom
tamird:fix-metadata-fallback-v1
Open

fix(py_venv): keep one fallback metadata owner#1215
tamird wants to merge 1 commit into
aspect-build:mainfrom
tamird:fix-metadata-fallback-v1

Conversation

@tamird

@tamird tamird commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

A native-root collision can leave one wheel on whole-wheel fallback
while another claimant owns the direct package projection. When both
wheels publish the same dist-info entry, the metadata collision path
rejected the venv even though only one fallback copy remains visible.

Apply the metadata collision policy first. Keep the normal projected
winner when no claimant needs fallback. Let a sole fallback copy own
metadata discovery without another projection. Retain the hard failure
when multiple fallback copies cannot be suppressed.

This preserves one importlib.metadata result for a permissive
duplicate-lock case while keeping error policy and the ambiguous case
explicit.

A native-root collision can leave one wheel on whole-wheel fallback
while another claimant owns the direct package projection. When both
wheels publish the same dist-info entry, the metadata collision path
rejected the venv even though only one fallback copy remains visible.

Apply the metadata collision policy first. Keep the normal projected
winner when no claimant needs fallback. Let a sole fallback copy own
metadata discovery without another projection. Retain the hard failure
when multiple fallback copies cannot be suppressed.

This preserves one importlib.metadata result for a permissive
duplicate-lock case while keeping error policy and the ambiguous case
explicit.

tamird commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Extracted from #1205. Downstream exact-head CI found two
pydantic_core-2.41.5.dist-info trees from the Stripe and default lock
universes after a native-root collision left one claimant on whole-wheel
fallback. The focused follow-up keeps exactly one visible metadata owner
instead of making that #1205/#1191 interaction fail analysis.

@github-actions

Copy link
Copy Markdown

py_binary startup benchmark

Version Mean (ms) Median (ms) ± stddev vs BCR vs main Build (s)
BCR 1.11.7 (baseline) 181.830 180.831 ±4.799 76.16
HEAD main 59.004 58.752 ±1.878 -67.5% 10.40
This PR 57.918 57.855 ±0.676 -68.1% -1.8% 7.57

Measured with hyperfine --warmup 5 --runs 50 on Linux
Gate: PR vs HEAD main (threshold: 10%). BCR is shown only as a historical baseline.
Build time: cold bazel build //:bench with isolated output base, no disk cache.

sys.path quality

Version sys.path entries distinct site-packages roots duplicate realpaths
BCR 1.11.7 (baseline) 6 1 0
HEAD main 7 2 0
This PR 7 2 0

sys.path quality measured by bench_syspath inside the assembled venv. Duplicate realpaths indicate symlink redundancy; many distinct site-packages roots suggest an inefficient venv layout.

✅ No regression detected (PR is -1.8% vs HEAD main)

tamird commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

@jbedard This is the focused #1205/#1191 interaction from
downstream exact-head CI. Two same-version pydantic_core wheels from
Stripe and default lock universes leave one fallback metadata copy
visible after a native-root collision. The regression covers no
fallback, one fallback, multiple fallback, and package_collisions =
error. The full matrix is green at e595304. Ready for independent
review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant