Skip to content

iterate indexes in simpleapi_download and add tests#1

Open
cshackertwo wants to merge 1 commit intobase-simpleapi-index-iteration-r-11722390from
cshackertwo/simpleapi-index-iteration-r-11722390
Open

iterate indexes in simpleapi_download and add tests#1
cshackertwo wants to merge 1 commit intobase-simpleapi-index-iteration-r-11722390from
cshackertwo/simpleapi-index-iteration-r-11722390

Conversation

@cshackertwo
Copy link
Copy Markdown

@cshackertwo cshackertwo commented Feb 14, 2026

Note

Medium Risk
Changes network/index selection behavior for pip.parse metadata resolution, which could affect builds that rely on previous lookup ordering or failure semantics; coverage is improved via new tests.

Overview
Updates simpleapi_download to iterate indexes in order and only query additional indexes for distributions not found on earlier ones, while still downloading per-index in parallel when enabled. If later indexes are used, it now prints a suggested experimental_index_url_overrides map; failures return None and report missing packages via an injectable _fail hook.

Adds a small rules_testing suite covering multi-index lookup behavior and missing-metadata handling, and documents the behavior change in CHANGELOG.md and the experimental_extra_index_urls attribute docs.

Written by Cursor Bugbot for commit 41ac5f3. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

for i, index_url in enumerate(index_urls):
if i != 0:
# Warn the user about a potential fix for the overrides
warn_overrides = True
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Spurious print warning when all packages found on primary index

Medium Severity

warn_overrides is set to True at line 87 (before sources is computed at line 90), so it becomes True whenever extra_index_urls is non-empty — even if all packages were already found on the primary index and sources is empty. This causes the print() at line 141 to always fire as a Bazel WARNING when extra index URLs are configured, even with an empty overrides dict and no actual 404 warnings to avoid. The print (or the warn_overrides assignment) needs to be guarded by whether any packages were actually found on a non-primary index.

Additional Locations (1)

Fix in Cursor Fix in Web


failed_sources = [pkg for pkg in attr.sources if pkg not in found_on_index]
if failed_sources:
_fail("Failed to download metadata for {} for from urls: {}".format(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Grammatically incorrect "for from" in error message

Low Severity

The user-facing error message at line 127 contains "for {} for from urls" — the "for from" is a grammatical error (likely a leftover from editing). It reads as "Failed to download metadata for [...] for from urls: [...]" which is confusing. One of "for" or "from" is extraneous.

Fix in Cursor Fix in Web

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