← Back to Pull requests

Coordinate and validate cached Python downloads #2772

Open
zaniebot opened this pull request with 367 lines diff across 2 files
View on GitHub
zaniebot zaniebot commented on Oct 15, 2026 18:29 UTC
Author

Concurrent installations that share an empty Python archive cache can download the same archive independently, and completed responses enter the cache before any available checksum is checked. Lock individual cache misses and recheck the entry, verify available checksums before publishing downloads, and retain an open reader through extraction.

Related to astral-sh/uv-dev#2198.

Diff: 367 lines (+320 / -47) across 2 files Reviewer: zanieb Review duration: 4122m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.40) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 367 lines diff across 2 files
0.40
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 2 substantive comment(s)
0.89
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
89%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.353
Real PR Conversation Timeline
3 items
codspeed[bot] codspeed[bot] commented on Oct 15, 2026 19:17 UTC
Bot

<!-- __CODSPEED_PERFORMANCE_REPORT_COMMENT__ -->

Merging this PR will not alter performance

<details>
<summary>:warning: <b>8 benchmarks spent significant time in system calls</b></summary>

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

> Measurement and system calls

> - ` discover_workspace_from_all_members

- install_wheel_many_files

- discover_workspace_from_all_members_with_excludes

- unpack_sdist_many_files

- run_python_version_synthetic_workspace

- resolve_warm_jupyter_universal

- resolve_warm_airflow

- resolve_warm_jupyter

</details>

✅ 69 untouched benchmarks
⏩ 35` skipped benchmarks[^skipped]

---

<sub>Comparing <code>zb/fix-managed-python-archive-cache</code> (f9ac43a) with <code>main</code> (c8e4086)</sub>

<a href="https://app.codspeed.io/astral-sh/uv-dev/branches/zb%2Ffix-managed-python-archive-cache?utm_source=github&utm_medium=comment-v2&utm_content=button">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://codspeed.io/pr-report/open-in-codspeed-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="https://codspeed.io/pr-report/open-in-codspeed-light.svg">
<img alt="Open in CodSpeed" src="https://codspeed.io/pr-report/open-in-codspeed-light.svg" width="169" height="32">
</picture>
</a>

[^skipped]: 35 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

zanieb zanieb commented on code on Oct 15, 2026 21:30 UTC
Code Review
crates/uv-python-managed/src/downloads.rs:1
@@ -535,62 +537,94 @@ impl ManagedPythonDownload {
                 }
                 None => "none",
             };
-            let target_cache_file = python_builds_dir.join(format!("{hash_prefix}-{filename}"));
+            let cache_filename = format!("{hash_prefix}-{filename}");
+            let target_cache_file = python_builds_dir.join(&cache_filename);
+            // Aliases of the cache directory must use the same lock. Hash only the filename to
+            // keep the lock path short without depending on the spelling of the directory.

This is a little confusing

Reviewers
Assignees
zaniebot zaniebot
Labels
risk: low confidence: 89.1% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.8% (MEDIUM) · Higher = larger blast radius
39.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 89.1% · Lower = rushed or shallow review
89.1%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 4.3% · Safe to merge
4.3%