-
Notifications
You must be signed in to change notification settings - Fork 53
Fix: Multi version bootstrap age filter fallback for edge cases #1289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mergify
merged 2 commits into
python-wheel-build:main
from
rd4398:fix/multi-version-age-filter-fallback
Aug 7, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| #!/bin/bash | ||
| # -*- indent-tabs-mode: nil; tab-width: 2; sh-indentation: 2; -*- | ||
|
|
||
| # Test that constrained (pinned) packages bypass max-release-age filtering. | ||
| # A package pinned in constraints should always be built regardless of its age, | ||
| # because a constraint pin is explicit user intent that takes precedence over | ||
| # the age filter heuristic. | ||
|
|
||
| SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
| source "$SCRIPTDIR/common.sh" | ||
|
|
||
| # tomli 2.0.0 was uploaded to PyPI on 2021-12-13. | ||
| # We set --max-release-age to a value that EXCLUDES tomli 2.0.0 | ||
| # but INCLUDES tomli 2.0.1 (2022-01-02) and 2.0.2 (2025-05-05). | ||
| # Then we pin tomli==2.0.0 in constraints — it must still be built. | ||
| MAX_AGE=$(python3 -c " | ||
| from datetime import date | ||
| # Age of tomli 2.0.1 (uploaded 2022-01-02) + 10 day buffer | ||
| # This ensures 2.0.1 is inside the window but 2.0.0 is outside | ||
| age = (date.today() - date(2022, 1, 2)).days + 10 | ||
| print(age) | ||
| ") | ||
|
|
||
| echo "Using --max-release-age=$MAX_AGE" | ||
|
|
||
| # Create constraints file pinning tomli to the OLD version | ||
| constraints_file=$(mktemp) | ||
| trap 'rm -f "$constraints_file"; on_exit' EXIT | ||
| cat > "$constraints_file" <<EOF | ||
| tomli==2.0.0 | ||
| EOF | ||
|
|
||
| fromager \ | ||
| --log-file="$OUTDIR/bootstrap.log" \ | ||
| --error-log-file="$OUTDIR/fromager-errors.log" \ | ||
| --sdists-repo="$OUTDIR/sdists-repo" \ | ||
| --wheels-repo="$OUTDIR/wheels-repo" \ | ||
| --work-dir="$OUTDIR/work-dir" \ | ||
| --constraints-file="$constraints_file" \ | ||
| bootstrap \ | ||
| --multiple-versions \ | ||
| --max-release-age="$MAX_AGE" \ | ||
| 'tomli>=2.0,<=2.0.2' | ||
|
|
||
| # Verify that the pinned old version was built despite being outside the age window | ||
| echo "" | ||
| echo "Checking that constrained (pinned) version was built..." | ||
| if find "$OUTDIR/wheels-repo/downloads/" -name "tomli-2.0.0-*.whl" | grep -q .; then | ||
| echo "✓ Found wheel for tomli 2.0.0 (constrained — bypassed age filter)" | ||
| else | ||
| echo "✗ Missing wheel for tomli 2.0.0" | ||
| echo "ERROR: tomli 2.0.0 is pinned in constraints and should bypass age filtering" | ||
| echo "" | ||
| echo "Found wheels:" | ||
| find "$OUTDIR/wheels-repo/downloads/" -name 'tomli-*.whl' | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Verify the log confirms the constraint bypass | ||
| echo "" | ||
| echo "Checking log for constraint bypass..." | ||
| if grep -q "skipping age filter for pinned constraint" "$OUTDIR/bootstrap.log"; then | ||
| echo "✓ Log confirms age filter was bypassed for pinned constraint" | ||
| else | ||
| echo "✗ No constraint bypass message found in log" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "SUCCESS: Constrained package correctly bypassed age filtering" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #!/bin/bash | ||
| # -*- indent-tabs-mode: nil; tab-width: 2; sh-indentation: 2; -*- | ||
|
|
||
| # Test that multi-version bootstrap with --max-release-age falls back to | ||
| # building only the newest version when ALL versions are outside the age window. | ||
| # Without this fallback, the bootstrap would fail entirely. | ||
|
|
||
| SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
| source "$SCRIPTDIR/common.sh" | ||
|
|
||
| # Use --max-release-age=1 so ALL tomli versions are outside the window. | ||
| # The newest matching version should still be built via the NEWEST fallback. | ||
| fromager \ | ||
| --log-file="$OUTDIR/bootstrap.log" \ | ||
| --error-log-file="$OUTDIR/fromager-errors.log" \ | ||
| --sdists-repo="$OUTDIR/sdists-repo" \ | ||
| --wheels-repo="$OUTDIR/wheels-repo" \ | ||
| --work-dir="$OUTDIR/work-dir" \ | ||
| bootstrap \ | ||
| --multiple-versions \ | ||
| --max-release-age=1 \ | ||
| 'tomli>=2.0,<=2.0.2' | ||
|
|
||
| # Count how many tomli wheels were built | ||
| TOMLI_COUNT=$(find "$OUTDIR/wheels-repo/downloads/" -name "tomli-*.whl" | wc -l) | ||
| echo "Found $TOMLI_COUNT tomli wheel(s)" | ||
|
|
||
| # Exactly one version should be built (the newest fallback) | ||
| if [ "$TOMLI_COUNT" -eq 1 ]; then | ||
| echo "✓ Exactly one tomli version was built (newest fallback)" | ||
| else | ||
| echo "✗ Expected exactly 1 tomli version, found $TOMLI_COUNT" | ||
| echo "The NEWEST fallback should build only the single newest version" | ||
| echo "" | ||
| echo "Found wheels:" | ||
| find "$OUTDIR/wheels-repo/downloads/" -name 'tomli-*.whl' | ||
| exit 1 | ||
| fi | ||
|
|
||
| # The newest matching version (2.0.2) should be the one built | ||
| if find "$OUTDIR/wheels-repo/downloads/" -name "tomli-2.0.2-*.whl" | grep -q .; then | ||
| echo "✓ Found wheel for tomli 2.0.2 (newest matching version)" | ||
| else | ||
| echo "✗ Missing wheel for tomli 2.0.2 — expected the newest version" | ||
| echo "" | ||
| echo "Found wheels:" | ||
| find "$OUTDIR/wheels-repo/downloads/" -name 'tomli-*.whl' | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Verify the log confirms the fallback was triggered | ||
| echo "" | ||
| echo "Checking log for newest fallback..." | ||
| if grep -q "falling back to newest version" "$OUTDIR/bootstrap.log"; then | ||
| echo "✓ Log confirms newest version fallback was triggered" | ||
| else | ||
| echo "✗ No newest-version fallback message found in log" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "SUCCESS: Multi-version age fallback correctly built only the newest version" |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.