Skip to content

Pass index_urls when updating uncompiled requirement files - #16961

Open
koenvincent wants to merge 2 commits into
dependabot:mainfrom
koenvincent:uncompiled-files-index-urls
Open

koenvincent wants to merge 2 commits into
dependabot:mainfrom
koenvincent:uncompiled-files-index-urls

Conversation

@koenvincent

Copy link
Copy Markdown

Fixes the first half of #16960.

What are you trying to accomplish?

update_uncompiled_files in both compile file updaters builds a RequirementFileUpdater with credentials: but without index_urls:. Hashes for an updated hashed requirements file are then fetched from hashin's default index, pypi.org, even when a python-index registry with replaces-base: true is configured. On a runner that cannot reach pypi.org, every such update fails with HelperSubprocessFailed in get_dependency_hash.

How will you know you've accomplished your goal?

The hash helper receives the configured registry URLs, as it already does from the other RequirementReplacer call sites in the same updaters.

Notes

  • Two one-line changes: uv/.../compile_file_updater.rb and python/.../pip_compile_file_updater.rb. Both call sites resolve to Dependabot::Python::FileUpdater::RequirementFileUpdater, whose initializer already accepts index_urls:.
  • For a registry served under a path, hashin also drops the path when it builds the JSON URL. That is fixed separately in get_package_data: keep the index URL's path peterbe/hashin#255. Until then, these jobs fail with "Unable to find hashes" instead of a pypi.org connection error.
  • I have not added a spec. I'm glad to add one if you point me at the preferred fixture for a hashed uncompiled requirements file.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass. (Not run locally; relying on CI.)
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

update_uncompiled_files built a RequirementFileUpdater with credentials but
without index_urls. RequirementReplacer#package_hashes_for then used [nil],
and the hash helper fell back to hashin's default index, pypi.org, even when
a python-index registry with replaces-base: true was configured. On a runner
that cannot reach pypi.org every update of a hashed requirements file failed
with HelperSubprocessFailed in get_dependency_hash.

The same omission was in the uv and the python compile file updaters.
@koenvincent
koenvincent requested a review from a team as a code owner November 17, 2026 14:25
Copilot AI balanced review requested due to automatic review settings November 17, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Regression coverage is missing for private-only index URL forwarding in both compile updater call sites, leaving default-index fallback and returned-hash persistence unverified.

1 open issue
What changed in this PR

This PR addresses the index-forwarding portion of #16960 so hash lookups for uncompiled requirements use configured registries rather than defaulting to pypi.org.

Changes:

  • Passes index_urls to RequirementFileUpdater in both uv and pip-compile.
  • Leaves hashin’s separate registry-path handling issue outside this PR.
File Description
uv/​lib/​dependabot/​uv/​file_updater/​compile_file_updater.rb Forwards configured indexes when updating uncompiled requirements.
python/​lib/​dependabot/​python/​file_updater/​pip_compile_file_updater.rb Adds the same index forwarding for pip-compile.

Review effort: Balanced

dependency_files: files,
credentials: credentials
credentials: credentials,
index_urls: @index_urls
@v-thavaahariharangit

Copy link
Copy Markdown
Contributor

@koenvincent please add some regression test to cover this changes

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants