@diffci.com/diffci 0.3.18 → 0.3.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist-client/src/client/cli.js +4 -2
  2. package/dist-client/src/client/verify.js +37 -3
  3. package/dist-client/src/client/working-tree.js +12 -0
  4. package/node_modules/@diffci.com/core/README.md +23 -10
  5. package/node_modules/@diffci.com/core/dist/git/git-diff.js +70 -3
  6. package/node_modules/@diffci.com/core/dist/git/git-diff.js.map +1 -1
  7. package/node_modules/@diffci.com/core/dist/git/types.d.ts +6 -3
  8. package/node_modules/@diffci.com/core/dist/planner/check-narrowing.js +1 -1
  9. package/node_modules/@diffci.com/core/dist/planner/check-narrowing.js.map +1 -1
  10. package/node_modules/@diffci.com/core/dist/planner/script-reads.js +1 -1
  11. package/node_modules/@diffci.com/core/dist/planner/script-reads.js.map +1 -1
  12. package/node_modules/@diffci.com/core/dist/planner/type-program.js +1 -1
  13. package/node_modules/@diffci.com/core/dist/planner/type-program.js.map +1 -1
  14. package/node_modules/@diffci.com/core/dist/repo/file-references.d.ts +4 -0
  15. package/node_modules/@diffci.com/core/dist/repo/file-references.js +9 -2
  16. package/node_modules/@diffci.com/core/dist/repo/file-references.js.map +1 -1
  17. package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +1 -0
  18. package/node_modules/@diffci.com/core/dist/repo/impact.js +38 -10
  19. package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
  20. package/node_modules/@diffci.com/core/dist/repo/lockfiles.d.ts +9 -0
  21. package/node_modules/@diffci.com/core/dist/repo/lockfiles.js +11 -0
  22. package/node_modules/@diffci.com/core/dist/repo/lockfiles.js.map +1 -0
  23. package/node_modules/@diffci.com/core/dist/repo/yarn-lockfile.d.ts +24 -0
  24. package/node_modules/@diffci.com/core/dist/repo/yarn-lockfile.js +352 -0
  25. package/node_modules/@diffci.com/core/dist/repo/yarn-lockfile.js.map +1 -0
  26. package/node_modules/@diffci.com/core/src/git/git-diff.ts +59 -3
  27. package/node_modules/@diffci.com/core/src/git/types.ts +6 -3
  28. package/node_modules/@diffci.com/core/src/planner/check-narrowing.ts +1 -1
  29. package/node_modules/@diffci.com/core/src/planner/script-reads.ts +1 -1
  30. package/node_modules/@diffci.com/core/src/planner/type-program.ts +1 -1
  31. package/node_modules/@diffci.com/core/src/repo/file-references.ts +13 -2
  32. package/node_modules/@diffci.com/core/src/repo/impact.ts +35 -10
  33. package/node_modules/@diffci.com/core/src/repo/lockfiles.ts +10 -0
  34. package/node_modules/@diffci.com/core/src/repo/yarn-lockfile.ts +318 -0
  35. package/package.json +2 -2
@@ -0,0 +1,352 @@
1
+ // SPDX-License-Identifier: MIT
2
+ /**
3
+ * Conservative dependency candidates for Yarn Classic v1 lockfile changes.
4
+ *
5
+ * Unlike npm's installed-path lockfile, Classic records request selectors and omits peer dependency
6
+ * relationships and the hoisted install layout. Traversing dependencies alone therefore cannot prove
7
+ * that another direct package is unaffected. A semantic change returns ALL old/new direct names,
8
+ * after validating exact manifest requests and attributing every changed selector to a root. The
9
+ * caller must still account for tooling, lockfile readers and undeclared imports of hoisted packages.
10
+ * This is a candidate set for conservative selection, not an exact list of changed installed trees.
11
+ *
12
+ * Only generated v1 registry entries with version/resolved/integrity and dependency mappings are
13
+ * modeled. Berry, workspaces/aliases/local or git requests, missing edges, ambiguous or malformed
14
+ * syntax and unfamiliar fields return undefined so the caller retains full validation. This small
15
+ * parser intentionally accepts less than Yarn's general parser; it never repairs merge conflicts.
16
+ */
17
+ // Keep parsing bounded independently of the repository's Git output limit. Bigger lockfiles fall
18
+ // back; these are coverage limits, not a reason to interpret a prefix as a complete lockfile.
19
+ const MAX_CONTENT_LENGTH = 8 * 1024 * 1024;
20
+ const MAX_LINES = 100_000;
21
+ const MAX_LINE_LENGTH = 16_384;
22
+ const MAX_SELECTORS = 100_000;
23
+ const PACKAGE_NAME = /^(?:@[a-zA-Z0-9][a-zA-Z0-9._-]*\/)?[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
24
+ const NUMERIC_PART = "(?:0|[1-9][0-9]*)";
25
+ const IDENTIFIERS = "[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*";
26
+ const EXACT_VERSION = new RegExp(`^${NUMERIC_PART}\\.${NUMERIC_PART}\\.${NUMERIC_PART}(?:-${IDENTIFIERS})?(?:\\+${IDENTIFIERS})?$`);
27
+ const RANGE_VERSION = new RegExp(`^v?(?:${NUMERIC_PART}|[xX*])(?:\\.(?:${NUMERIC_PART}|[xX*])){0,2}$`);
28
+ function isExactVersion(value) {
29
+ if (!EXACT_VERSION.test(value))
30
+ return false;
31
+ const prerelease = /^[^-]+-([^+]+)/.exec(value)?.[1];
32
+ return !prerelease || prerelease.split(".").every((part) => !/^0[0-9]+$/.test(part));
33
+ }
34
+ function isRangeVersion(value) {
35
+ const version = value.replace(/^v/, "");
36
+ if (isExactVersion(version))
37
+ return true;
38
+ if (!RANGE_VERSION.test(value))
39
+ return false;
40
+ // Once a wildcard is used, a later numeric component is not a modeled range (e.g. 1.x.3).
41
+ const parts = version.split(".");
42
+ const wildcard = parts.findIndex((part) => /^[xX*]$/.test(part));
43
+ return wildcard === -1 || parts.slice(wildcard).every((part) => /^[xX*]$/.test(part));
44
+ }
45
+ /** A deliberately limited registry semver grammar; tags and protocol requests remain unsupported. */
46
+ function isRegistryRequest(value) {
47
+ if (!value || value.length > 512 || value !== value.trim())
48
+ return false;
49
+ return value.split("||").every((alternative) => {
50
+ const range = alternative.trim();
51
+ if (!range)
52
+ return false;
53
+ const hyphen = range.split(" - ");
54
+ if (hyphen.length > 1)
55
+ return hyphen.length === 2 && hyphen.every(isRangeVersion);
56
+ // Yarn also accepts spaces after comparators. Normalizing them here only validates syntax;
57
+ // selector lookup below still uses the exact original request from the manifest or entry.
58
+ const comparators = range.replace(/([<>]=?|[=~^]) +/g, "$1").split(/ +/);
59
+ return comparators.every((part) => {
60
+ const match = /^(?:<=|>=|<|>|=|~|\^)?(.+)$/.exec(part);
61
+ return !!match && isRangeVersion(match[1]);
62
+ });
63
+ });
64
+ }
65
+ function descriptor(name, request) {
66
+ return PACKAGE_NAME.test(name) && isRegistryRequest(request) ? `${name}@${request}` : undefined;
67
+ }
68
+ function validSelector(selector) {
69
+ const separator = selector.indexOf("@", selector.startsWith("@") ? 1 : 0);
70
+ return separator > 0 && descriptor(selector.slice(0, separator), selector.slice(separator + 1)) === selector;
71
+ }
72
+ /** Read a JSON-quoted string or a Classic bare string, without interpreting comments as content. */
73
+ function tokenAt(text, start) {
74
+ if (text[start] === '"') {
75
+ let end = start + 1;
76
+ for (; end < text.length; end++) {
77
+ if (text[end] === "\\") {
78
+ end++;
79
+ continue;
80
+ }
81
+ if (text[end] !== '"')
82
+ continue;
83
+ try {
84
+ const value = JSON.parse(text.slice(start, end + 1));
85
+ if (typeof value !== "string" || /[\u0000-\u001f\u007f]/.test(value))
86
+ return undefined;
87
+ return { value, end: end + 1 };
88
+ }
89
+ catch {
90
+ return undefined;
91
+ }
92
+ }
93
+ return undefined;
94
+ }
95
+ const match = /^[a-zA-Z/.-][^\s:,"\\\[\]{}]*/.exec(text.slice(start));
96
+ return match ? { value: match[0], end: start + match[0].length } : undefined;
97
+ }
98
+ function selectorHeader(line) {
99
+ const selectors = [];
100
+ const seen = new Set();
101
+ let packageName;
102
+ let position = 0;
103
+ while (position < line.length) {
104
+ const token = tokenAt(line, position);
105
+ if (!token || !validSelector(token.value) || seen.has(token.value))
106
+ return undefined;
107
+ const separator = token.value.indexOf("@", token.value.startsWith("@") ? 1 : 0);
108
+ const name = token.value.slice(0, separator);
109
+ if (packageName !== undefined && packageName !== name)
110
+ return undefined;
111
+ packageName = name;
112
+ selectors.push(token.value);
113
+ seen.add(token.value);
114
+ position = token.end;
115
+ while (line[position] === " ")
116
+ position++;
117
+ if (line[position] === ":")
118
+ return line.slice(position + 1).trim() === "" ? selectors : undefined;
119
+ if (line[position] !== ",")
120
+ return undefined;
121
+ position++;
122
+ while (line[position] === " ")
123
+ position++;
124
+ }
125
+ return undefined;
126
+ }
127
+ function pair(line) {
128
+ const key = tokenAt(line, 0);
129
+ if (!key || line[key.end] !== " ")
130
+ return undefined;
131
+ let position = key.end;
132
+ while (line[position] === " ")
133
+ position++;
134
+ const value = tokenAt(line, position);
135
+ if (!value || line.slice(value.end).trim() !== "")
136
+ return undefined;
137
+ return [key.value, value.value];
138
+ }
139
+ function registryResolution(value, integrity) {
140
+ if (!/^https?:\/\/[^\s\\]+$/.test(value))
141
+ return false;
142
+ try {
143
+ const url = new URL(value);
144
+ if (!/^https?:$/.test(url.protocol) || !url.hostname || url.username || url.password)
145
+ return false;
146
+ // Registry URLs need not use a particular host or filename. Require a content pin, though:
147
+ // Classic's resolved fragment is SHA1; newer files can instead carry an integrity digest.
148
+ if (url.hash && !/^#[a-fA-F0-9]{40}$/.test(url.hash))
149
+ return false;
150
+ return !!url.hash || integrity !== undefined;
151
+ }
152
+ catch {
153
+ return false;
154
+ }
155
+ }
156
+ function validIntegrity(value) {
157
+ const sizes = { sha1: 20, sha256: 32, sha384: 48, sha512: 64 };
158
+ return value.split(" ").every((token) => {
159
+ const match = /^(sha(?:1|256|384|512))-([A-Za-z0-9+/]+={0,2})$/.exec(token);
160
+ if (!match)
161
+ return false;
162
+ const digest = Buffer.from(match[2], "base64");
163
+ return digest.length === sizes[match[1]] && digest.toString("base64").replace(/=+$/, "") === match[2].replace(/=+$/, "");
164
+ });
165
+ }
166
+ function parse(content) {
167
+ if (content === undefined || content.length > MAX_CONTENT_LENGTH)
168
+ return undefined;
169
+ const text = content.replace(/^\uFEFF/, "").replace(/\r\n/g, "\n");
170
+ if (/[\u0000-\u0009\u000b-\u001f\u007f]/.test(text))
171
+ return undefined;
172
+ const lines = text.split("\n");
173
+ if (lines.length > MAX_LINES)
174
+ return undefined;
175
+ const entries = new Map();
176
+ let hasHeader = false;
177
+ let selectors = [];
178
+ let entry;
179
+ let fields = new Set();
180
+ let section;
181
+ const finish = () => {
182
+ if (!entry)
183
+ return true;
184
+ if (!isExactVersion(entry.version) || !registryResolution(entry.resolved, entry.integrity))
185
+ return false;
186
+ for (const selector of selectors) {
187
+ if (entries.has(selector) || entries.size >= MAX_SELECTORS)
188
+ return false;
189
+ entries.set(selector, entry);
190
+ }
191
+ return true;
192
+ };
193
+ for (const rawLine of lines) {
194
+ if (rawLine.length > MAX_LINE_LENGTH)
195
+ return undefined;
196
+ const line = rawLine.trimEnd();
197
+ if (!line)
198
+ continue;
199
+ if (line.startsWith("#")) {
200
+ if (/^#\s*yarn lockfile\b/.test(line)) {
201
+ if (line !== "# yarn lockfile v1" || hasHeader || entry)
202
+ return undefined;
203
+ hasHeader = true;
204
+ }
205
+ continue;
206
+ }
207
+ if (!hasHeader)
208
+ return undefined;
209
+ const indentation = line.length - line.trimStart().length;
210
+ if (indentation === 0) {
211
+ if (!finish())
212
+ return undefined;
213
+ const parsed = selectorHeader(line);
214
+ if (!parsed)
215
+ return undefined;
216
+ selectors = parsed;
217
+ entry = { version: "", resolved: "", dependencies: new Map(), optionalDependencies: new Map() };
218
+ fields = new Set();
219
+ section = undefined;
220
+ continue;
221
+ }
222
+ if (!entry)
223
+ return undefined;
224
+ if (indentation === 2) {
225
+ const body = line.slice(2);
226
+ const key = tokenAt(body, 0);
227
+ if (!key || fields.has(key.value))
228
+ return undefined;
229
+ fields.add(key.value);
230
+ section = undefined;
231
+ if (key.value === "dependencies" || key.value === "optionalDependencies") {
232
+ if (body.slice(key.end) !== ":")
233
+ return undefined;
234
+ section = key.value;
235
+ continue;
236
+ }
237
+ const scalar = pair(body);
238
+ if (!scalar)
239
+ return undefined;
240
+ if (scalar[0] === "version" || scalar[0] === "resolved")
241
+ entry[scalar[0]] = scalar[1];
242
+ else if (scalar[0] === "integrity") {
243
+ if (!validIntegrity(scalar[1]))
244
+ return undefined;
245
+ entry.integrity = scalar[1].split(" ").sort().join(" ");
246
+ }
247
+ else
248
+ return undefined;
249
+ }
250
+ else if (indentation === 4 && section) {
251
+ const dependency = pair(line.slice(4));
252
+ if (!dependency || !descriptor(...dependency))
253
+ return undefined;
254
+ const [name, request] = dependency;
255
+ if (entry.dependencies.has(name) || entry.optionalDependencies.has(name))
256
+ return undefined;
257
+ entry[section].set(name, request);
258
+ }
259
+ else
260
+ return undefined;
261
+ }
262
+ if (!hasHeader || !finish())
263
+ return undefined;
264
+ // Even an unchanged or unreachable entry with missing dependency data makes the model incomplete.
265
+ for (const entry of new Set(entries.values())) {
266
+ for (const [name, request] of [...entry.dependencies, ...entry.optionalDependencies]) {
267
+ if (!entries.has(`${name}@${request}`))
268
+ return undefined;
269
+ }
270
+ }
271
+ return entries;
272
+ }
273
+ function roots(entries, direct) {
274
+ if (!direct || typeof direct !== "object" || Array.isArray(direct))
275
+ return undefined;
276
+ const prototype = Object.getPrototypeOf(direct);
277
+ if (prototype !== null && prototype !== Object.prototype)
278
+ return undefined;
279
+ const result = [];
280
+ for (const [name, request] of Object.entries(direct)) {
281
+ if (typeof request !== "string")
282
+ return undefined;
283
+ const selector = descriptor(name, request);
284
+ if (!selector || !entries.has(selector))
285
+ return undefined;
286
+ result.push(selector);
287
+ }
288
+ return result;
289
+ }
290
+ function reachable(entries, roots) {
291
+ const seen = new Set();
292
+ const expanded = new Set();
293
+ const queue = [...roots];
294
+ while (queue.length) {
295
+ const selector = queue.pop();
296
+ if (seen.has(selector))
297
+ continue;
298
+ seen.add(selector);
299
+ const entry = entries.get(selector); // roots and all edges were checked before traversal
300
+ if (expanded.has(entry))
301
+ continue;
302
+ expanded.add(entry);
303
+ for (const [name, request] of [...entry.dependencies, ...entry.optionalDependencies]) {
304
+ const dependency = `${name}@${request}`;
305
+ if (!seen.has(dependency))
306
+ queue.push(dependency);
307
+ }
308
+ }
309
+ return seen;
310
+ }
311
+ function fingerprints(entries) {
312
+ const byEntry = new Map();
313
+ const bySelector = new Map();
314
+ const sorted = (dependencies) => [...dependencies].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
315
+ for (const [selector, entry] of entries) {
316
+ let fingerprint = byEntry.get(entry);
317
+ if (fingerprint === undefined) {
318
+ fingerprint = JSON.stringify([entry.version, entry.resolved, entry.integrity ?? null, sorted(entry.dependencies), sorted(entry.optionalDependencies)]);
319
+ byEntry.set(entry, fingerprint);
320
+ }
321
+ bySelector.set(selector, fingerprint);
322
+ }
323
+ return bySelector;
324
+ }
325
+ /**
326
+ * Possible affected direct dependencies, or undefined when full validation must be retained.
327
+ * Exact requests from EACH manifest are required: a root name alone cannot identify its selector.
328
+ * An unchanged selector map returns []; the caller must not clear a manifest dependency edit unless
329
+ * its changed names are covered by the result. No semver resolution or package code is executed.
330
+ */
331
+ export function yarnLockAffectedDependencies(oldContent, newContent, beforeDirect, afterDirect) {
332
+ const before = parse(oldContent);
333
+ const after = parse(newContent);
334
+ if (!before || !after)
335
+ return undefined;
336
+ const oldRoots = roots(before, beforeDirect);
337
+ const newRoots = roots(after, afterDirect);
338
+ if (!oldRoots || !newRoots)
339
+ return undefined;
340
+ const oldFingerprints = fingerprints(before);
341
+ const newFingerprints = fingerprints(after);
342
+ const changed = [...new Set([...before.keys(), ...after.keys()])]
343
+ .filter((selector) => oldFingerprints.get(selector) !== newFingerprints.get(selector));
344
+ if (!changed.length)
345
+ return [];
346
+ const oldReachable = reachable(before, oldRoots);
347
+ const newReachable = reachable(after, newRoots);
348
+ if (changed.some((selector) => !oldReachable.has(selector) && !newReachable.has(selector)))
349
+ return undefined;
350
+ return [...new Set([...Object.keys(beforeDirect), ...Object.keys(afterDirect)])].sort();
351
+ }
352
+ //# sourceMappingURL=yarn-lockfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yarn-lockfile.js","sourceRoot":"","sources":["../../src/repo/yarn-lockfile.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B;;;;;;;;;;;;;;GAcG;AAcH,iGAAiG;AACjG,8FAA8F;AAC9F,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC3C,MAAM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AE,CAAC;IAC/B,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAC7G,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1F,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { spawnSync } from "node:child_process";
2
- import { dirname } from "node:path";
2
+ import { dirname, posix } from "node:path";
3
3
  import {
4
4
  type ChangeType,
5
5
  type ChangedFile,
@@ -10,9 +10,11 @@ import {
10
10
  type GitDeltaSummary,
11
11
  type RepositoryInventory,
12
12
  } from "./types.js";
13
- import { infrastructureRole, testScriptClosure } from "../repo/file-references.js";
13
+ import { infrastructureRole, isImplicitlyLoadedFile, testScriptClosure } from "../repo/file-references.js";
14
14
  import { workflowMayRunTests } from "../repo/workflow-test-steps.js";
15
15
  import { npmLockAffectedDependencies } from "../repo/npm-lockfile.js";
16
+ import { yarnLockAffectedDependencies } from "../repo/yarn-lockfile.js";
17
+ import { LOCKFILE } from "../repo/lockfiles.js";
16
18
 
17
19
  export const EMPTY_TREE_SHA = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
18
20
  export const ZERO_SHA = "0000000000000000000000000000000000000000";
@@ -315,6 +317,27 @@ export function testListEdit(oldBody: string, newBody: string): { added: string[
315
317
 
316
318
  const DEPENDENCY_FIELDS = new Set(["dependencies", "devDependencies", "optionalDependencies"]);
317
319
 
320
+ /** Exact root requests for the supported Classic layout. Unlike scriptRecord, never discard an
321
+ * invalid dependency value: an omitted root would make the lockfile attribution incomplete. */
322
+ function yarnDirectDependencies(content: string | undefined): Record<string, string> | undefined {
323
+ let manifest: Record<string, unknown>;
324
+ try { manifest = JSON.parse(content ?? "") as Record<string, unknown>; } catch { return undefined; }
325
+ if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) return undefined;
326
+ if (["workspaces", "resolutions", "flat", "installConfig", "peerDependencies", "bundledDependencies", "bundleDependencies"].some((field) => manifest[field] !== undefined)) return undefined;
327
+ if (manifest.packageManager !== undefined && (typeof manifest.packageManager !== "string" || !/^yarn@1\.\d+\.\d+$/.test(manifest.packageManager))) return undefined;
328
+ const direct: Record<string, string> = Object.create(null);
329
+ for (const field of DEPENDENCY_FIELDS) {
330
+ const record = manifest[field];
331
+ if (record === undefined) continue;
332
+ if (!record || typeof record !== "object" || Array.isArray(record)) return undefined;
333
+ for (const [name, request] of Object.entries(record)) {
334
+ if (typeof request !== "string" || (Object.hasOwn(direct, name) && direct[name] !== request)) return undefined;
335
+ direct[name] = request;
336
+ }
337
+ }
338
+ return direct;
339
+ }
340
+
318
341
  export interface PackageJsonChange {
319
342
  kind: "metadata" | "data" | "dependencies" | "behavioral";
320
343
  /** Test files a test-list edit added to the test script; they are now part of the suite. */
@@ -399,7 +422,7 @@ export function computeAnalysis(files: ChangedFile[]): GitDeltaAnalysis {
399
422
  const signalPaths: NonNullable<GitDeltaAnalysis["signalPaths"]> = {
400
423
  config: matching((p) => CONFIG_PATTERNS.some((pattern) => pattern.test(p))),
401
424
  dependencyManifest: matching((p) => p === "package.json"),
402
- lockfile: matching((p) => /^(?:package-lock\.json|yarn\.lock|pnpm-lock\.yaml|bun\.lockb)$/.test(p)),
425
+ lockfile: matching((p) => LOCKFILE.test(p)),
403
426
  workflow: matching((p) => p.startsWith(".github/workflows/")),
404
427
  infrastructure: matching((p) => infrastructureRole(p) === "definition"),
405
428
  database: matching((p) => p.startsWith("database/")),
@@ -607,6 +630,39 @@ export async function analyzeGitDelta(
607
630
  }
608
631
  }
609
632
  }
633
+ // Classic does not record peer relationships or the installed hoisting layout. Its helper
634
+ // validates exact manifest requests and widens meaningful changes to every direct dependency.
635
+ // Keep this separate from npm's installed-path model and resolve raw lockfile readers downstream.
636
+ const changedYarnLock = filesWithBinary.find((f) => f.path === "yarn.lock" && f.changeType === "modified");
637
+ // Path-level signals only cover some root configurations. Do not let narrowing this root lock
638
+ // hide a simultaneous nested manifest, lockfile or other configuration change.
639
+ const otherConfiguration = allPaths.some((path) => path !== "yarn.lock" && path !== "package.json" && (
640
+ LOCKFILE.test(posix.basename(path))
641
+ || CONFIG_PATTERNS.some((pattern) => pattern.test(path) || pattern.test(posix.basename(path)))
642
+ || isImplicitlyLoadedFile(path)));
643
+ if (dependencyEdit && changedYarnLock && !otherConfiguration && (!analysis.dependencyManifestChanged || changedPackageJson)) {
644
+ const beforeDirect = yarnDirectDependencies(oldPackageJson);
645
+ const afterDirect = yarnDirectDependencies(newPackageJson);
646
+ // A second package manager or alternate Yarn install layout is outside this model, even when
647
+ // its configuration did not change in this delta.
648
+ const unsupportedLayout = ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "bun.lock", "bun.lockb", ".yarnrc", ".yarnrc.yml", ".pnp.js", ".pnp.cjs"]
649
+ .some((path) => [baseSha, headSha].some((sha) => readFileAtSha(sha, path, repoPath) !== undefined));
650
+ const affected = beforeDirect && afterDirect && !unsupportedLayout
651
+ ? yarnLockAffectedDependencies(readFileAtSha(baseSha, "yarn.lock", repoPath), readFileAtSha(headSha, "yarn.lock", repoPath), beforeDirect, afterDirect)
652
+ : undefined;
653
+ if (affected && (packageChange?.changedDependencies ?? []).every((name) => affected.includes(name))) {
654
+ analysis.dependencyManifestChanged = false;
655
+ analysis.lockfileChanged = false;
656
+ analysis.changedDependencies = affected;
657
+ analysis.dependencyLockfile = "yarn.lock";
658
+ narrowed.add(changedYarnLock);
659
+ if (changedPackageJson) {
660
+ narrowed.add(changedPackageJson);
661
+ if (packageChange!.kind !== "metadata" && !referenceResolvedPaths.includes("package.json")) referenceResolvedPaths.push("package.json");
662
+ if (packageChange!.testScriptAddedPaths.length > 0) analysis.testScriptAddedPaths = packageChange!.testScriptAddedPaths;
663
+ }
664
+ }
665
+ }
610
666
  // 2026-10-21: a workflow that cannot run tests (deploy, publish, scan) cannot change a test
611
667
  // outcome. Both sides of the change are inspected, since removing a test step changes CI too.
612
668
  if (analysis.workflowChanged) {
@@ -47,10 +47,13 @@ export interface GitDeltaAnalysis {
47
47
  /** Test files a package.json test-list edit added to the test script (2026-10-28). They are part of
48
48
  * the suite from this change on, so ImpactAnalyzer selects them. */
49
49
  testScriptAddedPaths?: string[];
50
- /** Direct dependencies whose installed tree changed, when a package.json/package-lock.json change was
51
- * narrowed to them (src/repo/npm-lockfile.ts, 2026-10-28). ImpactAnalyzer selects the tests that
52
- * import each one, and falls back when it cannot. Absent when no such narrowing happened. */
50
+ /** Direct dependencies potentially affected by a modeled manifest/lockfile change. npm uses its
51
+ * installed tree; Classic Yarn includes all roots because its lockfile omits peer relationships.
52
+ * ImpactAnalyzer selects their importers or falls back. Absent when no narrowing happened. */
53
53
  changedDependencies?: string[];
54
+ /** A modeled lockfile whose raw readers must still be resolved, including for semantic no-ops.
55
+ * Its dependency effects are covered by changedDependencies. */
56
+ dependencyLockfile?: "yarn.lock";
54
57
  /** The changed paths behind each flag above, so a fallback reason can name its files (2026-10-21:
55
58
  * "Configuration file(s) changed" was the most frequent reason in both telemetry cohorts and never
56
59
  * said which file). Absent on analyses produced before this field existed. */
@@ -28,6 +28,7 @@
28
28
  */
29
29
 
30
30
  import { posix } from "node:path";
31
+ import { LOCKFILE } from "../repo/lockfiles.js";
31
32
  import type { GateCheck } from "./pipeline-steps.js";
32
33
  import { decideScriptCheck } from "./script-reads.js";
33
34
  import { programMembership, tscProject, type RootTextCache } from "./type-program.js";
@@ -52,7 +53,6 @@ const MAX_FILES = 100;
52
53
  const MAX_COMMAND = 6000;
53
54
  const SAFE_PATH = /^[\w./@+-]+$/;
54
55
  const CODE = /\.(?:[cm]?[jt]sx?|vue|svelte|astro|json5?|d\.ts)$/;
55
- const LOCKFILE = /^(?:package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?)$/;
56
56
 
57
57
  const ESLINT_CONFIG = /^(?:eslint\.config\.[cm]?[jt]s|\.eslintrc(?:\.(?:js|cjs|json|ya?ml))?|\.eslintignore)$/;
58
58
  const PRETTIER_CONFIG = /^(?:\.prettierrc(?:\.(?:json5?|ya?ml|toml|[cm]?[jt]s))?|prettier\.config\.[cm]?[jt]s|\.prettierignore|\.editorconfig)$/;
@@ -29,11 +29,11 @@
29
29
 
30
30
  import { posix } from "node:path";
31
31
  import ts from "typescript";
32
+ import { LOCKFILE } from "../repo/lockfiles.js";
32
33
  import type { NarrowingInput } from "./check-narrowing.js";
33
34
  import type { GateCheck } from "./pipeline-steps.js";
34
35
 
35
36
  const MAX_CLOSURE = 400;
36
- const LOCKFILE = /^(?:package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?)$/;
37
37
  const SCRIPT_FILE = /\.(?:[cm]?js|[cm]?ts|tsx|jsx)$/;
38
38
  const RESOLVE_EXTENSIONS = ["", ".js", ".mjs", ".cjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", "/index.js", "/index.mjs", "/index.ts", "/index.tsx"];
39
39
  const VALUE_FLAGS = new Set(["--import", "-r", "--require", "--loader", "--experimental-loader", "--conditions", "-C", "--env-file", "--tsconfig"]);
@@ -22,10 +22,10 @@
22
22
 
23
23
  import { posix } from "node:path";
24
24
  import { projectRoots } from "../repo/compiled-projects.js";
25
+ import { LOCKFILE } from "../repo/lockfiles.js";
25
26
  import type { NarrowingInput } from "./check-narrowing.js";
26
27
 
27
28
  const CONFIG = /(?:^|\/)(?:tsconfig|jsconfig)[^/]*\.json$/;
28
- const LOCKFILE = /^(?:package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?)$/;
29
29
  const LOADABLE = /\.(?:[cm]?tsx?|[cm]?jsx?|json)$/;
30
30
  const JAVASCRIPT = /\.[cm]?jsx?$/;
31
31
 
@@ -146,6 +146,10 @@ export interface ReferenceResolutionInput {
146
146
  /** Changed files whose content analyzeGitDelta proved cannot change how tests run
147
147
  * (GitDeltaAnalysis.referenceResolvedPaths); a workflow reading them does not block. */
148
148
  contentCleared?: ReadonlySet<string>;
149
+ /** The caller has independently modeled this file's implicit effects (e.g. lockfile dependencies).
150
+ * No explicit reader is then acceptable, but every potential reader must be readable and every
151
+ * reader found must still resolve. Defaults to false. */
152
+ allowNoReaders?: boolean;
149
153
  /** No code in the repository runs a Worker (suiteMayRunWorkers is false), so a wrangler config with
150
154
  * no reader is outside the suite. */
151
155
  workerConfigsOutsideSuite?: boolean;
@@ -412,7 +416,10 @@ export function resolveFileReferences(filePath: string, input: ReferenceResoluti
412
416
  const base = posix.basename(candidate);
413
417
  if (base === "package.json") {
414
418
  const content = read(candidate);
415
- if (content === undefined) continue;
419
+ if (content === undefined) {
420
+ if (input.allowNoReaders) resolution.unresolvable.push(`${candidate} could not be read`);
421
+ continue;
422
+ }
416
423
  const named = packageJsonNames(content, pattern, target.path, ancestors, posix.dirname(candidate));
417
424
  if (named === "no") continue;
418
425
  visited.add(candidate);
@@ -425,6 +432,10 @@ export function resolveFileReferences(filePath: string, input: ReferenceResoluti
425
432
  }
426
433
  if (input.isDocumentation(candidate)) continue;
427
434
  const content = read(candidate);
435
+ if (content === undefined && input.allowNoReaders && (input.isCodeFile(candidate) || DIRECTING_EXTENSIONS.test(candidate) || isImplicitlyLoadedFile(candidate))) {
436
+ resolution.unresolvable.push(`${candidate} could not be read`);
437
+ continue;
438
+ }
428
439
  if (content === undefined || !contentNamesPath(content, candidate, target.path, pattern, ancestors)) continue;
429
440
  visited.add(candidate);
430
441
  if (input.implicitReadersUnresolvable && loadsWithoutNaming(candidate)) {
@@ -468,7 +479,7 @@ export function resolveFileReferences(filePath: string, input: ReferenceResoluti
468
479
  // script or test-feeding workflow step reaches: the suite cannot observe the file. Finding no such
469
480
  // reader at all is different - the file's reader is unknown, so it stays unknown.
470
481
  const executableReaders = resolution.readers.some((reader) => reader.kind === "transitive");
471
- if (resolution.unresolvable.length === 0 && tests.size === 0 && code.size === 0 && !executableReaders && !loadedOnlyOutsideTests(filePath, input, read)) {
482
+ if (resolution.unresolvable.length === 0 && tests.size === 0 && code.size === 0 && !executableReaders && !input.allowNoReaders && !loadedOnlyOutsideTests(filePath, input, read)) {
472
483
  resolution.unresolvable.push(`no test or source file names ${filePath}`);
473
484
  }
474
485
  resolution.phases = resolution.unresolvable.length === 0 ? [...phases].sort() : [];