Skip to content

fix(bootstrap): don't call get_resolver_provider hook in cache lookups#1051

Merged
mergify[bot] merged 1 commit intopython-wheel-build:mainfrom
LalatenduMohanty:fix/1049-cache-lookup-bypass-hook
Apr 14, 2026
Merged

fix(bootstrap): don't call get_resolver_provider hook in cache lookups#1051
mergify[bot] merged 1 commit intopython-wheel-build:mainfrom
LalatenduMohanty:fix/1049-cache-lookup-bypass-hook

Conversation

@LalatenduMohanty
Copy link
Copy Markdown
Member

_download_wheel_from_cache() called resolver.resolve(), which triggered custom resolver hooks. Cache servers are always simple PyPI index servers and don't need hook-based resolution. Call default_resolver_provider() directly instead.

Closes: #1049

@LalatenduMohanty LalatenduMohanty requested a review from a team as a code owner April 13, 2026 12:32
@LalatenduMohanty LalatenduMohanty marked this pull request as draft April 13, 2026 12:32
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a404ae2c-786b-4032-9290-9f74be6db241

📥 Commits

Reviewing files that changed from the base of the PR and between 9abd5dd and 986fb38.

📒 Files selected for processing (2)
  • src/fromager/bootstrapper.py
  • tests/test_bootstrapper.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/fromager/bootstrapper.py
  • tests/test_bootstrapper.py

📝 Walkthrough

Walkthrough

The _download_wheel_from_cache function was changed to avoid invoking resolver hooks. Instead of calling resolver.resolve() with a requirement spec, it constructs a pinned requirement like name==version, instantiates resolver.PyPIProvider pointed at self.cache_wheel_server_url (with include_sdists=False, include_wheels=True, and the current constraints), and calls resolver.find_all_matching_from_provider(provider, pinned_req) to obtain a wheel URL. Existing logic for parsing the wheel URL, validating build tags, downloading, and unpacking metadata is unchanged. A unit test was added to assert the resolver hook path is not invoked during cache lookups.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: bypassing the get_resolver_provider hook in cache lookups during bootstrap.
Description check ✅ Passed The description clearly explains why the change was made and references the problem it solves.
Linked Issues check ✅ Passed The PR implementation satisfies issue #1049: it prevents _download_wheel_from_cache from invoking the get_resolver_provider hook by directly instantiating PyPIProvider instead of calling resolver.resolve().
Out of Scope Changes check ✅ Passed All changes are in-scope: modifications to _download_wheel_from_cache cache lookup logic and a focused test validating the hook-bypass behavior.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mergify mergify bot added the ci label Apr 13, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/fromager/bootstrapper.py`:
- Around line 1113-1114: The code currently takes the first candidate from
resolver.find_all_matching_from_provider (results[0]) and treats it as a miss if
it fails the build-tag check; instead iterate over the results array for the
pinned_req and pick the first (wheel_url, metadata) whose
build-tag/compatibility check passes (the same logic used later around the
1124-1131 build-tag verification), only falling back to (None, None) if no
candidate matches; update both the immediate use (where results[0] is read) and
the similar block covering lines 1124-1131 to perform this filtered selection so
later valid cache entries aren’t ignored.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7e540214-986a-4d2e-9422-b35ef46423a9

📥 Commits

Reviewing files that changed from the base of the PR and between b8f4441 and 9abd5dd.

📒 Files selected for processing (2)
  • src/fromager/bootstrapper.py
  • tests/test_bootstrapper.py

@LalatenduMohanty LalatenduMohanty force-pushed the fix/1049-cache-lookup-bypass-hook branch from 9abd5dd to 7a8f95a Compare April 13, 2026 13:08
@LalatenduMohanty LalatenduMohanty marked this pull request as ready for review April 13, 2026 13:10
@tiran
Copy link
Copy Markdown
Collaborator

tiran commented Apr 14, 2026

Looks good to me.

I would appreciate a second opinion from @rd4398 or @dhellmann .

@tiran tiran requested a review from rd4398 April 14, 2026 13:31
Copy link
Copy Markdown
Contributor

@rd4398 rd4398 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good!

_download_wheel_from_cache() called resolver.resolve(), which triggered
custom resolver hooks. Cache servers are always simple PyPI index servers
and don't need hook-based resolution. Call default_resolver_provider()
directly instead.

Closes: python-wheel-build#1049
Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Apr 14, 2026

Deprecation notice: This pull request comes from a fork and was rebased using bot_account impersonation. This capability will be removed on July 1, 2026. After this date, the rebase action will no longer be able to rebase fork pull requests with this configuration. Please switch to the update action/command to ensure compatibility going forward.

@LalatenduMohanty LalatenduMohanty force-pushed the fix/1049-cache-lookup-bypass-hook branch from 7a8f95a to 986fb38 Compare April 14, 2026 14:39
@mergify mergify bot merged commit 594716a into python-wheel-build:main Apr 14, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bootstrap _download_wheel_from_cache should not call get_resolver_provider hook

3 participants