feat(resolver): enforce PyPI quarantine check for all resolver types#1102
feat(resolver): enforce PyPI quarantine check for all resolver types#1102pavank63 wants to merge 1 commit intopython-wheel-build:mainfrom
Conversation
The PEP 792 quarantine check previously only ran inside get_project_from_pypi(), which is only called by PyPIProvider. Packages resolved via GitHubTagProvider, GitLabTagProvider, or PyPIProvider with a custom index URL bypassed the check entirely. Add a standalone check_pypi_quarantine_status() function that queries pypi.org for quarantine status and call it unconditionally from both resolve() and resolve_source() entry points. Remove the quarantine check from get_project_from_pypi() to avoid split responsibility. Signed-off-by: Pavan Kalyan Reddy Cherupally <pcherupa@redhat.com> Co-Authored-By: Claude <claude@anthropic.com>
📝 WalkthroughWalkthroughThe changes extract PyPI quarantine status checking (PEP 792) into a standalone Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/fromager/resolver.py (1)
377-397: 💤 Low value
QUARANTINEDfalls through to catch-all, logging misleading "unknown status" warning.If
get_project_from_pypiqueries PyPI directly (not via entry points) or if a custom index mirrors PyPI's quarantine status,QUARANTINEDhitscase _:and logs as "unknown status." Add explicit handling:♻️ Suggested fix
case pypi_simple.ProjectStatus.DEPRECATED | pypi_simple.ProjectStatus.ARCHIVED: logger.warning( "project %r is no longer active: %r: %s", project, package.status, package.status_reason, ) + case pypi_simple.ProjectStatus.QUARANTINED: + # Quarantine is enforced at resolution entry points (resolve/resolve_source). + # If we reach here, the check either passed or was bypassed. + logger.debug( + "project %r has quarantine status in index response (checked at entry point)", + project, + ) case _: logger.warning(🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fromager/resolver.py` around lines 377 - 397, The match on package.status in get_project_from_pypi currently falls through QUARANTINED to the catch-all and logs "unknown status"; add an explicit case for pypi_simple.ProjectStatus.QUARANTINED in the match block (near the existing cases for ACTIVE, DEPRECATED, ARCHIVED) and log a clear warning (e.g., "project %r is quarantined: %s") using project and package.status_reason so quarantined packages are not misreported as unknown; keep check_pypi_quarantine_status semantics unchanged at the resolution entry points.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/fromager/resolver.py`:
- Around line 377-397: The match on package.status in get_project_from_pypi
currently falls through QUARANTINED to the catch-all and logs "unknown status";
add an explicit case for pypi_simple.ProjectStatus.QUARANTINED in the match
block (near the existing cases for ACTIVE, DEPRECATED, ARCHIVED) and log a clear
warning (e.g., "project %r is quarantined: %s") using project and
package.status_reason so quarantined packages are not misreported as unknown;
keep check_pypi_quarantine_status semantics unchanged at the resolution entry
points.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 72cf8f67-18ca-4c6c-8848-8044e83d0c4d
📒 Files selected for processing (3)
src/fromager/resolver.pysrc/fromager/sources.pytests/test_resolver.py
The PEP 792 quarantine check previously only ran inside get_project_from_pypi(), which is only called by PyPIProvider. Packages resolved via GitHubTagProvider, GitLabTagProvider, or PyPIProvider with a custom index URL bypassed the check entirely.
Add a standalone check_pypi_quarantine_status() function that queries pypi.org for quarantine status and call it unconditionally from both resolve() and resolve_source() entry points. Remove the quarantine check from get_project_from_pypi() to avoid split responsibility.
Closes: #1101