Repository navigation
Commit b787454
fix: vendor hosted patches directly from lockfiles (#1648)
* fix: vendor hosted lockfile patches without installed packages
* Update cargo mode-migration tests to hosted-pins-first vendor
A plain `vendor` with a hosted pin in scope now ejects exactly the
lockfile's hosted patch, even when `.socket/manifest.json` names another
patch for the same purl; vendoring manifest patches takes a full
`scan --mode vendored`. The hosted→vendored and A→B→A tests expected the
old per-purl takeover onto the manifest's patch.
Point the eject at the mock API, serve the granted crate (with the
sha512 the artifact download checks), and assert the new contract: the
hosted UUID is vendored and attested, the manifest-only UUID is neither
vendored, reported nor attested, and the manifest is left byte-identical.
The fail-closed test now covers both refusals: `--offline` is refused up
front (`offline_eject_unavailable`), and an index that cannot re-resolve
the crates.io entry still yields `redirect_revert_failed` with the
checkout remedy, nothing touched.
Co-Authored-By: Claude <noreply@anthropic.com>
* Update bun mode-migration tests to hosted-pins-first vendor
With a hosted pin in scope, plain `vendor` ejects the lockfile's hosted
patch and ignores `.socket/manifest.json`; the bun hosted→vendored and
dry-run tests still expected the manifest's patch (uuid_v) to take over
the hosted pin, with the per-purl takeover advisories.
Point `vendor_cmd` at the mock API so the eject can fetch the record,
expect the hosted uuid to be vendored (detached ledger entry, VEX on the
view's CVE), and assert that the manifest-only patch is not previewed,
reported or vendored and that the manifest is left byte-identical. The
dry run now previews the eject (`eject_planned`) instead of the old
`vendor_would_revert_redirect` advisory.
Co-Authored-By: Claude <noreply@anthropic.com>
* Update yarn mode-migration tests to hosted-pins-first vendor
The classic and berry hosted→vendored legs expected plain `vendor` to
take over the hosted pin with the staged manifest's patch (UUID_V) and
announce `vendor_takeover_reverted_redirect`. With a hosted pin in scope
`vendor` now ejects the lockfile's hosted patch and ignores the manifest.
Point the vendor runs at the mock API (the eject fetches the record from
`patches/view`), expect UUID_H and its CVE in the manifest-less VEX
matrices with UUID_V as the never-attested patch, and replace the
takeover-advisory check with the eject contract: the manifest-only patch
is neither reported nor vendored, and the manifest is not rewritten.
Co-Authored-By: Claude <noreply@anthropic.com>
* Update golang hosted→vendored test to hosted-pins-first vendor
The test staged a manifest naming UUID_V over a hosted go.mod pin and
expected plain `vendor` to take the pin over with the manifest's patch.
With a hosted pin in scope `vendor` now ejects the lockfile's hosted
patch (UUID_H) and ignores the manifest; the run reached the public
proxy for the record and failed.
Point the run at the mock API, serve the hosted patch's prebuilt module
from the artifact-service mock, and expect the go.mod replace to name
UUID_H. Assert the manifest-only patch is neither reported nor vendored
and the manifest is left byte-identical; the existing upstream-restore
checks (no hosted replace, go.sum back to its pre-redirect bytes, no
ledger) are unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
* Describe plain vendor over hosted pins as an eject, not a takeover
The "Takeover reconciliation" contract and the `run_eject` doc comment
still described plain `vendor` as a per-purl takeover onto the
manifest's patches. With a hosted pin in scope it ejects exactly the
lockfile's hosted pins as one planned transition and ignores the
manifest; say so, point manifest vendoring at `scan --mode vendored`,
and keep the per-purl takeover wording for `scan` / `get --mode
vendored` and the no-hosted-pin manifest path.
Co-Authored-By: Claude <noreply@anthropic.com>
* Update hosted-pin vendor tests for eject and heal vlt stores on eject
Plain `vendor` with hosted pins in scope now ejects only the lockfile
pins and fetches each pinned record from the patch API, so tests that
staged a manifest and expected the per-purl takeover failed with
`patch_fetch_failed` (coverage job). Point those runs at mock API
records (sbt, pypi requirements/pipenv, bun, vlt, pnpm/npm conversion,
berry) and assert the eject contract: `eject_planned` on dry runs,
`eject_refused` / `offline_eject_unavailable` for refusals, the hosted
pin's UUID vendored, and the manifest left untouched. The bun prune test
now builds its manifest-tracked entry from a registry lock, since only
manifest vendoring without hosted pins produces one. The help hygiene
test expects the new one-line vendor summary.
The vlt dry/wet test exposed a product gap: the eject skipped the warm
vlt store heal the per-purl takeover runs, leaving the hosted store copy
and hidden lock behind, so a later `vendor --revert` could keep patched
bytes under a registry pin. The eject now heals those store entries once
it stands and reports `redirect_vlt_reinstall_required`.
Co-Authored-By: Claude <noreply@anthropic.com>
* Skip the backend preview for pins the eject restore refused
A pin whose upstream restore was refused already has its failure event.
Previewing the backend over a lock where that pin is still hosted added a
second `failed` event for the same purl with a backend code, which double
counted summary.failed and blamed the wrong step.
Also stop listing plain `vendor` as a source of
vendor_would_revert_redirect in CLI_CONTRACT.md: with a hosted pin in
scope it ejects and reports eject_planned / eject_refused instead.
Co-Authored-By: Claude <noreply@anthropic.com>
* Let manifest vendoring run past contested wiring with no pins in scope
The hosted inventory is not ecosystem-scoped, so a contested hosted ref
anywhere in the tree (e.g. an npm shrinkwrap under `vendor --ecosystems
pypi`) refused the whole run as `hosted_wiring_contested`, even when an
agent manifest exists and no hosted pin is in scope. That made the
legacy manifest-only fallback unreachable and regressed plain manifest
vendoring versus main.
Refuse on contested wiring only when there is no manifest (the lockfiles
are the only patch set) or when in-scope hosted pins would be ejected.
Co-Authored-By: Claude <noreply@anthropic.com>
* Correct the contract on what feeds standalone vendor
The vendor-command contract still said plain `vendor` is fed by
`.socket/manifest.json` and falls back to the lockfiles' hosted pins only
when no manifest exists. This PR flipped that precedence: any hosted pin
in scope sends the run to the eject, which ignores the manifest and runs
no reconcile. State the new order so the contract matches the code and
the takeover-reconciliation section above it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Align #1105 test with the hosted-pin eject
Merging main brought in #1713's regression test, which expects plain
`vendor` over a hosted pin at patch A to vendor the manifest's newer
patch B. This branch makes plain `vendor` eject the hosted pins from
the lockfiles instead (manifest unread), so the merged tree failed
the test deterministically and the PR was evicted from the merge
queue twice (coverage (1), runs 40572480618 and 40575886984).
Keep the #1105 setup (venv synced from the hosted lock, manifest at
B) and assert the eject outcome: exit 0, no package_not_installed,
the project vendored at A with the hosted URL gone and B unread. The
superseded-install rule behind `scan --mode vendored` keeps its unit
test, hosted_pin_marks_a_pypi_install_superseded.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011f9aeQeQBzNvTuMrf6bWCp
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8244b94 commit b787454
24 files changed
Lines changed: 1084 additions & 395 deletions
File tree
- crates/socket-patch-cli
- src
- commands
- vendored_backend
- tests
- in_process_vendor_bun_takeover
- scan
- vendor
- docs
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
475 | 476 | | |
476 | 477 | | |
477 | 478 | | |
478 | | - | |
| 479 | + | |
| 480 | + | |
479 | 481 | | |
480 | 482 | | |
481 | 483 | | |
| |||
523 | 525 | | |
524 | 526 | | |
525 | 527 | | |
526 | | - | |
527 | | - | |
528 | | - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
529 | 559 | | |
530 | | - | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
531 | 572 | | |
532 | 573 | | |
533 | 574 | | |
| |||
538 | 579 | | |
539 | 580 | | |
540 | 581 | | |
541 | | - | |
542 | | - | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
543 | 595 | | |
544 | 596 | | |
545 | 597 | | |
546 | 598 | | |
547 | | - | |
| 599 | + | |
548 | 600 | | |
549 | 601 | | |
550 | 602 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
789 | | - | |
790 | | - | |
791 | | - | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
792 | 798 | | |
793 | 799 | | |
794 | 800 | | |
795 | 801 | | |
796 | 802 | | |
| 803 | + | |
797 | 804 | | |
798 | | - | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
799 | 810 | | |
| 811 | + | |
800 | 812 | | |
801 | 813 | | |
802 | 814 | | |
| |||
807 | 819 | | |
808 | 820 | | |
809 | 821 | | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
810 | 826 | | |
811 | 827 | | |
812 | | - | |
813 | | - | |
814 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
815 | 831 | | |
816 | 832 | | |
817 | 833 | | |
818 | 834 | | |
819 | 835 | | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
829 | 845 | | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
| 846 | + | |
| 847 | + | |
836 | 848 | | |
837 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
838 | 854 | | |
839 | 855 | | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
844 | 861 | | |
845 | 862 | | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | 863 | | |
852 | 864 | | |
853 | 865 | | |
| |||
868 | 880 | | |
869 | 881 | | |
870 | 882 | | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
871 | 896 | | |
872 | 897 | | |
873 | 898 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
0 commit comments