@diffci.com/diffci 0.3.13 → 0.3.15
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.
- package/LICENSE +20 -661
- package/README.md +1 -1
- package/dist-client/src/client/agent-selection.js +4 -1
- package/dist-client/src/client/cli.js +143 -59
- package/dist-client/src/client/command-batches.js +80 -0
- package/dist-client/src/client/context.js +1 -1
- package/dist-client/src/client/enforce-misses-collect.js +157 -0
- package/dist-client/src/client/enforce-misses.js +229 -0
- package/dist-client/src/client/enforce-policy.js +169 -0
- package/dist-client/src/client/failure-baseline.js +99 -0
- package/dist-client/src/client/feedback-prompt.js +42 -0
- package/dist-client/src/client/mcp.js +1 -1
- package/dist-client/src/client/observe.js +12 -4
- package/dist-client/src/client/pilot-packet.js +0 -31
- package/dist-client/src/client/telemetry.js +46 -0
- package/dist-client/src/client/usage-signal.js +17 -10
- package/dist-client/src/client/verify-savings.js +12 -1
- package/dist-client/src/client/verify.js +81 -9
- package/dist-client/src/client/workflow-templates.js +80 -0
- package/node_modules/@diffci.com/core/README.md +13 -7
- package/node_modules/@diffci.com/core/dist/analyze.js +2 -1
- package/node_modules/@diffci.com/core/dist/analyze.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/cache/graph-cache.d.ts +1 -1
- package/node_modules/@diffci.com/core/dist/cache/graph-cache.js +1 -1
- package/node_modules/@diffci.com/core/dist/git/git-diff.d.ts +9 -0
- package/node_modules/@diffci.com/core/dist/git/git-diff.js +122 -19
- package/node_modules/@diffci.com/core/dist/git/git-diff.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/git/types.d.ts +9 -0
- package/node_modules/@diffci.com/core/dist/planner/test-command.js +16 -3
- package/node_modules/@diffci.com/core/dist/planner/test-command.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/adapters/maven.js +99 -42
- package/node_modules/@diffci.com/core/dist/repo/adapters/maven.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/compiled-projects.d.ts +16 -0
- package/node_modules/@diffci.com/core/dist/repo/compiled-projects.js +101 -0
- package/node_modules/@diffci.com/core/dist/repo/compiled-projects.js.map +1 -0
- package/node_modules/@diffci.com/core/dist/repo/file-references.d.ts +68 -0
- package/node_modules/@diffci.com/core/dist/repo/file-references.js +278 -0
- package/node_modules/@diffci.com/core/dist/repo/file-references.js.map +1 -0
- package/node_modules/@diffci.com/core/dist/repo/graph.d.ts +4 -2
- package/node_modules/@diffci.com/core/dist/repo/graph.js +107 -31
- package/node_modules/@diffci.com/core/dist/repo/graph.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/impact-types.d.ts +7 -1
- package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +32 -0
- package/node_modules/@diffci.com/core/dist/repo/impact.js +241 -20
- package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/runner-universe.js +9 -3
- package/node_modules/@diffci.com/core/dist/repo/runner-universe.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/script-universe.d.ts +16 -0
- package/node_modules/@diffci.com/core/dist/repo/script-universe.js +173 -0
- package/node_modules/@diffci.com/core/dist/repo/script-universe.js.map +1 -0
- package/node_modules/@diffci.com/core/dist/repo/test-discovery.d.ts +12 -0
- package/node_modules/@diffci.com/core/dist/repo/test-discovery.js +54 -7
- package/node_modules/@diffci.com/core/dist/repo/test-discovery.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/types.d.ts +8 -0
- package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.d.ts +15 -0
- package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.js +157 -0
- package/node_modules/@diffci.com/core/dist/repo/workflow-test-steps.js.map +1 -0
- package/node_modules/@diffci.com/core/package.json +5 -0
- package/node_modules/@diffci.com/core/src/analyze.ts +2 -1
- package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +1 -1
- package/node_modules/@diffci.com/core/src/git/git-diff.ts +106 -20
- package/node_modules/@diffci.com/core/src/git/types.ts +9 -0
- package/node_modules/@diffci.com/core/src/planner/test-command.ts +17 -3
- package/node_modules/@diffci.com/core/src/repo/adapters/maven.ts +120 -30
- package/node_modules/@diffci.com/core/src/repo/compiled-projects.ts +108 -0
- package/node_modules/@diffci.com/core/src/repo/file-references.ts +275 -0
- package/node_modules/@diffci.com/core/src/repo/graph.ts +104 -31
- package/node_modules/@diffci.com/core/src/repo/impact-types.ts +10 -0
- package/node_modules/@diffci.com/core/src/repo/impact.ts +243 -18
- package/node_modules/@diffci.com/core/src/repo/runner-universe.ts +6 -3
- package/node_modules/@diffci.com/core/src/repo/script-universe.ts +158 -0
- package/node_modules/@diffci.com/core/src/repo/test-discovery.ts +62 -7
- package/node_modules/@diffci.com/core/src/repo/types.ts +5 -0
- package/node_modules/@diffci.com/core/src/repo/workflow-test-steps.ts +117 -0
- package/package.json +6 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maven.js","sourceRoot":"","sources":["../../../src/repo/adapters/maven.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"maven.js","sourceRoot":"","sources":["../../../src/repo/adapters/maven.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAyE,MAAM,YAAY,CAAC;AAajH,SAAS,IAAI,CAAC,GAAW,EAAE,IAAY;IACrC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,IAAI,IAAI,4BAA4B,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC;IACxE,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAAE,GAAG,CAAC,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,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;IAC/F,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU;IAC3C,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtH,OAAO,EAAE,YAAY;CACtB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface CompiledProjectInput {
|
|
2
|
+
files: readonly string[];
|
|
3
|
+
read: (path: string) => string | undefined;
|
|
4
|
+
isTestFile: (path: string) => boolean;
|
|
5
|
+
/** Every file a root transitively imports, from the dependency graph. */
|
|
6
|
+
dependenciesOf: (path: string) => readonly string[];
|
|
7
|
+
}
|
|
8
|
+
export interface CompiledProject {
|
|
9
|
+
config: string;
|
|
10
|
+
tests: string[];
|
|
11
|
+
files: ReadonlySet<string>;
|
|
12
|
+
}
|
|
13
|
+
/** Root files of a project, as tsc would list them before following imports. */
|
|
14
|
+
export declare function projectRoots(config: string, input: Pick<CompiledProjectInput, "files" | "read">): string[] | undefined;
|
|
15
|
+
/** Projects that some test compiles, with the tests and every file each compiles. */
|
|
16
|
+
export declare function compiledProjects(input: CompiledProjectInput): CompiledProject[];
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* Tests that observe code by compiling it (2026-10-21).
|
|
4
|
+
*
|
|
5
|
+
* WHY. A test can check a TypeScript project without importing any of it, by running the compiler on
|
|
6
|
+
* a named project and then executing the output: `execFileSync(node, [".../typescript/bin/tsc", "-p",
|
|
7
|
+
* "tsconfig.client.json"])`, then spawning the built CLI. The dependency graph has no edge from such a
|
|
8
|
+
* test to the files it compiles, so a change that breaks the build selected nothing that would notice.
|
|
9
|
+
* Replaying a dogfood repository's history found exactly this: a change to `src/client/cli.ts`
|
|
10
|
+
* selected 117 tests and left out the one that builds and runs the CLI.
|
|
11
|
+
*
|
|
12
|
+
* THE RULE. A test that both invokes the compiler (tsc, typescript/bin/tsc, createProgram, --project)
|
|
13
|
+
* and names a `tsconfig*.json` that exists at HEAD compiles that project. The project is its root files
|
|
14
|
+
* (`files`, `include` and `exclude`, inherited through `extends` when absent) and everything those
|
|
15
|
+
* roots import, which is what tsc compiles too. A change to any of those files selects the test.
|
|
16
|
+
*
|
|
17
|
+
* Over-inclusion is the safe direction: a test that merely writes a tsconfig.json fixture and calls
|
|
18
|
+
* createProgram on a temporary repository is also treated as compiling the real project.
|
|
19
|
+
*/
|
|
20
|
+
import { posix } from "node:path";
|
|
21
|
+
import ts from "typescript";
|
|
22
|
+
import { referencePattern, referenceTokens } from "./file-references.js";
|
|
23
|
+
import { matchesGlob } from "./test-discovery.js";
|
|
24
|
+
const COMPILER_INVOCATION = /["'`/\s]tsc(?:\.cmd)?["'`\s]|typescript["'`/,\s]+bin["'`/,\s]+tsc|\bcreateProgram\b|--project\b|["'`]-p["'`]/;
|
|
25
|
+
const PROJECT_CONFIG = /(?:^|\/)tsconfig[^/]*\.json$/;
|
|
26
|
+
const COMPILABLE = /\.(?:[cm]?tsx?|[cm]?jsx?)$/;
|
|
27
|
+
function readSpec(config, read, depth = 0) {
|
|
28
|
+
const text = read(config);
|
|
29
|
+
if (text === undefined || depth > 5)
|
|
30
|
+
return undefined;
|
|
31
|
+
const parsed = ts.parseConfigFileTextToJson(config, text);
|
|
32
|
+
if (parsed.error || !parsed.config || typeof parsed.config !== "object")
|
|
33
|
+
return undefined;
|
|
34
|
+
const json = parsed.config;
|
|
35
|
+
const dir = posix.dirname(config);
|
|
36
|
+
const local = (values) => Array.isArray(values) ? values.filter((v) => typeof v === "string").map((v) => posix.normalize(posix.join(dir, v))) : undefined;
|
|
37
|
+
let spec = { files: local(json.files), include: local(json.include), exclude: local(json.exclude), allowJs: json.compilerOptions?.allowJs === true ? true : undefined };
|
|
38
|
+
const parents = typeof json.extends === "string" ? [json.extends] : Array.isArray(json.extends) ? json.extends.filter((e) => typeof e === "string") : [];
|
|
39
|
+
for (const parent of parents) {
|
|
40
|
+
if (!parent.startsWith("."))
|
|
41
|
+
continue;
|
|
42
|
+
const parentPath = posix.normalize(posix.join(dir, parent.endsWith(".json") ? parent : `${parent}.json`));
|
|
43
|
+
const inherited = readSpec(parentPath, read, depth + 1);
|
|
44
|
+
if (!inherited)
|
|
45
|
+
continue;
|
|
46
|
+
spec = { files: spec.files ?? inherited.files, include: spec.include ?? inherited.include, exclude: spec.exclude ?? inherited.exclude, allowJs: spec.allowJs ?? inherited.allowJs };
|
|
47
|
+
}
|
|
48
|
+
return spec;
|
|
49
|
+
}
|
|
50
|
+
function asGlob(pattern) {
|
|
51
|
+
if (/[*?]/.test(pattern) || posix.extname(pattern))
|
|
52
|
+
return pattern;
|
|
53
|
+
return `${pattern.replace(/\/$/, "")}/**/*`;
|
|
54
|
+
}
|
|
55
|
+
/** Root files of a project, as tsc would list them before following imports. */
|
|
56
|
+
export function projectRoots(config, input) {
|
|
57
|
+
const spec = readSpec(config, input.read);
|
|
58
|
+
if (!spec)
|
|
59
|
+
return undefined;
|
|
60
|
+
const dir = posix.dirname(config);
|
|
61
|
+
const roots = new Set(spec.files ?? []);
|
|
62
|
+
const include = spec.include ?? (spec.files ? [] : [posix.join(dir, "**/*")]);
|
|
63
|
+
const exclude = (spec.exclude ?? []).map(asGlob);
|
|
64
|
+
const extensions = spec.allowJs ? COMPILABLE : /\.(?:[cm]?tsx?)$/;
|
|
65
|
+
for (const pattern of include.map(asGlob)) {
|
|
66
|
+
for (const file of input.files) {
|
|
67
|
+
if (!extensions.test(file) || file.endsWith(".d.ts") || file.split("/").includes("node_modules"))
|
|
68
|
+
continue;
|
|
69
|
+
if (matchesGlob(file, pattern) && !exclude.some((glob) => matchesGlob(file, glob)))
|
|
70
|
+
roots.add(file);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return [...roots].sort();
|
|
74
|
+
}
|
|
75
|
+
/** Projects that some test compiles, with the tests and every file each compiles. */
|
|
76
|
+
export function compiledProjects(input) {
|
|
77
|
+
const configs = input.files.filter((file) => PROJECT_CONFIG.test(file));
|
|
78
|
+
if (configs.length === 0)
|
|
79
|
+
return [];
|
|
80
|
+
const compilingTests = input.files.filter((file) => input.isTestFile(file) && COMPILABLE.test(file))
|
|
81
|
+
.map((file) => ({ file, text: input.read(file) ?? "" }))
|
|
82
|
+
.filter(({ text }) => COMPILER_INVOCATION.test(text));
|
|
83
|
+
const projects = [];
|
|
84
|
+
for (const config of configs) {
|
|
85
|
+
const names = referencePattern(referenceTokens(config, { ancestors: false }));
|
|
86
|
+
const tests = compilingTests.filter(({ text }) => names.test(text)).map(({ file }) => file);
|
|
87
|
+
if (tests.length === 0)
|
|
88
|
+
continue;
|
|
89
|
+
const roots = projectRoots(config, input);
|
|
90
|
+
if (!roots)
|
|
91
|
+
continue;
|
|
92
|
+
const files = new Set(roots);
|
|
93
|
+
for (const root of roots)
|
|
94
|
+
for (const dependency of input.dependenciesOf(root))
|
|
95
|
+
files.add(dependency);
|
|
96
|
+
files.add(config);
|
|
97
|
+
projects.push({ config, tests: tests.sort(), files });
|
|
98
|
+
}
|
|
99
|
+
return projects;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=compiled-projects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiled-projects.js","sourceRoot":"","sources":["../../src/repo/compiled-projects.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OA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M,KAAK,GAAG,gBAAgB,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9E,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QAC5F,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACjC,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,KAAK,CAAC,CAAC;QACrC,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC;gBAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAClB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Reads repo-relative text files from a checkout at HEAD, the same tree the dependency graph reads.
|
|
2
|
+
* Binary content (a NUL byte in the first 8 KiB) and files over 1 MiB are unreadable. */
|
|
3
|
+
export declare function repositoryFileReader(repoPath: string): (path: string) => string | undefined;
|
|
4
|
+
/** True when tooling may load `filePath` implicitly, so no reference to it would ever be written. */
|
|
5
|
+
export declare function isImplicitlyLoadedFile(filePath: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* What a file under an infrastructure directory is (2026-10-21). Everything under `ops/` used to force
|
|
8
|
+
* full validation - 55 of one dogfood repository's 124 receipts - yet that tree holds tested Worker code, runbooks
|
|
9
|
+
* and JSON evidence manifests as well as deployment definitions. Only a definition that tooling loads by
|
|
10
|
+
* convention is global; code goes through the dependency graph, Markdown is documentation, and other
|
|
11
|
+
* files are data whose readers are resolved by reference. `undefined` outside infrastructure trees.
|
|
12
|
+
*/
|
|
13
|
+
export declare function infrastructureRole(filePath: string): "definition" | "code" | "documentation" | "data" | undefined;
|
|
14
|
+
interface ReferenceToken {
|
|
15
|
+
value: string;
|
|
16
|
+
bare: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** The strings whose appearance means a file names `filePath`: the path itself, its basename, and every
|
|
19
|
+
* ancestor directory (as a path and as a name). A bare name (no dot, no slash) must be delimited by
|
|
20
|
+
* quotes or slashes on both sides, so prose and identifiers do not match; anything else may also be
|
|
21
|
+
* delimited by whitespace, as in a shell command line.
|
|
22
|
+
*
|
|
23
|
+
* `ancestors: false` drops the directories. A script is run by naming it, so following who runs a code
|
|
24
|
+
* reader needs only its path and basename; in one dogfood repository the bare `"scripts"` matched nearly every
|
|
25
|
+
* file and no change under `site/` could ever resolve (2026-10-21 replay). */
|
|
26
|
+
export declare function referenceTokens(filePath: string, { ancestors }?: {
|
|
27
|
+
ancestors?: boolean;
|
|
28
|
+
}): ReferenceToken[];
|
|
29
|
+
/** One regular expression matching any of `tokens` at a reference boundary. */
|
|
30
|
+
export declare function referencePattern(tokens: readonly ReferenceToken[]): RegExp;
|
|
31
|
+
export type ReaderKind = "test" | "graph-code" | "package-script" | "documentation" | "transitive" | "unresolvable";
|
|
32
|
+
export interface ReferenceResolutionInput {
|
|
33
|
+
/** Repo-relative paths present at HEAD. */
|
|
34
|
+
files: readonly string[];
|
|
35
|
+
/** Reads a repo-relative file at HEAD; undefined for unreadable, binary or oversized content. */
|
|
36
|
+
read: (path: string) => string | undefined;
|
|
37
|
+
isTestFile: (path: string) => boolean;
|
|
38
|
+
isDocumentation: (path: string) => boolean;
|
|
39
|
+
/** Whether a code file is part of the dependency graph. */
|
|
40
|
+
inGraph: (path: string) => boolean;
|
|
41
|
+
isCodeFile: (path: string) => boolean;
|
|
42
|
+
/** Whether something a workflow names can reach the test suite through it, given a pattern matching
|
|
43
|
+
* the name (src/repo/workflow-test-steps.ts, workflowFeedsTests). */
|
|
44
|
+
workflowFeedsTests: (content: string, names: RegExp) => boolean;
|
|
45
|
+
/** Changed files whose content analyzeGitDelta proved cannot change how tests run
|
|
46
|
+
* (GitDeltaAnalysis.referenceResolvedPaths); a workflow reading them does not block. */
|
|
47
|
+
contentCleared?: ReadonlySet<string>;
|
|
48
|
+
}
|
|
49
|
+
export interface ReferenceResolution {
|
|
50
|
+
/** Tests that name the file, directly or through a chain of non-code readers. */
|
|
51
|
+
tests: string[];
|
|
52
|
+
/** Graph code that names the file; its dependent tests are selected by the caller. */
|
|
53
|
+
code: string[];
|
|
54
|
+
/** Why the file cannot be narrowed; empty when it can. */
|
|
55
|
+
unresolvable: string[];
|
|
56
|
+
/** Every reader found, for evidence. */
|
|
57
|
+
readers: Array<{
|
|
58
|
+
path: string;
|
|
59
|
+
kind: ReaderKind;
|
|
60
|
+
via: string;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
/** Script names reachable from `npm test`, including lifecycle hooks and any script one of those bodies
|
|
64
|
+
* names. Over-inclusive by design: a script name appearing anywhere in a reachable body is followed. */
|
|
65
|
+
export declare function testScriptClosure(scripts: Readonly<Record<string, string>>): Set<string>;
|
|
66
|
+
/** Resolves who reads `filePath`. See the module comment for the rule and its limits. */
|
|
67
|
+
export declare function resolveFileReferences(filePath: string, input: ReferenceResolutionInput): ReferenceResolution;
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* Who reads this file? (2026-10-21, telemetry from two dogfood repositories.)
|
|
4
|
+
*
|
|
5
|
+
* WHY. A changed file that is not code - `site/docs/x.html`, `scripts/train.py`, `ops/.../blockers.json`,
|
|
6
|
+
* `.env.example` - previously meant "Unknown changed file" and a full run. Across 256 verification
|
|
7
|
+
* receipts this was the third most common fallback (76 receipts), and 138 of one repository's unknown files
|
|
8
|
+
* were site HTML whose only readers are two tests. The engine has no import edge for these, because tests
|
|
9
|
+
* reach them through the filesystem: `readFileSync(join(root, "site", ...))`, `readdirSync("fixtures")`,
|
|
10
|
+
* `spawn("python3", ["scripts/train.py"])`.
|
|
11
|
+
*
|
|
12
|
+
* THE RULE. A test suite can only observe a non-code file by naming it, or by naming a directory that
|
|
13
|
+
* contains it. So: collect every text file at HEAD that names the changed file's path, its basename, or
|
|
14
|
+
* one of its ancestor directories as a string, and resolve each reader:
|
|
15
|
+
*
|
|
16
|
+
* - a test reader is selected;
|
|
17
|
+
* - a code reader in the dependency graph selects the tests that depend on it;
|
|
18
|
+
* - a package.json reader counts only when the naming script runs as part of `npm test`;
|
|
19
|
+
* - a test-running workflow, a composite action or an unparseable package.json is unresolvable;
|
|
20
|
+
* - documentation names files constantly and executes nothing, so it is never a reader;
|
|
21
|
+
* - any other file - a shell script, a JSON manifest, or code no test imports (a standalone check
|
|
22
|
+
* script outside the dependency graph) - may itself be executed or read, so ITS readers are
|
|
23
|
+
* resolved in turn, to a bounded depth. A test can only run such a file by naming it.
|
|
24
|
+
*
|
|
25
|
+
* FAILING CLOSED. No reader at all, or any unresolvable reader, keeps the file unknown (full run).
|
|
26
|
+
* Evidence of who reads a file is required before anything narrows; the absence of a reference is never
|
|
27
|
+
* treated as proof that nothing reads it. Files that tools load implicitly, without any code naming them
|
|
28
|
+
* (`.gitignore`, `.env`, `tsconfig.json`, `wrangler.toml`, `Dockerfile`), never reach this resolver.
|
|
29
|
+
*
|
|
30
|
+
* RESIDUAL RISK. A reader that computes the path from parts that never appear as strings, or walks the
|
|
31
|
+
* whole repository from its root without naming a directory, is invisible here. Required CI stays
|
|
32
|
+
* authoritative for exactly that reason.
|
|
33
|
+
*/
|
|
34
|
+
import { readFileSync, statSync } from "node:fs";
|
|
35
|
+
import { join, posix } from "node:path";
|
|
36
|
+
const MAX_READ_BYTES = 1_048_576;
|
|
37
|
+
/** Reads repo-relative text files from a checkout at HEAD, the same tree the dependency graph reads.
|
|
38
|
+
* Binary content (a NUL byte in the first 8 KiB) and files over 1 MiB are unreadable. */
|
|
39
|
+
export function repositoryFileReader(repoPath) {
|
|
40
|
+
return (path) => {
|
|
41
|
+
try {
|
|
42
|
+
const full = join(repoPath, path);
|
|
43
|
+
if (statSync(full).size > MAX_READ_BYTES)
|
|
44
|
+
return undefined;
|
|
45
|
+
const bytes = readFileSync(full);
|
|
46
|
+
if (bytes.subarray(0, 8192).includes(0))
|
|
47
|
+
return undefined;
|
|
48
|
+
return bytes.toString("utf8");
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Names tools read without any code naming them. A change to one of these is never reference-resolved. */
|
|
56
|
+
const IMPLICIT_BASENAMES = new Set([
|
|
57
|
+
".gitignore", ".gitattributes", ".gitmodules", ".npmrc", ".yarnrc", ".yarnrc.yml", ".nvmrc", ".node-version",
|
|
58
|
+
".tool-versions", ".editorconfig", ".browserslistrc", ".babelrc", ".swcrc", ".mocharc", ".c8rc", ".nycrc",
|
|
59
|
+
"makefile", "procfile", "justfile", "taskfile.yml", "compose.yaml", "compose.yml", "turbo.json", "nx.json", "lerna.json",
|
|
60
|
+
]);
|
|
61
|
+
const IMPLICIT_PREFIXES = ["tsconfig", "jsconfig", "wrangler.", "dockerfile", "docker-compose", ".dockerignore", ".mocharc.", ".c8rc.", ".nycrc.", "babel.config", ".babelrc."];
|
|
62
|
+
const ENV_TEMPLATE_SUFFIX = /\.(?:example|sample|template|dist)$/;
|
|
63
|
+
/** True when tooling may load `filePath` implicitly, so no reference to it would ever be written. */
|
|
64
|
+
export function isImplicitlyLoadedFile(filePath) {
|
|
65
|
+
const base = posix.basename(filePath).toLowerCase();
|
|
66
|
+
if (IMPLICIT_BASENAMES.has(base))
|
|
67
|
+
return true;
|
|
68
|
+
if (IMPLICIT_PREFIXES.some((prefix) => base.startsWith(prefix)))
|
|
69
|
+
return true;
|
|
70
|
+
if (/\.config\.[^.]+$/.test(base))
|
|
71
|
+
return true;
|
|
72
|
+
if (base === ".env" || (base.startsWith(".env.") && !ENV_TEMPLATE_SUFFIX.test(base)))
|
|
73
|
+
return true;
|
|
74
|
+
return /\.(?:tf|tfvars|hcl)$/.test(base);
|
|
75
|
+
}
|
|
76
|
+
const INFRASTRUCTURE_DIRS = new Set(["ops", "terraform", "cloudformation", "pulumi", "cdktf", "deploy", "deployments", "kubernetes", "k8s", "helm", "docker"]);
|
|
77
|
+
const CODE_EXTENSIONS = /\.(?:[cm]?[jt]sx?|vue|go|java|kt)$/i;
|
|
78
|
+
const DOCUMENT_EXTENSIONS = /\.(?:md|mdx)$/i;
|
|
79
|
+
/**
|
|
80
|
+
* What a file under an infrastructure directory is (2026-10-21). Everything under `ops/` used to force
|
|
81
|
+
* full validation - 55 of one dogfood repository's 124 receipts - yet that tree holds tested Worker code, runbooks
|
|
82
|
+
* and JSON evidence manifests as well as deployment definitions. Only a definition that tooling loads by
|
|
83
|
+
* convention is global; code goes through the dependency graph, Markdown is documentation, and other
|
|
84
|
+
* files are data whose readers are resolved by reference. `undefined` outside infrastructure trees.
|
|
85
|
+
*/
|
|
86
|
+
export function infrastructureRole(filePath) {
|
|
87
|
+
const base = posix.basename(filePath);
|
|
88
|
+
if (/dockerfile/i.test(base))
|
|
89
|
+
return "definition";
|
|
90
|
+
const first = filePath.split("/")[0];
|
|
91
|
+
if (!first || !INFRASTRUCTURE_DIRS.has(first) || !filePath.includes("/"))
|
|
92
|
+
return undefined;
|
|
93
|
+
if (isImplicitlyLoadedFile(filePath))
|
|
94
|
+
return "definition";
|
|
95
|
+
if (CODE_EXTENSIONS.test(base))
|
|
96
|
+
return "code";
|
|
97
|
+
if (DOCUMENT_EXTENSIONS.test(base))
|
|
98
|
+
return "documentation";
|
|
99
|
+
return "data";
|
|
100
|
+
}
|
|
101
|
+
/** The strings whose appearance means a file names `filePath`: the path itself, its basename, and every
|
|
102
|
+
* ancestor directory (as a path and as a name). A bare name (no dot, no slash) must be delimited by
|
|
103
|
+
* quotes or slashes on both sides, so prose and identifiers do not match; anything else may also be
|
|
104
|
+
* delimited by whitespace, as in a shell command line.
|
|
105
|
+
*
|
|
106
|
+
* `ancestors: false` drops the directories. A script is run by naming it, so following who runs a code
|
|
107
|
+
* reader needs only its path and basename; in one dogfood repository the bare `"scripts"` matched nearly every
|
|
108
|
+
* file and no change under `site/` could ever resolve (2026-10-21 replay). */
|
|
109
|
+
export function referenceTokens(filePath, { ancestors = true } = {}) {
|
|
110
|
+
const tokens = new Map();
|
|
111
|
+
const add = (value) => { if (value && value !== ".")
|
|
112
|
+
tokens.set(value, { value, bare: !/[./]/.test(value) }); };
|
|
113
|
+
add(filePath);
|
|
114
|
+
add(posix.basename(filePath));
|
|
115
|
+
let dir = posix.dirname(filePath);
|
|
116
|
+
while (ancestors && dir !== "." && dir !== "/") {
|
|
117
|
+
add(dir);
|
|
118
|
+
add(posix.basename(dir));
|
|
119
|
+
dir = posix.dirname(dir);
|
|
120
|
+
}
|
|
121
|
+
return [...tokens.values()];
|
|
122
|
+
}
|
|
123
|
+
function escape(value) { return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); }
|
|
124
|
+
/** One regular expression matching any of `tokens` at a reference boundary. */
|
|
125
|
+
export function referencePattern(tokens) {
|
|
126
|
+
const parts = tokens.map(({ value, bare }) => bare
|
|
127
|
+
? `["'\`/]${escape(value)}(?=["'\`/])`
|
|
128
|
+
: `(?:^|["'\`/\\s=(])${escape(value)}(?=$|["'\`/\\s),;:])`);
|
|
129
|
+
return new RegExp(parts.join("|"), "m");
|
|
130
|
+
}
|
|
131
|
+
const MAX_DEPTH = 5;
|
|
132
|
+
const MAX_TRANSITIVE_READERS = 50;
|
|
133
|
+
const LOCKFILES = new Set(["package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lock", "bun.lockb", "npm-shrinkwrap.json"]);
|
|
134
|
+
const TEST_LIFECYCLE = ["pretest", "test", "posttest", "prepare", "preinstall", "install", "postinstall"];
|
|
135
|
+
/** Non-code files that can run something or direct what code reads: shell and interpreter scripts,
|
|
136
|
+
* and structured manifests. Only these are followed to their own readers. */
|
|
137
|
+
const DIRECTING_EXTENSIONS = /\.(?:sh|bash|zsh|ps1|psm1|bat|cmd|py|rb|pl|json|jsonc|json5|ya?ml|toml|ini|cfg|conf)$/i;
|
|
138
|
+
/** Script names reachable from `npm test`, including lifecycle hooks and any script one of those bodies
|
|
139
|
+
* names. Over-inclusive by design: a script name appearing anywhere in a reachable body is followed. */
|
|
140
|
+
export function testScriptClosure(scripts) {
|
|
141
|
+
const closure = new Set();
|
|
142
|
+
const queue = TEST_LIFECYCLE.filter((name) => typeof scripts[name] === "string");
|
|
143
|
+
while (queue.length > 0) {
|
|
144
|
+
const name = queue.shift();
|
|
145
|
+
if (closure.has(name))
|
|
146
|
+
continue;
|
|
147
|
+
closure.add(name);
|
|
148
|
+
for (const hook of [`pre${name}`, `post${name}`])
|
|
149
|
+
if (typeof scripts[hook] === "string")
|
|
150
|
+
queue.push(hook);
|
|
151
|
+
const body = scripts[name] ?? "";
|
|
152
|
+
for (const candidate of Object.keys(scripts)) {
|
|
153
|
+
if (!closure.has(candidate) && new RegExp(`(?:^|[\\s"'=&|;(])${escape(candidate)}(?=$|[\\s"'&|;)])`).test(body))
|
|
154
|
+
queue.push(candidate);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return closure;
|
|
158
|
+
}
|
|
159
|
+
function packageJsonNames(content, pattern) {
|
|
160
|
+
let parsed;
|
|
161
|
+
try {
|
|
162
|
+
parsed = JSON.parse(content);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return "unparseable";
|
|
166
|
+
}
|
|
167
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
168
|
+
return "unparseable";
|
|
169
|
+
const scripts = parsed.scripts;
|
|
170
|
+
if (!scripts || typeof scripts !== "object")
|
|
171
|
+
return "no";
|
|
172
|
+
const record = Object.fromEntries(Object.entries(scripts).filter((entry) => typeof entry[1] === "string"));
|
|
173
|
+
for (const name of testScriptClosure(record))
|
|
174
|
+
if (pattern.test(record[name] ?? ""))
|
|
175
|
+
return "yes";
|
|
176
|
+
return "no";
|
|
177
|
+
}
|
|
178
|
+
/** Resolves who reads `filePath`. See the module comment for the rule and its limits. */
|
|
179
|
+
export function resolveFileReferences(filePath, input) {
|
|
180
|
+
const resolution = { tests: [], code: [], unresolvable: [], readers: [] };
|
|
181
|
+
const tests = new Set();
|
|
182
|
+
const code = new Set();
|
|
183
|
+
const visited = new Set([filePath]);
|
|
184
|
+
let frontier = [{ path: filePath, via: filePath }];
|
|
185
|
+
let transitiveCount = 0;
|
|
186
|
+
const contents = new Map();
|
|
187
|
+
const read = (path) => { if (!contents.has(path))
|
|
188
|
+
contents.set(path, input.read(path)); return contents.get(path); };
|
|
189
|
+
for (let depth = 0; depth < MAX_DEPTH && frontier.length > 0; depth++) {
|
|
190
|
+
const next = [];
|
|
191
|
+
for (const target of frontier) {
|
|
192
|
+
// Directories are matched only for the changed file itself, which a test may find by listing its
|
|
193
|
+
// directory. A reader reached through the changed file (a script, a manifest) matters only if
|
|
194
|
+
// something runs or reads it by name; matching its directories as well made `"tests"` and
|
|
195
|
+
// `"fixtures"` match nearly every file and no generic name (package.json) could resolve.
|
|
196
|
+
const pattern = referencePattern(referenceTokens(target.path, { ancestors: target.path === filePath }));
|
|
197
|
+
for (const candidate of input.files) {
|
|
198
|
+
if (visited.has(candidate) || candidate === target.path || LOCKFILES.has(posix.basename(candidate)))
|
|
199
|
+
continue;
|
|
200
|
+
const base = posix.basename(candidate);
|
|
201
|
+
if (base === "package.json") {
|
|
202
|
+
const content = read(candidate);
|
|
203
|
+
if (content === undefined)
|
|
204
|
+
continue;
|
|
205
|
+
const named = packageJsonNames(content, pattern);
|
|
206
|
+
if (named === "no")
|
|
207
|
+
continue;
|
|
208
|
+
visited.add(candidate);
|
|
209
|
+
if (named === "unparseable") {
|
|
210
|
+
resolution.unresolvable.push(`${candidate} could not be parsed`);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
resolution.readers.push({ path: candidate, kind: "package-script", via: target.path });
|
|
214
|
+
resolution.unresolvable.push(`${candidate} runs ${target.path} as part of its test script`);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (input.isDocumentation(candidate))
|
|
218
|
+
continue;
|
|
219
|
+
const content = read(candidate);
|
|
220
|
+
if (content === undefined || !pattern.test(content))
|
|
221
|
+
continue;
|
|
222
|
+
visited.add(candidate);
|
|
223
|
+
if (candidate.startsWith(".github/")) {
|
|
224
|
+
// A workflow step that comes before a test step in its job, or a composite action, may feed
|
|
225
|
+
// the file to the suite's environment; issue templates and standalone CI checks do not.
|
|
226
|
+
// A change content inspection already showed cannot alter how tests run (a version bump)
|
|
227
|
+
// stays that way when a workflow reads the file.
|
|
228
|
+
const executes = candidate.startsWith(".github/actions/")
|
|
229
|
+
|| (/^\.github\/workflows\//.test(candidate) && !input.contentCleared?.has(target.path) && input.workflowFeedsTests(content, pattern));
|
|
230
|
+
if (!executes)
|
|
231
|
+
continue;
|
|
232
|
+
resolution.readers.push({ path: candidate, kind: "unresolvable", via: target.path });
|
|
233
|
+
resolution.unresolvable.push(`${candidate} names ${target.path}`);
|
|
234
|
+
}
|
|
235
|
+
else if (input.isCodeFile(candidate) && input.isTestFile(candidate)) {
|
|
236
|
+
resolution.readers.push({ path: candidate, kind: "test", via: target.path });
|
|
237
|
+
tests.add(candidate);
|
|
238
|
+
}
|
|
239
|
+
else if (input.isCodeFile(candidate) && input.inGraph(candidate)) {
|
|
240
|
+
resolution.readers.push({ path: candidate, kind: "graph-code", via: target.path });
|
|
241
|
+
code.add(candidate);
|
|
242
|
+
}
|
|
243
|
+
else if (input.isCodeFile(candidate) || DIRECTING_EXTENSIONS.test(candidate)) {
|
|
244
|
+
resolution.readers.push({ path: candidate, kind: "transitive", via: target.path });
|
|
245
|
+
if (++transitiveCount > MAX_TRANSITIVE_READERS) {
|
|
246
|
+
resolution.unresolvable.push(`more than ${MAX_TRANSITIVE_READERS} non-code files name ${filePath}`);
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
next.push({ path: candidate, via: target.path });
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
// Markup, prose, images and licences name paths in links and URLs but execute nothing and
|
|
253
|
+
// direct no reads, so nothing reaches the suite through them.
|
|
254
|
+
resolution.readers.push({ path: candidate, kind: "documentation", via: target.path });
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (resolution.unresolvable.length > 0)
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
if (resolution.unresolvable.length > 0)
|
|
261
|
+
break;
|
|
262
|
+
frontier = next;
|
|
263
|
+
}
|
|
264
|
+
if (resolution.unresolvable.length === 0 && frontier.length > 0) {
|
|
265
|
+
resolution.unresolvable.push(`reference chain from ${filePath} is deeper than ${MAX_DEPTH} files`);
|
|
266
|
+
}
|
|
267
|
+
// Found readers that something could run (check scripts, manifests), none of which any test, test
|
|
268
|
+
// script or test-feeding workflow step reaches: the suite cannot observe the file. Finding no such
|
|
269
|
+
// reader at all is different - the file's reader is unknown, so it stays unknown.
|
|
270
|
+
const executableReaders = resolution.readers.some((reader) => reader.kind === "transitive");
|
|
271
|
+
if (resolution.unresolvable.length === 0 && tests.size === 0 && code.size === 0 && !executableReaders) {
|
|
272
|
+
resolution.unresolvable.push(`no test or source file names ${filePath}`);
|
|
273
|
+
}
|
|
274
|
+
resolution.tests = [...tests].sort();
|
|
275
|
+
resolution.code = [...code].sort();
|
|
276
|
+
return resolution;
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=file-references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-references.js","sourceRoot":"","sources":["../../src/repo/file-references.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,cAAc,GAAG,SAAS,CAAC;AAEjC;yFACyF;AACzF,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAClC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,cAAc;gBAAE,OAAO,SAAS,CAAC;YAC3D,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;YACjC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAAE,OAAO,SAAS,CAAC;YAC1D,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,2GAA2G;AAC3G,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe;IAC5G,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ;IACzG,UAAU,EAAE,UAAU,EAAE,UA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C,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IACrC,UAAU,CAAC,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACnC,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -51,14 +51,16 @@ export declare function validateDependencyGraph(graph: DependencyGraph): GraphIn
|
|
|
51
51
|
* graph for EVERY delta, for as long as that one file's import stays unresolved, regardless of whether
|
|
52
52
|
* the delta being analyzed has anything to do with it.
|
|
53
53
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
54
|
+
* For static unresolved references, this narrows that: an unresolved import makes THIS delta's
|
|
55
|
+
* confidence untrustworthy if its importer is actually reachable from the changed files (in either
|
|
56
56
|
* direction - the changed file might depend on the incomplete file, or something reachable from the
|
|
57
57
|
* changed file might). If none of the graph's unresolved imports are anywhere near this delta, the
|
|
58
58
|
* graph's real incompleteness elsewhere cannot plausibly affect what can safely be determined about
|
|
59
59
|
* THIS specific change.
|
|
60
60
|
*
|
|
61
61
|
* Deliberately NOT narrowed - these remain hard, global blockers regardless of the delta:
|
|
62
|
+
* - Unresolved runtime imports/requires: a computed target has no known graph edge, so lack of
|
|
63
|
+
* reachability cannot establish that it does not load one of the changed files.
|
|
62
64
|
* - `sourceFileCount === 0` (an empty graph gives no reachability information to reason about at all).
|
|
63
65
|
* - `integrity.criticalCount > 0` (the graph's own internal structure is broken - a construction bug,
|
|
64
66
|
* not a property of any one file, so no delta-specific narrowing is meaningful).
|