Skip to content

Conversation

@charliermarsh
Copy link
Member

Summary

Right now, when we return a Dist from a lockfile, we concatenate all hashes for all distributions for a given package. In the case of #17143, I think that means we'll return the SHA256 from the sdist, plus the SHA512 from the wheel. If the wheel was previously installed (i.e., it's in the cache), and we computed the SHA256 at that point in time, then Hashed::has_digests would return true because we have at least one SHA256. We now limit the hashes to the distribution that we expect to install.

Closes #17143.

@charliermarsh
Copy link
Member Author

Alternatively, we can get rid of has_digests and just use satisfies when we load wheels from the cache. That would also fix this issue, though the change here felt more structurally correct.

Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

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

Can you add a test for that that mixed hashes situation where there's a SHA256 here and a SHA512 there?

@charliermarsh
Copy link
Member Author

Do you have any advice on how to do that easily?

@konstin
Copy link
Member

konstin commented Dec 17, 2025

A mockserver with a find links page that links to three entries in our test/links, one entry with SHA256, one with SHA512 and one with both.

@charliermarsh charliermarsh enabled auto-merge (squash) December 17, 2025 15:52
@charliermarsh charliermarsh merged commit 6fa8204 into main Dec 17, 2025
101 checks passed
@charliermarsh charliermarsh deleted the charlie/mixed-hash branch December 17, 2025 16:02
woodruffw added a commit that referenced this pull request Dec 30, 2025
zanieb added a commit that referenced this pull request Dec 30, 2025
…id (#17265)

Fixes a regression from #17157 as
reported in #17260

Closes #17260
Closes #17263

You can see the regression test fail
[here](https://github.com/astral-sh/uv/actions/runs/20599629637/job/59162043790?pr=17269)
in #17269 which cherry-picks the commit adding tests without the fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uv.lock keeps the longest hash from the index but only uses sha256 during installation, which causes hash mismatch error

3 participants