Commit 2cadffb
fix(redirect): fail closed on non-npm: berry descriptors + yarn layering regression suite
rewrite_yarn_berry matched lock blocks by descriptor NAME only, so a
hosted redirect of a package that yarn berry builtin-patches (fsevents,
resolve, typescript) spliced an `npm:` resolution + checksum under the
`patch:`-protocol key — a corrupted key/resolution pairing in exactly
the 2026-07 strapi incident's error family, emitted with no warning.
Now non-`npm:` descriptor ranges (patch:/workspace:/portal:/link:) are
skipped byte-identically with a redirect_yarn_berry_unsupported_protocol
warning, mirroring the vendor backend's fail-closed gate
(vendor/yarn_berry_lock.rs).
New vendor::yarn_layering_tests (in-crate #[cfg(test)] module, since the
core-dedups cleanup privatized the vendor wiring internals it plumbs;
inventory_npm_lock widened to pub(crate) for the same reason) pins the
incident's flows on a strapi-shaped yarn v1 fixture (multi-version
ansi-regex + fsevents + resolve) and a yarn-4 berry fixture with real
builtin patch: entries — 9 tests, each RED-verified:
- vendored wiring is byte-surgical: untouched sibling/builtin-target
blocks byte-identical, zero `patch:` strings introduced, file still
parseable by the crate's own inventory
- integrity chain: #sha1 fragment, sha512 SRI, and ledger sha256/size
all recomputed from the on-disk vendored tarball
- hosted redirect layered over vendored wiring records the vendored
block as `original` (reversible), is byte-surgical, and re-runs are
no-ops
- vendor revert after a hosted overlay: drift-skipped and lossy
(deletes the blob dir, lockfile stays hosted) — pinned as current
behavior
- berry builtin patch: entries survive vendored wiring AND hosted
redirect byte-identically; redirecting the builtin-patched package
itself now skips its patch: entry with the new warning
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 1af43a3 commit 2cadffb
4 files changed
Lines changed: 1055 additions & 1 deletion
File tree
- crates/socket-patch-core/src/patch
- redirect
- vendor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
987 | 987 | | |
988 | 988 | | |
989 | 989 | | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
990 | 1010 | | |
991 | 1011 | | |
992 | 1012 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
0 commit comments