iterate indexes in simpleapi_download and add tests#1
Conversation
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
|
|
||
| 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( |
There was a problem hiding this comment.
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.


Note
Medium Risk
Changes network/index selection behavior for
pip.parsemetadata resolution, which could affect builds that rely on previous lookup ordering or failure semantics; coverage is improved via new tests.Overview
Updates
simpleapi_downloadto 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 suggestedexperimental_index_url_overridesmap; failures returnNoneand report missing packages via an injectable_failhook.Adds a small
rules_testingsuite covering multi-index lookup behavior and missing-metadata handling, and documents the behavior change inCHANGELOG.mdand theexperimental_extra_index_urlsattribute docs.Written by Cursor Bugbot for commit 41ac5f3. This will update automatically on new commits. Configure here.