GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||
GeezerVison is showing github.com — Fix hosted/vendored cargo floor reads (#653, #651) by mikolalysenko · Pull Request #1429 · SocketDev/socket-patch Conversation
|
| Issue | Regression test |
|---|---|
| #653 | patch::redirect::tests::cargo_declared_floor_below_sparse_support_is_refused: rust-version 1.67 (also CRLF), an inherited 1.60, rust-toolchain.toml 1.67.1, rust-toolchain 1.56 and a member's 1.64 are each refused with nothing written. The test also checks the rollback hint over existing pins. 1.68 and an undeclared floor still redirect. |
| #653 | e2e_redirect_cargo_shapes::cargo_hosted_refuses_a_project_declaring_cargo_below_1_68: the real CLI scan --mode hosted refuses, leaves the project byte-identical, and cargo fetch --locked still works. |
| #653 | hosted::engine::tests::the_cargo_toolchain_files_are_read_as_advisory_input |
| #651 | vendor::cargo::tests::a_workspace_inherited_rust_version_is_the_declared_floor: no multi-version warning for an inherited 1.70. |
| both | formats::cargo::floor::tests::*: spellings, BOM, precedence, dated channels, member inheritance. |
Local runs on e482907 (plus the blank-toolchain fix in bbd74db, re-tested with the floor and hosted unit tests):
cargo fmt --all -- --check: clean.cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-core --all-features (lib and everycopy_treevlt_heal unremovable lock, poetry/requirementsmain because this sandboxcargo test -p socket-patch-cli --all-features --lib --bins: 913SOCKET_PATCH_CARGO_E2E_REQUIRED=1:e2e_redirect_cargo_build 22, e2e_redirect_cargo_shapes 31,e2e_vendor_cargo_build 39, mode_migration_cargo 29. All pass.cargo test --workspace locally: its 150+ CLIThe npm, PyPI and gem wrappers have no cargo logic, so they needed no
change. /code-review high raised 7 findings. I fixed 6 in a follow-up
commit; the 7th (ancestor toolchain files) is out of scope, as noted above.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Pr4cZSSSuEsv1rzzGoxTpg
Note
Medium Risk
Changes hosted Cargo redirect eligibility and can refuse scans that previously wrote broken sparse pins; behavior is fail-closed with clear codes and docs, but affects production lockfile mutation for older-toolchain Rust projects.
Overview
Adds a shared formats/cargo/floor reader for the project’s declared Cargo version (rust-version, workspace inheritance, root rust-toolchain / rust-toolchain.toml) and wires it into hosted and vendored Cargo paths.
Hosted (#653): Sparse-registry redirects need Cargo 1.68+. If the declared floor (including workspace members the planner pins) is older, each crate is skipped with redirect_cargo_old_cargo and no lock/config writes—avoiding pins that fail at build time. Existing pins get a rollback hint in the warning. Undeclared or rolling channels still redirect.
Vendored (#651): rust-version.workspace = true now resolves [workspace.package], so cargo_multi_version_old_cargo is not spuriously emitted for normal workspaces.
Hosted scans also read toolchain files (registry PRESENCE_ONLY); contract and docs/ecosystems.md document the floor. Vendored floor logic is deduplicated into the shared module.
Reviewed by Cursor Bugbot for commit d783d53. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
Hosted cargo patches are served from a sparse registry, which cargo only loads from 1.68. A project that declared an older cargo in rust-version or rust-toolchain[.toml] got "success" from scan --mode hosted, and every build then failed with "usage of sparse registries requires -Z sparse-registry". Hosted scan now refuses each cargo patch there with redirect_cargo_old_cargo, writes nothing, and points at --mode vendored (#653). The declared floor now has one reader in formats/cargo, shared with the vendored multi-version warning. It also follows rust-version.workspace = true to [workspace.package], so a standard modern workspace no longer gets a false "declares no rust-version" warning when two versions of a crate are vendored (#651). Assisted-by: Claude Code:claude-opus-5-5
Adds an e2e shape where rust-version = "1.67" makes scan --mode hosted refuse the cargo patch and leave the project untouched, and an engine test that the toolchain files reach the planner. Assisted-by: Claude Code:claude-opus-5-5
Review follow-ups for the hosted cargo floor: - the legacy rust-toolchain file wins over rust-toolchain.toml when both exist, as it does for rustup - a dated nightly-/beta-YYYY-MM-DD channel maps to its release train, so a nightly from before sparse registries is refused too - a workspace member's rust-version counts, since one cargo builds the whole lock - the refusal names the rollback that drops pins an earlier run wrote - vendored reads the toolchain files only when Cargo.toml says nothing - the hosted candidate-file list test knows the toolchain files Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
The hosted engine records an unreadable in-memory rust-toolchain as an empty file. Because rustup prefers the legacy file, that blank placeholder hid rust-toolchain.toml's channel, and a project pinned below cargo 1.68 was still redirected. A blank legacy file now names no toolchain, so the TOML file's channel is used. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ready for review (burn-down agent)
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Final review: needs a decision before this can be briefedThe question: when a workspace pins its toolchain, should a member's low Where:
Example: root
Options:
I lean towards 1, since the PR's own reasoning is about the one cargo that builds the lock. It's a product call, though, so I'm leaving the code as is. Non-blocking notes:
Otherwise checked:
Labelled Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…red-floor # Conflicts: # docs/ecosystems.md
Main's #1420 added a restored field to the e2e Shape struct; the declared-cargo-floor test this branch adds predates it and no longer compiled after merging main. Co-Authored-By: Claude <[email protected]>
|
Merged
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…red-floor # Conflicts: # crates/socket-patch-cli/CLI_CONTRACT.md
|
bugbot run Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d783d53. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Hosted cargo redirect writes a sparse+ registry even when the project declares rust-version < 1.68, so every build on that cargo fails with "usage of sparse registries requires -Z sparse-registry" while scan reports success Vendored cargo warns cargo_multi_version_old_cargo ("declares no rust-version") when the root package inherits rust-version from [workspace.package]
There was an error while loading. Please reload this page.