Repository navigation
Withhold Cargo pins a member's other source or other patch bypasses - #2024
Draft
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Draft
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Conversation
Two gaps left after the mixed-member-pin fix: Vendored twin from another source. `vendor` wires a crate through the root's `[patch.crates-io]`, which cargo applies only to crates.io declarations. A workspace member (or the root) that declares the crate from another registry or from git, at a requirement the patched version satisfies, resolves its own unpatched copy, and the vendored ref stayed attested beside it because the copy claim only reads sourceless lock entries. The ref now stays (rollback, remove and the ledgers still see the wiring) but is marked unattested with the new `UnattestedKind::CargoPatchBypassed`, naming the declaration. A same-version Cargo.lock entry from any registry or git source beside the copy is marked the same way, naming the lock entry. A declaration whose source a `[patch.<source>]` table pointing at the same copy names (e.g. `[patch.my-corp]`) is covered, and a path declaration (the user's own fork) keeps the existing "ignored" rule. The CLI omits the ref as `vex_cargo_patch_bypassed`; documented in CLI_CONTRACT.md. Split patches. When the root pins a crate to Socket patch A and a member pins it to patch B, only the Cargo.lock ref for A was emitted, so the CLI's wiring-conflict gate never saw B. Discovery now also emits a Cargo.toml ref for B (attributed to the member) when B's requirement accepts the locked version and the lock resolves the crate from no B entry, so the package is gated as `wiring_conflict`. A same-version B lock entry is already its own ref; B at another locked version is a separate, patched package and does not conflict. `DepEntry` / `Decl` now carry a `DepSource` (crates.io, registry, git, path) in place of the message-only origin string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #2019 (
fix/cargo-mixed-member-pins). It closes the two Cargo false-attestation gaps the #2019 author found.Vendored twin from another source
vendorwires a crate through the root's[patch.crates-io], and cargo applies that only to crates.io declarations. A workspace member (or the root) can declare the crate from another registry or from a repository URL, at a requirement the patched version satisfies. That declaration resolves its own unpatched copy. The vendored ref still attested beside it, because the lock copy claim (vendored_copy_claim) only reads sourceless entries.UnattestedKind::CargoPatchBypassed. The detail names the declaration.Cargo.lockentry at exactly the patched version from any registry or repository source, beside the copy, is marked the same way. The detail names that lock entry.[patch.<source>]table for its source points at the same copy (for example[patch.my-corp], or a repository URL table, ignoring a trailing/or.git).a_same_version_fork_beside_the_tagged_copy_is_ignoredalready specifies.vex_cargo_patch_bypassed. That tag is documented in CLI_CONTRACT.md (Unattested references paragraph and the notes table).I added a new variant rather than reusing
CargoUnpinnedDeclaration. That variant's note tells the user to re-runscanto pin the declaration, which is the wrong fix for vendored wiring.Split patches
The root pins a crate to Socket patch A and a member pins it to patch B. When the lock holds only A, discovery stopped as soon as it found a declaration pinning A, so it never emitted B and the CLI's
wiring_conflictgate never ran. Discovery now also emits aCargo.tomlref for B, attributed to the member, when two things hold:So the package is gated as
wiring_conflict. A same-version B lock entry was already its own ref, so the conflict pair came from the lock and nothing changes there. B locked at another version is a separate, patched package, so it doesn't conflict.Refactor
DepEntry/Declnow carry aDepSource(crates.io / registry / repository URL / path) in place of the message-only origin string.Tests
split_patches_across_root_and_member_emit_both,a_member_from_another_source_bypasses_the_vendored_copy,a_same_version_lock_entry_from_any_source_bypasses_the_vendored_copy,a_member_from_git_bypasses_the_config_wired_copy.declarations_the_patch_redirects_keep_the_vendored_copy_attested: crates.io members in every spelling, includingregistry = "crates-io"and a rename; an excluding requirement;[patch.my-corp]and repository-URL coverage; a path fork.another_patch_pin_at_another_version_does_not_conflict.a_vendored_cargo_copy_beside_a_bypassing_source_is_gated.cargo test -p socket-patch-core --lib -- vex::discover:: vendor::cargo patch::redirect:: utils::cargo_workspace(includes the golden corpus test): 1552 passed.-p socket-patch-cli --lib vex_sources: 16 passed.--test in_process_redirect cargo: 6 passed.--test mode_migration_cargo: 30 passed.--test in_process_cargo_apply cargo: 3 passed.cargo clippy --locked --workspace --all-features -- -D warningsandcargo fmt --all -- --checkare clean.Not done
vendor::cargoalready refuses the lock-twin state:locked_multi_source_conflictcovers a same-version entry from two sources, andvendor_source_unsupportedcovers a non-crates.io entry. A member declaration whose other-source copy isn't locked yet is invisible to the planner without re-resolving.Discovery.refs, andwiring_conflictsalready groups refs by purl and uuid.🤖 Generated with Claude Code