GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix cargo cold-cache apply exiting 0 (#616) by mikolalysenko · Pull Request #1310 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Fixes #616

Summary

socket-patch apply on a cold or pruned Cargo cache exits 1 again, as it did in 4.x. The error names cargo fetch as the remedy. Before this change it exited 0 with status: "success", and the next cargo build --locked compiled the unpatched crate.

Root cause

#555 (the #403 fix) made apply treat any manifest purl that the project lock resolves, but that isn't on disk, as a calm package_not_installed "lockfile-only" skip. For npm that means the package was deliberately left out (a platform-gated optional dependency, or --omit=dev). Cargo never leaves a locked crate out on purpose: cargo fetch unpacks every Cargo.lock entry into registry/src, target-gated ones included (checked locally with a cfg(windows) dependency on macOS). So a locked crate that is missing just hasn't been fetched yet, and the next build downloads or re-extracts it unpatched.

Fix

  • lockfile_resolved (crates/socket-patch-cli/src/commands/apply.rs) no longer counts pkg:cargo/ purls as lockfile-only (lock_resolution_is_calm). An unfetched crate is now an ordinary unresolved purl: an all-miss run exits 1 / partialFailure, and a partial miss prints the usual warning, as in 4.x.
  • Cargo misses carry an actionable remedy in three places: the package_not_installed event detail, the human error block and the human warning (run \cargo fetch` first …`).
  • No target-gated special case is needed, because cargo fetch unpacks every locked crate, so it always fixes the miss.
  • The npm calm skips are unchanged, and their tests still pass.
  • Docs: the CLI_CONTRACT package_not_installed row, and docs/ecosystems.md "Cargo: shared registry cache", which now says to run cargo fetch before apply.

Per-issue checklist

  • Cargo apply on a cold or pruned registry cache now exits 0 as "lockfile-only", then the next cargo build downloads and compiles the unpatched crate (regression from #555) #616: tests/apply/lockfile_only_skip.rs
    • cargo_crate_on_cold_registry_cache_fails_with_fetch_remedy (empty CARGO_HOME)
    • cargo_crate_with_pruned_registry_src_fails_with_fetch_remedy (.crate cached, registry/src pruned)
    • Each checks the JSON (exit 1, partialFailure, a detail with the cargo fetch remedy), the human output and --silent.

Red → green

  • Before the fix, both new tests failed: left: 0 right: 1, envelope "status":"success", with the reason Resolved by the project lockfile but not installed on this host (lockfile-only).
  • After the fix, the apply binary passes 124/124, including the existing npm npm apply exits 1 when every patch targets a platform-skipped optional dependency (fsevents, @esbuild/*), so the setup hook fails npm ci and npm install on other OSes #403 tests.

Commands run

  • cargo fmt --all -- --check: clean for the changed files. The only diff is pre-existing on main, in socket-patch-core/src/patch/redirect/upstream/mod.rs.
  • cargo clippy --workspace --all-features -- -D warnings: clean.
  • cargo test -p socket-patch-cli --lib apply: 64 passed.
  • cargo test -p socket-patch-cli --test apply --test in_process_cargo_apply --test e2e_safety_cargo_build --test e2e_vex_lockfile --test scan_vendor_e2e: all green.
  • cargo test -p socket-patch-cli --no-fail-fast (full suite): 207 binaries green. The only 2 failures are local-environment only, in e2e_vendor_cargo_build old-toolchain legs (Bad CPU type in executable: an x86 rustup 1.41 toolchain on Apple silicon without Rosetta). They are unrelated to this change.

🤖 Generated with Claude Code


Generated by Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Mikola Lysenko (mikolalysenko) and others added 2 commits October 9, 2026 12:42
@mikolalysenko @claude
WIP: Fix cargo cold-cache apply exiting 0 (#616)
692059e
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@mikolalysenko @claude
Fail cargo apply on an unfetched crate again
9f84ebb
Since #555, apply treated a manifest crate that Cargo.lock resolves
but that is not unpacked in $CARGO_HOME/registry/src as a calm
lockfile-only skip: exit 0, status success. On a fresh CI runner or
a pruned cache that crate was simply not fetched yet, so
'socket-patch apply && cargo build --locked' went green and shipped
the unpatched crate (#616).

Cargo crates are no longer lockfile-only: cargo fetch unpacks every
locked crate, target-gated ones included, so a missing one is a real
miss. An all-miss run exits 1 again, as in 4.x, and the JSON detail,
the human error and the warning tell the user to run cargo fetch
first. npm's platform-gated and --omit=dev skips are unchanged.

Fixes #616

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 9, 2026 17:18
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) enabled auto-merge October 9, 2026 17:19
cursor[bot]
cursor Bot reviewed Oct 9, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for 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 9f84ebb. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 9, 2026
View reviewed changes
@mikolalysenko
Mikola Lysenko (mikolalysenko) disabled auto-merge October 9, 2026 17:53
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

[final reviewer] I disarmed auto-merge at 9f84ebbb because ci-ok is red on this head. Only hosted-e2e and e2e (ubuntu-latest, e2e_safety_pnpm) fail, which is the main-wide [email protected] failure (#1293), not this PR. #1302 fixes it and is in the merge queue now. Once main carries it, merge main in here (no other commits needed) and I'll re-arm auto-merge after CI goes green. The approval still covers this head.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Merge branch 'main' into agent/v5-cargo-cold-cache
bc0c6e5
@mikolalysenko
Mikola Lysenko (mikolalysenko) enabled auto-merge October 9, 2026 18:22
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 9, 2026
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Ready for review at bc0c6e5a8d9c.

  • CI: required checks ci-ok and clippy green; 7 check suites succeeded. 1 superseded workflow run(s) show as cancelled; the required gates passed on this head.
  • Mergeable against main, no CHANGELOG.md change.
  • Bugbot reviewed this head; no unresolved review threads.

Labeled Ready for review by the burn-down agent. Slack announcement pending (connector unavailable this run).


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) removed this pull request from the merge queue due to a manual request Oct 9, 2026

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Merge branch 'main' into agent/v5-cargo-cold-cache
22c441b
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
Merged via the queue into main with commit 478ceb4 Oct 9, 2026
31 of 53 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/v5-cargo-cold-cache branch October 9, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@Tanmay182003 Tanmay Singla (Tanmay182003) Tanmay182003 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Cargo apply on a cold or pruned registry cache now exits 0 as "lockfile-only", then the next cargo build downloads and compiles the unpatched crate (regression from #555)

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@mikolalysenko @Tanmay182003
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.