Repository navigation
Commit ff949a3
Report an unreadable vendor ledger instead of "No patch found" in remove and rollback (#2250)
* Start unreadable-ledger-not-found
Refs #2249.
Assisted-by: Claude Code
* Name the unreadable ledger, not "No patch found"
A vendored project records its patches only in the vendor ledger. When
that file could not be parsed, remove <target> and rollback <target>
answered "No patch found matching identifier" for every target the
manifest and the hosted pins did not hold. The ledger may hold it, and
the lockfiles still install its artifact. report and a bare rollback
already named the ledger.
A target that selects nothing in the stores that could be read now
fails with vendor_state_unreadable in both commands, for an identifier
and for a rollback path target, in place of not_found, patch_not_found
and path_glob_no_match. The exit code stays 1. remove takes the error
it already raised before a vendored revert; the two share one mapping.
With every store readable the "not found" codes are unchanged, and so
is a target that the manifest or a hosted pin does hold.
Fixes #2249.
Assisted-by: Claude Code
* Refuse an unreadable ledger before any change
Review of the previous commit found the same input mishandled in three
more places.
remove <target> for a manifest record restored the installed files in
place and only then failed with vendor_state_unreadable, reporting no
event and rolledBack 0. The contract says the refusal comes before any
mutation. It now comes before the in-place rollback, so nothing is
restored; the ledger no longer reaches that rollback as "nothing
vendored".
With no manifest, remove and rollback probed for the ledger with a stat
and took any error for absence, so a ledger that could not be stat'd (a
symlink loop, an unsearchable directory) was "No patches in this
project". Only a missing file is absence now, as for the manifest.
The error of an unmatched target names that target, so a run given
several can tell which one stopped it, and rollback keeps the note that
names the project directories below holding it.
Refs #2249.
Assisted-by: Claude Code
* Cover repair's probe; keep the directory hint
A second review of the branch.
repair probed for the vendor ledger with the same stat as remove and
rollback did: with no manifest, a ledger it could not stat was
manifest_not_found. Only a missing file is absence there too now, and
the run reports the ledger.
The contract said a ledger under an unsearchable .socket/vendor/ fails
as vendor_state_unreadable. It does not: the apply lock's journal check
reads that directory first and fails as lock_io, as it already did with
a manifest present. The contract and the comments say that now.
rollback <name> keeps its "to target a directory instead" hint when
the ledger is what failed. The contract's patched_projects_below row
covers an identifier, not a path target, which never carried the note.
Refs #2249.
Assisted-by: Claude Code
* Put rollback's directory hint before the ledger error
A review comment on the branch: with the vendor ledger unreadable,
rollback <name> appended "(to target a directory instead, use ./x or
x/**)" after the ledger's own error, so the hint read as part of the
parse error:
... key must be a string at line 4 column 1 (to target a directory
instead, use ./x or x/**)
The hint now ends the clause about the target, ahead of that error:
cannot read .socket/vendor/state.json to look up x, which matches
nothing else in the project (to target a directory instead, use ./x
or x/**): corrupt ./.socket/vendor/state.json: key must be ...
patch_not_found reads as before, and a PURL or UUID target still
carries no hint. A test pins where the hint lands.
Refs #2249.
Assisted-by: Claude Code
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent d88450c commit ff949a3
8 files changed
Lines changed: 499 additions & 90 deletions
File tree
- crates/socket-patch-cli
- src
- commands
- tests
- remove
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
337 | 359 | | |
338 | 360 | | |
339 | 361 | | |
| |||
533 | 555 | | |
534 | 556 | | |
535 | 557 | | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
540 | 565 | | |
541 | 566 | | |
542 | 567 | | |
| |||
652 | 677 | | |
653 | 678 | | |
654 | 679 | | |
655 | | - | |
656 | | - | |
657 | | - | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
658 | 683 | | |
659 | 684 | | |
660 | 685 | | |
| |||
722 | 747 | | |
723 | 748 | | |
724 | 749 | | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
739 | 766 | | |
740 | | - | |
| 767 | + | |
| 768 | + | |
741 | 769 | | |
742 | 770 | | |
743 | 771 | | |
| |||
754 | 782 | | |
755 | 783 | | |
756 | 784 | | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
757 | 793 | | |
758 | 794 | | |
759 | 795 | | |
| |||
768 | 804 | | |
769 | 805 | | |
770 | 806 | | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
771 | 819 | | |
772 | 820 | | |
773 | 821 | | |
| |||
842 | 890 | | |
843 | 891 | | |
844 | 892 | | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
| 893 | + | |
849 | 894 | | |
850 | 895 | | |
851 | 896 | | |
| |||
867 | 912 | | |
868 | 913 | | |
869 | 914 | | |
870 | | - | |
871 | | - | |
872 | | - | |
| 915 | + | |
| 916 | + | |
873 | 917 | | |
874 | 918 | | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
| 919 | + | |
879 | 920 | | |
880 | 921 | | |
881 | 922 | | |
| |||
1085 | 1126 | | |
1086 | 1127 | | |
1087 | 1128 | | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
1098 | | - | |
1099 | | - | |
1100 | | - | |
1101 | | - | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
1106 | | - | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
1115 | 1134 | | |
1116 | 1135 | | |
1117 | 1136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1969 | 1969 | | |
1970 | 1970 | | |
1971 | 1971 | | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
1972 | 1975 | | |
1973 | | - | |
1974 | | - | |
1975 | | - | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
1976 | 1980 | | |
1977 | 1981 | | |
1978 | 1982 | | |
| |||
2288 | 2292 | | |
2289 | 2293 | | |
2290 | 2294 | | |
2291 | | - | |
2292 | | - | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
2293 | 2308 | | |
2294 | | - | |
2295 | | - | |
2296 | | - | |
2297 | | - | |
| 2309 | + | |
2298 | 2310 | | |
2299 | 2311 | | |
2300 | 2312 | | |
2301 | 2313 | | |
2302 | | - | |
| 2314 | + | |
2303 | 2315 | | |
2304 | 2316 | | |
2305 | 2317 | | |
| |||
2357 | 2369 | | |
2358 | 2370 | | |
2359 | 2371 | | |
2360 | | - | |
2361 | | - | |
2362 | | - | |
2363 | | - | |
2364 | | - | |
2365 | | - | |
2366 | | - | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
2367 | 2388 | | |
2368 | 2389 | | |
2369 | 2390 | | |
2370 | | - | |
2371 | | - | |
| 2391 | + | |
| 2392 | + | |
2372 | 2393 | | |
2373 | 2394 | | |
2374 | 2395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
677 | 705 | | |
678 | 706 | | |
679 | 707 | | |
| |||
0 commit comments