Support checksummed local registries for git sources#17228
Support checksummed local registries for git sources#17228snoopuppy582 wants to merge 2 commits into
Conversation
|
The issues you linked have a lot of technical discussion about the implications of different ways of doing the change and what their impacts. In order for a new PR to be accepted we would need a detailed summary of previous objections and technical concerns, with a description of how this PR addresses each one. |
This comment has been minimized.
This comment has been minimized.
58fdf1a to
c020f03
Compare
|
Thanks for pointing this out! I've updated the PR description to include a breakdown of the concerns raised in #10939, #11188, and #10071. To give a quick overview, here are the main differences between this PR and #11188:
Just to clarify, normal checksummed sources still retain their lockfile checksums and mismatch enforcement, so this doesn't introduce a general mutable-registry mode. I've also rebased onto the latest Let me know if there are any other previous concerns I should mention in the description, and I'd be happy to add them! |
This comment has been minimized.
This comment has been minimized.
c020f03 to
f779256
Compare
What does this PR try to resolve?
Addresses #10939 and follows up on #11188.
A git source can be replaced by a local registry, but
Cargo.lockmust continue to describe the original git source. Persisting the replacement checksum in the lockfile breaks the lockfile when source replacement is disabled. A same-version git revision update must also invalidate the extracted replacement source and its compiled artifact.This change keeps those responsibilities aligned:
.cargo-okand refreshes the source when that checksum changes;This is paired with dhovart/cargo-local-registry#289, which writes the SHA-256 of each generated git archive to the local-registry index.
Prior concerns and how this PR addresses them
The earlier discussion raised concerns beyond the initial checksum error:
cargo-local-registrychange generates a SHA-256 for every git archive, and Cargo verifies that checksum before using or unpacking the archive.ReplacedSourceexposes the original source's checksum capability. It omits the replacement checksum from the mapped summary only when the original source does not support checksums, while retaining the replacement checksum for archive verification. Checksummed original sources keep their existing behavior..cargo-okmetadata records the checksum that was verified before extraction. A changed checksum clears and re-extracts that source directory instead of accepting the existing directory by name and version alone.How to test and review this PR?
The two new regressions cover both lockfile portability and same-version git updates:
git_dependency_can_be_replaced_with_checksummed_local_registryupdated_git_dependency_refreshes_local_registry_source_cacheThe main review points are that the lockfile retains the original source semantics, local archives remain checksum-verified, and ordinary registry replacements keep their existing behavior.
Validated with:
cargo test --test testsuite local_registry::(12 passed on currentmaster)cargo test -p cargo --lib(189 passed on currentmaster)cargo fmt --all --checkcargo clippy --workspace --all-targets --no-deps --keep-goingcargo-local-registrychange