Repository navigation
Commit 65aa074
committed
Restore hosted bun.lockb pins natively for the vendor takeover
With the hosted ledger gone, `vendor` over a live hosted pin in a binary
bun.lockb (Bun 0.8.1-1.1.x's default lock, Bun 1.2's legacy lock) was
refused `redirect_revert_failed`: format_of() mapped bun.lockb to
Unsupported, so the backtest matrix's hosted-then-vendored cell exited
partial_failure.
The upstream restore gains a bun.lockb restorer
(patch/redirect/upstream/bun_lockb.rs). It rebuilds each hosted
remote-tarball record as Bun's npm registry record for name@version,
from the registry's dist.tarball / dist.integrity (SOCKET_NPM_REGISTRY
aware), via the new BunLockb::set_registry_package. That function
re-interns the URL (re-using the original pool offset), drops the
hosted URL string from the pool tail and re-derives the metadata hash.
The staged restore view now carries binary files.
To make the rebuild byte-exact, set_package keeps the registry record's
inactive bytes (padding, semver) when it writes a remote tarball
record. Early writers leave uninitialized padding there (Bun 0.8.1), so
this matters. A re-pin to a later grant's URL now drops the superseded
URL from the pool. A record without the retained bytes is rebuilt the
way Bun writes one; prerelease versions are refused in that case.
The rebuild is exact for every fixture writer except a format-1 lock
(kept promoted) and workspace locks (behaviors kept normalized). So
only the vendor takeover and eject opt in (RestoreOptions::bun_lockb):
their vendor ledger records the rebuilt record, and `vendor --revert`
returns the pre-hosted bytes. `rollback` / `remove` keep refusing a
hosted bun.lockb pin with the `git checkout -- bun.lockb` remedy, as
the harness's rollbackLockbRefused expects. An offline vendor still
refuses.
Tests: core restorer tests over every real fixture, codec tests for the
rebuild (retained and zeroed records, re-pin), a hermetic CLI test
(vendor_eject_bun_lockb.rs: takeover, eject, rollback and offline
refusals on Bun 0.8.1 / 1.1.38 / 1.2.0 locks), and the real-Bun
e2e_bun_lockb takeover now vendors online and reverts byte-exact.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018tncU7u7FK48tubFNA12UQ1 parent 08c30b7 commit 65aa074
13 files changed
Lines changed: 1127 additions & 41 deletions
File tree
- crates
- socket-patch-cli
- src/commands
- tests
- socket-patch-core/src
- patch/redirect/upstream
- vendor
- docs
- testing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
186 | 202 | | |
187 | 203 | | |
188 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
355 | | - | |
356 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1057 | 1057 | | |
1058 | 1058 | | |
1059 | 1059 | | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
1060 | 1063 | | |
1061 | 1064 | | |
1062 | 1065 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1123 | 1123 | | |
1124 | 1124 | | |
1125 | 1125 | | |
| 1126 | + | |
1126 | 1127 | | |
1127 | 1128 | | |
1128 | 1129 | | |
| |||
1222 | 1223 | | |
1223 | 1224 | | |
1224 | 1225 | | |
| 1226 | + | |
1225 | 1227 | | |
1226 | 1228 | | |
1227 | 1229 | | |
| |||
2954 | 2956 | | |
2955 | 2957 | | |
2956 | 2958 | | |
| 2959 | + | |
2957 | 2960 | | |
2958 | 2961 | | |
2959 | 2962 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
| 75 | + | |
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
| |||
110 | 116 | | |
111 | 117 | | |
112 | 118 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
117 | 123 | | |
118 | 124 | | |
119 | 125 | | |
| |||
743 | 749 | | |
744 | 750 | | |
745 | 751 | | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
750 | 759 | | |
751 | 760 | | |
752 | 761 | | |
| |||
780 | 789 | | |
781 | 790 | | |
782 | 791 | | |
783 | | - | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
784 | 855 | | |
785 | 856 | | |
786 | 857 | | |
| |||
0 commit comments