Skip to content

fix: normalize package URLs in check_uv_lock_public_urls --fix - #1675

Merged
sd-db merged 3 commits into
databricks:mainfrom
moomindani:fix/uv-lock-fix-normalizes-package-urls
Sep 10, 2026
Merged

fix: normalize package URLs in check_uv_lock_public_urls --fix#1675
sd-db merged 3 commits into
databricks:mainfrom
moomindani:fix/uv-lock-fix-normalizes-package-urls

Conversation

@moomindani

Copy link
Copy Markdown
Contributor

Description

scripts/check_uv_lock_public_urls.py --fix normalizes the source = { registry = ... } entries but not the artifact url entries, and the check it runs immediately afterwards requires both. On a lock produced against a mirrored index that means --fix rewrites 114 registries, leaves 1512 package URLs, and then reports failure — so the URLs have to be substituted by hand before the pre-commit hook will pass.

This came up while raising four dependency bounds (#1670, #1671, #1672, #1673): every one of them needed the same manual substitution after uv lock.

--fix now rewrites the host of URLs shaped like the public artifact tree. Only the host changes: the /packages/ path identifies the artifact and the hash recorded beside it is what guarantees integrity, so the rewrite cannot silently point at different content. A URL without a /packages/ path is not a mirror of that tree, so rewriting its host would be a guess — those are left for the check to report.

The --fix summary line now reports both counts, so fix_uv_lock returns a (registry_count, url_count) pair.

Testing

New tests/unit/test_check_uv_lock_public_urls.py (6 tests) covers the check on a public and a mirrored lock, the fix on both, path and hash preservation, and the non-mirror URL left alone. Three of them fail against the current script.

End to end on this repo: regenerating uv.lock against a mirrored index and running --fix alone now produces a file byte-identical to the committed uv.lock, and uv lock --check agrees.

Unit suite 1349 passed, 4 skipped; code-quality clean.

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.
  • [Optional] I have run the dbt-databricks-pr-ready project skill for this PR and addressed its merge-readiness feedback

`--fix` rewrote the 114 source registries but left the 1512 artifact URLs
pointing at whichever index produced the lock, so on a mirrored index the
check it runs immediately afterwards still failed and the URLs had to be
substituted by hand.

Only the host is rewritten, and only for URLs shaped like the public
artifact tree: the /packages/ path identifies the artifact and the hash
recorded beside it is what guarantees integrity. A URL without that path
is left for the check to report rather than rewritten on a guess.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions

Copy link
Copy Markdown

Coverage report

This PR does not seem to contain any modification to coverable code.

@sd-db sd-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Changes look good, thx !! Will look to merge post some more internal testing.

@sd-db
sd-db merged commit 06f235f into databricks:main Sep 10, 2026
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.

2 participants