Skip to content

Commit ac8e9e0

Browse files
mikolalysenkoclaude
andcommitted
Pin the shadowed early shrinkwrap in pnpm_hosted
early_pnpm1_refuses_non_durable_shrinkwrap_across_all_locks asserted the pre-N11 rule, where pnpm 1's early shrinkwrap refused the dependency even beside a pnpm-lock.yaml. Beside one it is shadowed now, so it refuses nothing and only pnpm-lock.yaml is rewritten; a lone one still refuses. The test failed on this branch since the N11 change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e426d50 commit ac8e9e0

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

‎crates/socket-patch-core/tests/pnpm_hosted.rs‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,35 @@ fn mixed_newlines_preserve_unrelated_bytes() {
134134
roundtrip("pnpm-lock.yaml", lock, &dep("left-pad"), 1);
135135
}
136136

137+
/// pnpm 1's early shrinkwrap (`shrinkwrapVersion: 3`) is no durable
138+
/// lock: a lone one refuses the dependency. Beside a `pnpm-lock.yaml` it
139+
/// is shadowed (N11: pnpm >= 3 never reads it), so it refuses nothing and
140+
/// only the governing lock is rewritten.
137141
#[test]
138-
fn early_pnpm1_refuses_non_durable_shrinkwrap_across_all_locks() {
142+
fn early_pnpm1_shrinkwrap_refuses_only_when_it_governs() {
139143
let old = "shrinkwrapVersion: 3\npackages:\n /left-pad/1.3.0:\n resolution:\n integrity: sha1-UPSTREAM=\n";
140144
let newer = "lockfileVersion: '9.0'\npackages:\n left-pad@1.3.0:\n resolution: {integrity: sha512-UPSTREAM==}\n";
141-
let files = BTreeMap::from([
142-
("shrinkwrap.yaml".into(), old.into()),
143-
("pnpm-lock.yaml".into(), newer.into()),
144-
]);
145-
let result = rewrite_registry_redirect(&files, &[dep("left-pad")]);
145+
let alone = BTreeMap::from([("shrinkwrap.yaml".into(), old.into())]);
146+
let result = rewrite_registry_redirect(&alone, &[dep("left-pad")]);
146147
assert!(result.files.is_empty() && result.edits.is_empty());
147148
assert!(result.refused_pnpm_uuids.contains("patch-id"));
148149
assert_eq!(
149150
result.warnings[0].code,
150151
"redirect_pnpm_legacy_lockfile_unsupported"
151152
);
153+
154+
let both = BTreeMap::from([
155+
("shrinkwrap.yaml".into(), old.into()),
156+
("pnpm-lock.yaml".into(), newer.into()),
157+
]);
158+
let result = rewrite_registry_redirect(&both, &[dep("left-pad")]);
159+
assert!(
160+
result.refused_pnpm_uuids.is_empty(),
161+
"{:?}",
162+
result.warnings
163+
);
164+
assert_eq!(
165+
result.files.keys().map(String::as_str).collect::<Vec<_>>(),
166+
["pnpm-lock.yaml"]
167+
);
152168
}

0 commit comments

Comments
 (0)