Repository navigation
Commit dcded7a
* WIP: Fix cargo shared-cache patch orphaned on takeover/prune (#336, #1278)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Keep cargo shared-cache patches restorable
Agent mode patches a crate in the machine-wide
$CARGO_HOME/registry/src cache, which nothing deletes when a project
stops using the crate. Two flows dropped the only record that can
restore that copy while leaving it patched for every project on the
machine:
- rollback/remove after an agent -> vendored takeover skipped the
in-place restore for the now vendor-owned crate, reported success,
dropped the manifest entry and GC'd its blobs (#336). A vendored
cargo crate whose cache copy still holds the patch is now restored
in place too, and its record only leaves the manifest when both the
in-place and vendored legs succeeded.
- scan --prune/--sync pruned the entry of a crate the lock bumped or
dropped (the lock-scoped crawl no longer reports it) (#1278). The
entry is now kept while its cache copy is still patched, with a
cargo_cache_patch_kept warning naming the rollback that restores it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Find cargo cache copies behind a vendor dir
Review follow-up. With a `cargo vendor` dir the cargo crawl searches
only `vendor/`, so a registry-cache copy an earlier apply patched was
never examined: prune could still drop its record and rollback could
skip it. Copies are now also looked up in the registry cache there, and
rollback restores the copy it found. A copy whose file cannot be read
(I/O error, unsafe key) counts as possibly patched, so its record is
kept rather than dropped.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Never write registry copies behind vendor/
Security review follow-up. The registry-cache lookup behind a `cargo
vendor` dir is now read-only: only the prune's keep decision uses it
(so a record is never dropped while the hidden copy may be patched),
and only for a real Cargo project (Cargo.toml or Cargo.lock), not any
vendor/ dir. Rollback and remove restore only copies their own crawl
reaches, as before. The cargo_cache_patch_kept warning names
`rollback --global` for the hidden-copy case.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Restore a vendored crate's cache copy behind a cargo vendor dir
A project vendor/ dir hides the registry cache from the crawl, so
rollback skipped a still-patched $CARGO_HOME copy of a vendored crate,
let the vendored leg succeed and dropped the manifest record: the #336
orphan again. Look up the shadowed copies for those crates and restore
them before the record goes; scan --prune already keeps such a record.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent d5d7a53 commit dcded7a
8 files changed
Lines changed: 572 additions & 9 deletions
File tree
- crates/socket-patch-cli
- src
- commands
- scan
- tests
- docs
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
602 | | - | |
| 602 | + | |
| 603 | + | |
603 | 604 | | |
604 | 605 | | |
605 | 606 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1528 | 1528 | | |
1529 | 1529 | | |
1530 | 1530 | | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
1531 | 1536 | | |
1532 | 1537 | | |
1533 | 1538 | | |
| |||
1981 | 1986 | | |
1982 | 1987 | | |
1983 | 1988 | | |
1984 | | - | |
| 1989 | + | |
| 1990 | + | |
1985 | 1991 | | |
1986 | 1992 | | |
1987 | 1993 | | |
| |||
2052 | 2058 | | |
2053 | 2059 | | |
2054 | 2060 | | |
2055 | | - | |
| 2061 | + | |
2056 | 2062 | | |
2057 | 2063 | | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
2058 | 2087 | | |
2059 | 2088 | | |
2060 | 2089 | | |
| |||
2128 | 2157 | | |
2129 | 2158 | | |
2130 | 2159 | | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
2131 | 2178 | | |
2132 | 2179 | | |
2133 | 2180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
| 239 | + | |
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
| |||
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
| 262 | + | |
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
264 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
265 | 306 | | |
266 | 307 | | |
267 | 308 | | |
| |||
334 | 375 | | |
335 | 376 | | |
336 | 377 | | |
337 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
338 | 382 | | |
339 | 383 | | |
340 | 384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
32 | 124 | | |
33 | 125 | | |
34 | 126 | | |
| |||
0 commit comments