@diffci.com/diffci 0.3.51 → 0.3.53
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/dist-client/src/client/context.d.ts +3 -1
- package/dist-client/src/client/context.js +83 -2
- package/dist-client/src/client/mcp.js +1 -1
- package/dist-client/src/client/red-builds.d.ts +5 -0
- package/dist-client/src/client/red-builds.js +13 -4
- package/dist-client/src/client/report.d.ts +1 -1
- package/dist-client/src/client/telemetry.js +1 -1
- package/dist-client/src/client/verify-savings.d.ts +2 -0
- package/dist-client/src/client/verify-savings.js +104 -80
- package/node_modules/@diffci.com/core/README.md +3 -3
- package/node_modules/@diffci.com/core/dist/git/git-diff.js +6 -0
- package/node_modules/@diffci.com/core/dist/git/git-diff.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +9 -0
- package/node_modules/@diffci.com/core/dist/repo/impact.js +34 -0
- package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
- package/node_modules/@diffci.com/core/src/git/git-diff.ts +6 -0
- package/node_modules/@diffci.com/core/src/repo/impact.ts +37 -0
- package/package.json +2 -2
|
@@ -10,7 +10,7 @@ export interface ObservationEnvironment {
|
|
|
10
10
|
[key: string]: string | undefined;
|
|
11
11
|
}
|
|
12
12
|
export interface CiEnvironmentFacts {
|
|
13
|
-
provider: "github-actions" | "gitlab-ci" | "local" | "unknown";
|
|
13
|
+
provider: "github-actions" | "gitlab-ci" | "azure-pipelines" | "local" | "unknown";
|
|
14
14
|
ownerName?: string;
|
|
15
15
|
providerRepositoryId?: string;
|
|
16
16
|
defaultBranch?: string;
|
|
@@ -23,6 +23,8 @@ export interface CiEnvironmentFacts {
|
|
|
23
23
|
syntheticTrigger?: boolean;
|
|
24
24
|
}
|
|
25
25
|
export declare function readEventPayload(env: ObservationEnvironment): Record<string, unknown> | undefined;
|
|
26
|
+
/** Azure Pipelines sets `TF_BUILD=True` on every agent job. */
|
|
27
|
+
export declare function isAzurePipelines(env: ObservationEnvironment): boolean;
|
|
26
28
|
export declare function readCiEnvironment(env: ObservationEnvironment): CiEnvironmentFacts;
|
|
27
29
|
export interface ResolvedCommitRange {
|
|
28
30
|
baseSha: string;
|
|
@@ -65,9 +65,32 @@ function readGitlabEnvironment(env) {
|
|
|
65
65
|
syntheticTrigger: event !== undefined && GITLAB_SYNTHETIC_SOURCES.has(event),
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
+
/** Azure Pipelines build reasons with no change of their own to analyse (2026-11-17). */
|
|
69
|
+
const AZURE_SYNTHETIC_REASONS = new Set(["Manual", "Schedule", "ResourceTrigger", "BuildCompletion"]);
|
|
70
|
+
/** Azure Pipelines sets `TF_BUILD=True` on every agent job. */
|
|
71
|
+
export function isAzurePipelines(env) {
|
|
72
|
+
return env.TF_BUILD?.toLowerCase() === "true";
|
|
73
|
+
}
|
|
74
|
+
function readAzureEnvironment(env) {
|
|
75
|
+
const event = asString(env.BUILD_REASON);
|
|
76
|
+
return {
|
|
77
|
+
provider: "azure-pipelines",
|
|
78
|
+
ownerName: asString(env.BUILD_REPOSITORY_NAME),
|
|
79
|
+
providerRepositoryId: asString(env.BUILD_REPOSITORY_ID),
|
|
80
|
+
runId: asString(env.BUILD_BUILDID),
|
|
81
|
+
runAttempt: asString(env.SYSTEM_JOBATTEMPT),
|
|
82
|
+
workflow: asString(env.BUILD_DEFINITIONNAME),
|
|
83
|
+
job: asString(env.SYSTEM_JOBDISPLAYNAME),
|
|
84
|
+
event,
|
|
85
|
+
ref: asString(env.BUILD_SOURCEBRANCH),
|
|
86
|
+
syntheticTrigger: event !== undefined && AZURE_SYNTHETIC_REASONS.has(event),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
68
89
|
export function readCiEnvironment(env) {
|
|
69
90
|
if (env.GITLAB_CI === "true")
|
|
70
91
|
return readGitlabEnvironment(env);
|
|
92
|
+
if (isAzurePipelines(env))
|
|
93
|
+
return readAzureEnvironment(env);
|
|
71
94
|
if (env.GITHUB_ACTIONS !== "true") {
|
|
72
95
|
return { provider: env.CI === "true" ? "unknown" : "local" };
|
|
73
96
|
}
|
|
@@ -110,8 +133,61 @@ function mergeBase(git, a, b) {
|
|
|
110
133
|
const DEEPEN_HINT = "the commit is not in this checkout - add `fetch-depth: 0` to the actions/checkout step in the job that runs DiffCI (this does not affect any other job)";
|
|
111
134
|
/** GitLab clones 20 commits deep by default, so a long merge request loses its base (2026-11-05). */
|
|
112
135
|
const GITLAB_DEEPEN_HINT = "the commit is not in this checkout - set `GIT_DEPTH: \"0\"` in the variables of the job that runs DiffCI (this does not affect any other job)";
|
|
136
|
+
/** Azure Pipelines checks out shallow (`fetchDepth: 1`) by default in pipelines created since 2022. */
|
|
137
|
+
const AZURE_DEEPEN_HINT = "the commit is not in this checkout - set `fetchDepth: 0` on the `checkout` step of the job that runs DiffCI (this does not affect any other job)";
|
|
113
138
|
function deepenHint(env) {
|
|
114
|
-
|
|
139
|
+
if (env.GITLAB_CI === "true")
|
|
140
|
+
return GITLAB_DEEPEN_HINT;
|
|
141
|
+
return isAzurePipelines(env) ? AZURE_DEEPEN_HINT : DEEPEN_HINT;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Azure Pipelines (2026-11-17), for the DiffCIObserve task and the CLI run directly in a pipeline.
|
|
145
|
+
*
|
|
146
|
+
* - A pull request build checks out a merge commit Azure created (`refs/pull/<n>/merge`), like GitHub's
|
|
147
|
+
* merge ref. Its second parent is the source head (`System.PullRequest.SourceCommitId`) and its first
|
|
148
|
+
* parent the target branch tip the merge was made against. The range is the merge base of the two up
|
|
149
|
+
* to the source head, so commits that reached the target branch since are not counted.
|
|
150
|
+
* - Push builds (`IndividualCI`, `BatchedCI`) carry no "before" commit, so the head's parent is used and
|
|
151
|
+
* labelled `head-parent`: a batched build with several commits is described by its last commit only.
|
|
152
|
+
*
|
|
153
|
+
* Returns undefined for build reasons with no range (manual, schedule, ...), which take the generic
|
|
154
|
+
* HEAD^ path with `syntheticTrigger` recorded.
|
|
155
|
+
*/
|
|
156
|
+
function resolveAzureRange(env, git) {
|
|
157
|
+
const hint = AZURE_DEEPEN_HINT;
|
|
158
|
+
const reason = env.BUILD_REASON;
|
|
159
|
+
if (reason === "PullRequest") {
|
|
160
|
+
const secondParent = resolveSha(git, "HEAD^2");
|
|
161
|
+
const headSha = asString(env.SYSTEM_PULLREQUEST_SOURCECOMMITID) ?? secondParent;
|
|
162
|
+
if (!headSha)
|
|
163
|
+
return { ok: false, reason: "pull request build carried no System.PullRequest.SourceCommitId and HEAD is not a merge commit" };
|
|
164
|
+
if (!commitExists(git, headSha)) {
|
|
165
|
+
return { ok: false, reason: `pull request head ${headSha.slice(0, 12)} is not present locally: ${hint}` };
|
|
166
|
+
}
|
|
167
|
+
// The target tip: the merge commit's first parent when its second parent is the source head, else
|
|
168
|
+
// the fetched target branch.
|
|
169
|
+
let targetTip = secondParent === headSha ? resolveSha(git, "HEAD^1") : undefined;
|
|
170
|
+
const targetBranch = asString(env.SYSTEM_PULLREQUEST_TARGETBRANCH)?.replace(/^refs\/heads\//, "");
|
|
171
|
+
if (!targetTip && targetBranch)
|
|
172
|
+
targetTip = resolveSha(git, `refs/remotes/origin/${targetBranch}`);
|
|
173
|
+
if (!targetTip) {
|
|
174
|
+
return { ok: false, reason: `the pull request's target branch${targetBranch ? ` ${targetBranch}` : ""} is not present locally: ${hint}` };
|
|
175
|
+
}
|
|
176
|
+
const common = mergeBase(git, targetTip, headSha);
|
|
177
|
+
if (!common)
|
|
178
|
+
return { ok: false, reason: `no merge base between the pull request head and its target branch in this checkout: ${hint}` };
|
|
179
|
+
return { ok: true, range: { baseSha: common, headSha, source: "pull-request-event", mergeBaseSha: common !== targetTip ? common : undefined } };
|
|
180
|
+
}
|
|
181
|
+
if (reason === "IndividualCI" || reason === "BatchedCI") {
|
|
182
|
+
const headSha = asString(env.BUILD_SOURCEVERSION) ?? resolveSha(git, "HEAD");
|
|
183
|
+
if (!headSha)
|
|
184
|
+
return { ok: false, reason: "could not determine the head commit of this build" };
|
|
185
|
+
const parent = resolveSha(git, `${headSha}^`);
|
|
186
|
+
if (!parent)
|
|
187
|
+
return { ok: false, reason: `the head commit has no parent in this checkout: ${hint}` };
|
|
188
|
+
return { ok: true, range: { baseSha: parent, headSha, source: "head-parent" } };
|
|
189
|
+
}
|
|
190
|
+
return undefined;
|
|
115
191
|
}
|
|
116
192
|
/**
|
|
117
193
|
* GitLab's version of the GitHub event handling below (2026-11-05). The traps have different names:
|
|
@@ -191,7 +267,7 @@ export function resolveCommitRangeFetchingHistory(options) {
|
|
|
191
267
|
if (first.ok)
|
|
192
268
|
return first;
|
|
193
269
|
const { env, git } = options;
|
|
194
|
-
if (env.GITHUB_ACTIONS !== "true" && env.GITLAB_CI !== "true")
|
|
270
|
+
if (env.GITHUB_ACTIONS !== "true" && env.GITLAB_CI !== "true" && !isAzurePipelines(env))
|
|
195
271
|
return first;
|
|
196
272
|
const shallow = git(["rev-parse", "--is-shallow-repository"]);
|
|
197
273
|
if (!shallow.ok || shallow.stdout.trim() !== "true")
|
|
@@ -220,6 +296,11 @@ export function resolveCommitRange(options) {
|
|
|
220
296
|
if (gitlab)
|
|
221
297
|
return gitlab;
|
|
222
298
|
}
|
|
299
|
+
if (isAzurePipelines(env)) {
|
|
300
|
+
const azure = resolveAzureRange(env, git);
|
|
301
|
+
if (azure)
|
|
302
|
+
return azure;
|
|
303
|
+
}
|
|
223
304
|
const payload = readEventPayload(env);
|
|
224
305
|
const event = env.GITHUB_EVENT_NAME;
|
|
225
306
|
if (event === "pull_request" || event === "pull_request_target") {
|
|
@@ -62,7 +62,7 @@ const tools = [
|
|
|
62
62
|
head: { type: "string", description: "Optional head commit SHA." },
|
|
63
63
|
json: { type: "boolean", description: "Print the full JSON observation report." },
|
|
64
64
|
quiet: { type: "boolean", description: "Suppress the human summary." },
|
|
65
|
-
redactPaths: { type: "boolean", description: "Replace paths with stable digests
|
|
65
|
+
redactPaths: { type: "boolean", description: "Replace paths in the analysis result with stable digests. Workflow findings and some fallback details can still name files." },
|
|
66
66
|
},
|
|
67
67
|
additionalProperties: false,
|
|
68
68
|
},
|
|
@@ -26,6 +26,11 @@ export interface JobSummary {
|
|
|
26
26
|
startedAt: string | null;
|
|
27
27
|
completedAt: string | null;
|
|
28
28
|
failedSteps: string[];
|
|
29
|
+
/**
|
|
30
|
+
* False when GitHub returned no step list for the job. It drops step data on old runs (seen on github/gh-aw
|
|
31
|
+
* runs seven months old, 2026-11-16), so "no failed step" then means "unknown", not "cancelled".
|
|
32
|
+
*/
|
|
33
|
+
stepsKnown?: boolean;
|
|
29
34
|
}
|
|
30
35
|
export interface Annotation {
|
|
31
36
|
path: string | null;
|
|
@@ -52,11 +52,16 @@ const AGENT_BRANCH = /^(claude|codex|copilot|cursor|devin|jules)[/-]/i;
|
|
|
52
52
|
export const VERDICTS = ["preventable", "partly", "likely", "shared", "ci-only", "flaky", "infra"];
|
|
53
53
|
export const DEFAULT_PATTERNS = { checkJob: CHECK_JOB, ciOnlyJob: CI_ONLY_JOB };
|
|
54
54
|
export function bucketJob(job, patterns = DEFAULT_PATTERNS, workflowName = "") {
|
|
55
|
-
if (job.
|
|
55
|
+
if (job.stepsKnown === false) {
|
|
56
|
+
// No step data: a failed job is judged by its name alone; a cancelled or timed-out one stays infra.
|
|
57
|
+
if (job.conclusion !== "failure")
|
|
58
|
+
return "infra";
|
|
59
|
+
}
|
|
60
|
+
else if (job.failedSteps.length === 0)
|
|
56
61
|
return "infra"; // cancelled, timed out or runner lost: no step failed
|
|
57
|
-
if (job.failedSteps.every((step) => INFRA_STEP.test(step)))
|
|
62
|
+
if (job.failedSteps.length > 0 && job.failedSteps.every((step) => INFRA_STEP.test(step)))
|
|
58
63
|
return "infra";
|
|
59
|
-
if (job.failedSteps.every((step) => CI_ONLY_STEP.test(step)))
|
|
64
|
+
if (job.failedSteps.length > 0 && job.failedSteps.every((step) => CI_ONLY_STEP.test(step)))
|
|
60
65
|
return "ci-only";
|
|
61
66
|
// The job's own name, without a "Workflow / " prefix, decides. CI-only wins so "e2e tests" is not a check.
|
|
62
67
|
const name = jobName(job);
|
|
@@ -76,8 +81,11 @@ function jobName(job) {
|
|
|
76
81
|
}
|
|
77
82
|
export function isAggregateJob(job) {
|
|
78
83
|
const name = jobName(job).replace(/[()]/g, "").trim();
|
|
79
|
-
return AGGREGATE_JOB.test(name) || AGGREGATE_SUFFIX.test(name);
|
|
84
|
+
return AGGREGATE_JOB.test(name) || AGGREGATE_SUFFIX.test(name) || GATE_JOB.test(name);
|
|
80
85
|
}
|
|
86
|
+
/** Gate jobs named "PR Gate", "CI Gate" (microsoft/vscode, microsoft/typespec, 2026-11-16): they only report
|
|
87
|
+
* that another job failed. Read as CI-only, they made every red run on those repositories CI-only. */
|
|
88
|
+
const GATE_JOB = /^(pr|ci|merge|build|test|checks?)[- ]?gate$/i;
|
|
81
89
|
/** Failure signatures of one job: annotation path, title and first message line, with volatile parts blurred. */
|
|
82
90
|
export function signatures(annotations) {
|
|
83
91
|
const out = new Set();
|
|
@@ -559,6 +567,7 @@ export async function collectRedBuilds(options) {
|
|
|
559
567
|
list.push({
|
|
560
568
|
id: j.id, name: String(j.name ?? ""), conclusion: j.conclusion ?? null, startedAt: j.started_at ?? null, completedAt: j.completed_at ?? null,
|
|
561
569
|
failedSteps: (j.steps ?? []).filter((s) => s.conclusion === "failure").map((s) => String(s.name ?? "")),
|
|
570
|
+
stepsKnown: Array.isArray(j.steps) && j.steps.length > 0,
|
|
562
571
|
});
|
|
563
572
|
}
|
|
564
573
|
if (batch.length < 100)
|
|
@@ -44,7 +44,7 @@ export interface ObservationRepository {
|
|
|
44
44
|
providerRepositoryId?: string;
|
|
45
45
|
}
|
|
46
46
|
export interface ObservationCi {
|
|
47
|
-
provider: "github-actions" | "gitlab-ci" | "local" | "unknown";
|
|
47
|
+
provider: "github-actions" | "gitlab-ci" | "azure-pipelines" | "local" | "unknown";
|
|
48
48
|
runId?: string;
|
|
49
49
|
runAttempt?: string;
|
|
50
50
|
workflow?: string;
|
|
@@ -101,7 +101,7 @@ function surfaceOf(env) {
|
|
|
101
101
|
return "cli";
|
|
102
102
|
}
|
|
103
103
|
function isCi(env) {
|
|
104
|
-
return Boolean(env.CI && env.CI !== "false" && env.CI !== "0") || Boolean(env.GITHUB_ACTIONS || env.GITLAB_CI || env.BUILDKITE || env.CIRCLECI);
|
|
104
|
+
return Boolean(env.CI && env.CI !== "false" && env.CI !== "0") || Boolean(env.GITHUB_ACTIONS || env.GITLAB_CI || env.TF_BUILD || env.BUILDKITE || env.CIRCLECI);
|
|
105
105
|
}
|
|
106
106
|
export function telemetryNotice(mode) {
|
|
107
107
|
return mode === "repo"
|
|
@@ -190,5 +190,7 @@ export declare function writeVerifySavingsReport(report: VerifySavingsReport, pa
|
|
|
190
190
|
out: string;
|
|
191
191
|
markdown?: string;
|
|
192
192
|
}): void;
|
|
193
|
+
/** Whether a failed arm looks like a missing runner or dependency rather than a test failure. */
|
|
194
|
+
export declare function looksLikeMissingDependencies(measurement: CommandMeasurement): boolean;
|
|
193
195
|
export declare function formatVerifySavingsSummary(report: VerifySavingsReport): string;
|
|
194
196
|
export {};
|
|
@@ -278,10 +278,10 @@ export function measureCommand(command, options) {
|
|
|
278
278
|
env: launch.pathEntry ? withPathEntry(env, launch.pathEntry) : env,
|
|
279
279
|
});
|
|
280
280
|
const finishedAt = new Date().toISOString();
|
|
281
|
-
const failingTests = result.status === 0 ? [] : failingTestNames(`${result.stdout ?? ""}
|
|
281
|
+
const failingTests = result.status === 0 ? [] : failingTestNames(`${result.stdout ?? ""}
|
|
282
282
|
${result.stderr ?? ""}`);
|
|
283
283
|
const testCount = runnerTestCount(result.stdout ?? "");
|
|
284
|
-
const testResults = parseTestFileResults(`${result.stdout ?? ""}
|
|
284
|
+
const testResults = parseTestFileResults(`${result.stdout ?? ""}
|
|
285
285
|
${result.stderr ?? ""}`);
|
|
286
286
|
return {
|
|
287
287
|
command,
|
|
@@ -434,84 +434,84 @@ export function renderVerifySavingsMarkdown(report) {
|
|
|
434
434
|
: report.comparison.performanceEvidence === "CONTROLLED"
|
|
435
435
|
? "Review the repeated-run distribution and failure assessment before considering a production trial."
|
|
436
436
|
: "Repeat at least three times with alternating order and a cache-preparation command to establish controlled cache state before making a production-savings claim.";
|
|
437
|
-
return `${title}
|
|
438
|
-
|
|
439
|
-
Produced at: ${report.producedAt}
|
|
440
|
-
Repository label: ${report.label ?? "not provided"}
|
|
441
|
-
Selection source: ${report.selectionSource}
|
|
442
|
-
${selectionCounts}${warning}
|
|
443
|
-
|
|
444
|
-
This report compares a full command with a selected command on the same checkout. It is measured pilot evidence, not a production-savings claim.
|
|
445
|
-
|
|
446
|
-
## Result
|
|
447
|
-
|
|
448
|
-
${!report.comparison.fullCommandSucceeded || !report.comparison.selectedCommandSucceeded ? "Comparison invalid: command failure. Do not interpret the timing difference as savings.\n" : !report.comparison.evidenceValid ? "Comparison invalid: checkout identity changed or could not be verified. Do not interpret the timing difference as savings.\n" : ""}
|
|
449
|
-
| Measure | Value |
|
|
450
|
-
| --- | ---: |
|
|
451
|
-
| Full runtime | ${formatMs(report.comparison.fullWallMs)} |
|
|
452
|
-
| Selected runtime | ${formatMs(report.comparison.selectedWallMs)} |
|
|
453
|
-
| Test execution change vs full | ${formatPercent(report.comparison.grossPercentChange)} |
|
|
454
|
-
| DiffCI analysis overhead | ${overhead} |
|
|
455
|
-
| Net selected runtime | ${formatMs(report.comparison.netSelectedMs)} |
|
|
456
|
-
| Delta vs full | ${formatMs(report.comparison.deltaMs)} ${deltaLabel} |
|
|
457
|
-
| Percent change vs full | ${formatPercent(report.comparison.percentChange)} |
|
|
458
|
-
| Runtime evidence | ${report.comparison.performanceEvidence.toLowerCase()} |
|
|
459
|
-
| Repetitions | ${report.comparison.repetitions} |
|
|
460
|
-
| Full runtime range | ${formatMs(report.comparison.fullWallMsRange.min)} / ${formatMs(report.comparison.fullWallMsRange.median)} / ${formatMs(report.comparison.fullWallMsRange.max)} (min/median/max) |
|
|
461
|
-
| Selected runtime range | ${formatMs(report.comparison.selectedWallMsRange.min)} / ${formatMs(report.comparison.selectedWallMsRange.median)} / ${formatMs(report.comparison.selectedWallMsRange.max)} (min/median/max) |
|
|
462
|
-
|
|
463
|
-
## Measurement Protocol
|
|
464
|
-
|
|
465
|
-
| Field | Value |
|
|
466
|
-
| --- | --- |
|
|
467
|
-
| Alternating arm order | ${report.protocol.alternatingOrder ? "yes" : "no"} |
|
|
468
|
-
| Declared cache state | ${report.protocol.declaredCacheState} |
|
|
469
|
-
| Cache preparation command | ${report.protocol.cachePreparationCommand ? `\`${report.protocol.cachePreparationCommand.replaceAll("|", "\\|")}\`` : "not provided"} |
|
|
470
|
-
| Cache state controlled | ${report.protocol.cacheStateControlled ? "yes" : "no"} |
|
|
471
|
-
|
|
472
|
-
## Failure Assessment
|
|
473
|
-
|
|
474
|
-
| Field | Value |
|
|
475
|
-
| --- | --- |
|
|
476
|
-
| Classification | ${report.failureAssessment.kind} |
|
|
477
|
-
| Confidence | ${report.failureAssessment.confidence} |
|
|
478
|
-
| Explanation | ${report.failureAssessment.explanation} |
|
|
479
|
-
|
|
480
|
-
## Provenance
|
|
481
|
-
|
|
482
|
-
| Field | Value |
|
|
483
|
-
| --- | --- |
|
|
484
|
-
| Base SHA | \`${report.provenance.baseSha ?? "unavailable"}\` |
|
|
485
|
-
| Head SHA | \`${report.provenance.headSha ?? "unavailable"}\` |
|
|
486
|
-
| Observation SHA-256 | \`${report.provenance.observationSha256 ?? "unavailable"}\` |
|
|
487
|
-
| DiffCI observer version | ${report.provenance.observerVersion ?? "unavailable"} |
|
|
488
|
-
| Checkout stable across both arms | ${report.provenance.checkoutStable ? "yes" : "no"} |
|
|
489
|
-
| Dependency inputs SHA-256 | \`${report.provenance.beforeFull.dependencyInputsSha256 ?? "unavailable"}\` |
|
|
490
|
-
| Resolved dependency markers SHA-256 | \`${report.provenance.beforeFull.resolvedDependencySha256 ?? "unavailable"}\` |
|
|
491
|
-
| Runner identity SHA-256 | \`${report.runnerIdentity.fingerprintSha256}\` |
|
|
492
|
-
|
|
493
|
-
## Commands
|
|
494
|
-
|
|
495
|
-
| Arm | Exit | Timed out | Command |
|
|
496
|
-
| --- | ---: | --- | --- |
|
|
497
|
-
| Full | ${report.full.exitCode ?? "signal"} | ${report.full.timedOut ? "yes" : "no"} | \`${report.full.command.replaceAll("|", "\\|")}\` |
|
|
498
|
-
| Selected | ${report.selected.exitCode ?? "signal"} | ${report.selected.timedOut ? "yes" : "no"} | \`${report.selected.command.replaceAll("|", "\\|")}\` |
|
|
499
|
-
|
|
500
|
-
## Maintainer Review
|
|
501
|
-
|
|
502
|
-
| Question | Answer |
|
|
503
|
-
| --- | --- |
|
|
504
|
-
| Command coverage | ${commandCoverage} |
|
|
505
|
-
| Cache state | ${report.protocol.cacheStateControlled ? `${report.protocol.declaredCacheState}; reset/preparation applied before each arm.` : `${report.protocol.declaredCacheState}; not independently controlled.`} |
|
|
506
|
-
| Invalid evidence handling | Failed commands or unstable checkout provenance are labelled diagnostic only above. |
|
|
507
|
-
| Next step | ${nextStep} |
|
|
508
|
-
|
|
509
|
-
## Interpretation Notes
|
|
510
|
-
|
|
511
|
-
${report.notes.map((note) => `- ${note}`).join("\n")}
|
|
512
|
-
|
|
513
|
-
Open-source engine: [DiffCI/core](https://github.com/DiffCI/core).
|
|
514
|
-
${formatGrowthPrompt(report) ? "\nUseful? [Star DiffCI](https://github.com/DiffCI/core) or [volunteer a pilot repository](https://diffci.com/#pilot).\n" : ""}
|
|
437
|
+
return `${title}
|
|
438
|
+
|
|
439
|
+
Produced at: ${report.producedAt}
|
|
440
|
+
Repository label: ${report.label ?? "not provided"}
|
|
441
|
+
Selection source: ${report.selectionSource}
|
|
442
|
+
${selectionCounts}${warning}
|
|
443
|
+
|
|
444
|
+
This report compares a full command with a selected command on the same checkout. It is measured pilot evidence, not a production-savings claim.
|
|
445
|
+
|
|
446
|
+
## Result
|
|
447
|
+
|
|
448
|
+
${!report.comparison.fullCommandSucceeded || !report.comparison.selectedCommandSucceeded ? "Comparison invalid: command failure. Do not interpret the timing difference as savings.\n" : !report.comparison.evidenceValid ? "Comparison invalid: checkout identity changed or could not be verified. Do not interpret the timing difference as savings.\n" : ""}
|
|
449
|
+
| Measure | Value |
|
|
450
|
+
| --- | ---: |
|
|
451
|
+
| Full runtime | ${formatMs(report.comparison.fullWallMs)} |
|
|
452
|
+
| Selected runtime | ${formatMs(report.comparison.selectedWallMs)} |
|
|
453
|
+
| Test execution change vs full | ${formatPercent(report.comparison.grossPercentChange)} |
|
|
454
|
+
| DiffCI analysis overhead | ${overhead} |
|
|
455
|
+
| Net selected runtime | ${formatMs(report.comparison.netSelectedMs)} |
|
|
456
|
+
| Delta vs full | ${formatMs(report.comparison.deltaMs)} ${deltaLabel} |
|
|
457
|
+
| Percent change vs full | ${formatPercent(report.comparison.percentChange)} |
|
|
458
|
+
| Runtime evidence | ${report.comparison.performanceEvidence.toLowerCase()} |
|
|
459
|
+
| Repetitions | ${report.comparison.repetitions} |
|
|
460
|
+
| Full runtime range | ${formatMs(report.comparison.fullWallMsRange.min)} / ${formatMs(report.comparison.fullWallMsRange.median)} / ${formatMs(report.comparison.fullWallMsRange.max)} (min/median/max) |
|
|
461
|
+
| Selected runtime range | ${formatMs(report.comparison.selectedWallMsRange.min)} / ${formatMs(report.comparison.selectedWallMsRange.median)} / ${formatMs(report.comparison.selectedWallMsRange.max)} (min/median/max) |
|
|
462
|
+
|
|
463
|
+
## Measurement Protocol
|
|
464
|
+
|
|
465
|
+
| Field | Value |
|
|
466
|
+
| --- | --- |
|
|
467
|
+
| Alternating arm order | ${report.protocol.alternatingOrder ? "yes" : "no"} |
|
|
468
|
+
| Declared cache state | ${report.protocol.declaredCacheState} |
|
|
469
|
+
| Cache preparation command | ${report.protocol.cachePreparationCommand ? `\`${report.protocol.cachePreparationCommand.replaceAll("|", "\\|")}\`` : "not provided"} |
|
|
470
|
+
| Cache state controlled | ${report.protocol.cacheStateControlled ? "yes" : "no"} |
|
|
471
|
+
|
|
472
|
+
## Failure Assessment
|
|
473
|
+
|
|
474
|
+
| Field | Value |
|
|
475
|
+
| --- | --- |
|
|
476
|
+
| Classification | ${report.failureAssessment.kind} |
|
|
477
|
+
| Confidence | ${report.failureAssessment.confidence} |
|
|
478
|
+
| Explanation | ${report.failureAssessment.explanation} |
|
|
479
|
+
|
|
480
|
+
## Provenance
|
|
481
|
+
|
|
482
|
+
| Field | Value |
|
|
483
|
+
| --- | --- |
|
|
484
|
+
| Base SHA | \`${report.provenance.baseSha ?? "unavailable"}\` |
|
|
485
|
+
| Head SHA | \`${report.provenance.headSha ?? "unavailable"}\` |
|
|
486
|
+
| Observation SHA-256 | \`${report.provenance.observationSha256 ?? "unavailable"}\` |
|
|
487
|
+
| DiffCI observer version | ${report.provenance.observerVersion ?? "unavailable"} |
|
|
488
|
+
| Checkout stable across both arms | ${report.provenance.checkoutStable ? "yes" : "no"} |
|
|
489
|
+
| Dependency inputs SHA-256 | \`${report.provenance.beforeFull.dependencyInputsSha256 ?? "unavailable"}\` |
|
|
490
|
+
| Resolved dependency markers SHA-256 | \`${report.provenance.beforeFull.resolvedDependencySha256 ?? "unavailable"}\` |
|
|
491
|
+
| Runner identity SHA-256 | \`${report.runnerIdentity.fingerprintSha256}\` |
|
|
492
|
+
|
|
493
|
+
## Commands
|
|
494
|
+
|
|
495
|
+
| Arm | Exit | Timed out | Command |
|
|
496
|
+
| --- | ---: | --- | --- |
|
|
497
|
+
| Full | ${report.full.exitCode ?? "signal"} | ${report.full.timedOut ? "yes" : "no"} | \`${report.full.command.replaceAll("|", "\\|")}\` |
|
|
498
|
+
| Selected | ${report.selected.exitCode ?? "signal"} | ${report.selected.timedOut ? "yes" : "no"} | \`${report.selected.command.replaceAll("|", "\\|")}\` |
|
|
499
|
+
|
|
500
|
+
## Maintainer Review
|
|
501
|
+
|
|
502
|
+
| Question | Answer |
|
|
503
|
+
| --- | --- |
|
|
504
|
+
| Command coverage | ${commandCoverage} |
|
|
505
|
+
| Cache state | ${report.protocol.cacheStateControlled ? `${report.protocol.declaredCacheState}; reset/preparation applied before each arm.` : `${report.protocol.declaredCacheState}; not independently controlled.`} |
|
|
506
|
+
| Invalid evidence handling | Failed commands or unstable checkout provenance are labelled diagnostic only above. |
|
|
507
|
+
| Next step | ${nextStep} |
|
|
508
|
+
|
|
509
|
+
## Interpretation Notes
|
|
510
|
+
|
|
511
|
+
${report.notes.map((note) => `- ${note}`).join("\n")}
|
|
512
|
+
|
|
513
|
+
Open-source engine: [DiffCI/core](https://github.com/DiffCI/core).
|
|
514
|
+
${formatGrowthPrompt(report) ? "\nUseful? [Star DiffCI](https://github.com/DiffCI/core) or [volunteer a pilot repository](https://diffci.com/#pilot).\n" : ""}
|
|
515
515
|
`;
|
|
516
516
|
}
|
|
517
517
|
function writeText(path, value) {
|
|
@@ -595,10 +595,34 @@ export function writeVerifySavingsReport(report, paths) {
|
|
|
595
595
|
if (paths.markdown)
|
|
596
596
|
writeText(paths.markdown, renderVerifySavingsMarkdown(report));
|
|
597
597
|
}
|
|
598
|
+
/** Output that means the test runner or a module could not be found, the usual sign of a fresh
|
|
599
|
+
* clone whose dependencies were never installed (2026-11-16: a first `check` on an un-installed
|
|
600
|
+
* Core clone printed only "inconclusive", with no hint why). */
|
|
601
|
+
const MISSING_TOOL_PATTERNS = [
|
|
602
|
+
/is not recognized as an internal or external command/i,
|
|
603
|
+
/command not found/i,
|
|
604
|
+
/^(?:\/bin\/)?(?:ba|da)?sh: (?:line \d+: |\d+: )?\S+: not found/im,
|
|
605
|
+
/npx canceled due to missing packages/i,
|
|
606
|
+
/could not determine executable to run/i,
|
|
607
|
+
/Cannot find module/,
|
|
608
|
+
/Cannot find package/,
|
|
609
|
+
/ERR_MODULE_NOT_FOUND/,
|
|
610
|
+
];
|
|
611
|
+
/** Whether a failed arm looks like a missing runner or dependency rather than a test failure. */
|
|
612
|
+
export function looksLikeMissingDependencies(measurement) {
|
|
613
|
+
if (measurement.exitCode === 0 || measurement.timedOut)
|
|
614
|
+
return false;
|
|
615
|
+
if (measurement.exitCode === 127)
|
|
616
|
+
return true;
|
|
617
|
+
const output = `${measurement.stderrTail}\n${measurement.stdoutTail}`;
|
|
618
|
+
return MISSING_TOOL_PATTERNS.some((pattern) => pattern.test(output));
|
|
619
|
+
}
|
|
598
620
|
export function formatVerifySavingsSummary(report) {
|
|
599
621
|
if (!report.comparison.fullCommandSucceeded || !report.comparison.selectedCommandSucceeded) {
|
|
622
|
+
const missing = [report.full, report.selected].some(looksLikeMissingDependencies);
|
|
600
623
|
return "DiffCI verify-savings: comparison invalid because one or both commands failed" +
|
|
601
624
|
`\n failure assessment: ${report.failureAssessment.kind} (${report.failureAssessment.confidence}) - ${report.failureAssessment.explanation}` +
|
|
625
|
+
(missing ? "\n hint: the test runner or a module was not found. Install the repository's dependencies (for example `npm ci` or `pnpm install`), then run this again." : "") +
|
|
602
626
|
(report.comparison.missedFailureSignal ? "\n warning: full failed while selected passed; inspect outputs before claiming safety" : "");
|
|
603
627
|
}
|
|
604
628
|
if (!report.comparison.evidenceValid) {
|
|
@@ -21,7 +21,7 @@ If DiffCI saves you CI time, a ⭐ helps others find it.
|
|
|
21
21
|
|
|
22
22
|
```yaml
|
|
23
23
|
- uses: actions/checkout@v7
|
|
24
|
-
- uses: DiffCI/core@v0.3.
|
|
24
|
+
- uses: DiffCI/core@v0.3.52
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Add `with: comment: "true"` (and `pull-requests: write` on the job) and the same answer appears on the pull request itself, updated in place on each push:
|
|
@@ -279,11 +279,11 @@ Thank you to everyone who has improved DiffCI:
|
|
|
279
279
|
- <a href="https://github.com/FredApps"><img src="https://github.com/FredApps.png?size=80" width="40" height="40" alt="@FredApps"></a> **[@FredApps](https://github.com/FredApps)**, **[Area maintainer: Rust](CONTRIBUTING.md#contributor-tiers)**: the [Rust (Cargo) adapter](https://github.com/DiffCI/core/issues/62), from Cargo package and test-target mapping ([#91](https://github.com/DiffCI/core/pull/91)) through crate-dependency selection ([#92](https://github.com/DiffCI/core/pull/92)), conservative `cargo test` commands ([#93](https://github.com/DiffCI/core/pull/93)), registration inside the release boundary ([#94](https://github.com/DiffCI/core/pull/94)) and a pinned public replay on hosted CI ([#95](https://github.com/DiffCI/core/pull/95)), and five safety fixes for runtime module dependencies, Maven module resources, runner suites, deleted assets and Go runtime inputs ([#32](https://github.com/DiffCI/core/pull/32)–[#36](https://github.com/DiffCI/core/pull/36)).
|
|
280
280
|
- <a href="https://github.com/shounakjoshi88-a11y"><img src="https://github.com/shounakjoshi88-a11y.png?size=80" width="40" height="40" alt="@shounakjoshi88-a11y"></a> **[Shounak Joshi](https://github.com/shounakjoshi88-a11y)**: Go package-owned `testdata` selection, so a golden-file edit runs the owning package's tests instead of the full suite ([#85](https://github.com/DiffCI/core/pull/85)).
|
|
281
281
|
- <a href="https://github.com/bfs2021"><img src="https://github.com/bfs2021.png?size=80" width="40" height="40" alt="@bfs2021"></a> **[@bfs2021](https://github.com/bfs2021)**: `bun.lock` and `npm-shrinkwrap.json` recognition in the lockfile signal ([#64](https://github.com/DiffCI/core/pull/64)).
|
|
282
|
-
- <a href="https://github.com/sarankumar1325"><img src="https://github.com/sarankumar1325.png?size=80" width="40" height="40" alt="@sarankumar1325"></a> **[@sarankumar1325](https://github.com/sarankumar1325)**: lockfile and config-file signals. One shared lockfile list replaced every hand-written copy in `src/` ([#97](https://github.com/DiffCI/core/issues/97)): reference resolution, impact analysis and the lockfile-free dependency check ([#118](https://github.com/DiffCI/core/pull/118)–[#120](https://github.com/DiffCI/core/pull/120)), config-file discovery and impact classification, where `npm-shrinkwrap.json` is now a config change like every other lockfile ([#151](https://github.com/DiffCI/core/pull/151), [#152](https://github.com/DiffCI/core/pull/152)), the Vue analysis cache ([#107](https://github.com/DiffCI/core/pull/107)), CI inference ([#105](https://github.com/DiffCI/core/pull/105), [#146](https://github.com/DiffCI/core/pull/146)) and both path baselines, which now also fall back on `npm-shrinkwrap.json` ([#147](https://github.com/DiffCI/core/pull/147), [#148](https://github.com/DiffCI/core/pull/148)). A full run when only `babel.config.*` or `.babelrc*` changes ([#108](https://github.com/DiffCI/core/pull/108)) or a package's Jest, Vitest or Babel config changes ([#121](https://github.com/DiffCI/core/pull/121)), where these files used to select no tests. Regression tests for `vite.config`-only changes in Vitest projects ([#109](https://github.com/DiffCI/core/pull/109)) and for a root Vitest config that turns isolation off ([#149](https://github.com/DiffCI/core/pull/149)), and removal of dead config-file patterns with a test for every entry ([#106](https://github.com/DiffCI/core/pull/106)). Go `replace` targets inside the repository modelled under root-module scope instead of forcing the full suite ([#110](https://github.com/DiffCI/core/pull/110)). The [no-runnable-command reasons](docs/using-diffci.md#no-runnable-command), documented with a test that keeps the table complete ([#150](https://github.com/DiffCI/core/pull/150)), and `"\0"` escapes in place of raw NUL bytes, so git and ripgrep can search those source files again ([#145](https://github.com/DiffCI/core/pull/145)).
|
|
282
|
+
- <a href="https://github.com/sarankumar1325"><img src="https://github.com/sarankumar1325.png?size=80" width="40" height="40" alt="@sarankumar1325"></a> **[@sarankumar1325](https://github.com/sarankumar1325)**: lockfile and config-file signals. One shared lockfile list replaced every hand-written copy in `src/` ([#97](https://github.com/DiffCI/core/issues/97)): reference resolution, impact analysis and the lockfile-free dependency check ([#118](https://github.com/DiffCI/core/pull/118)–[#120](https://github.com/DiffCI/core/pull/120)), config-file discovery and impact classification, where `npm-shrinkwrap.json` is now a config change like every other lockfile ([#151](https://github.com/DiffCI/core/pull/151), [#152](https://github.com/DiffCI/core/pull/152)), the Vue analysis cache ([#107](https://github.com/DiffCI/core/pull/107)), CI inference ([#105](https://github.com/DiffCI/core/pull/105), [#146](https://github.com/DiffCI/core/pull/146)) and both path baselines, which now also fall back on `npm-shrinkwrap.json` ([#147](https://github.com/DiffCI/core/pull/147), [#148](https://github.com/DiffCI/core/pull/148)). A full run when only `babel.config.*` or `.babelrc*` changes ([#108](https://github.com/DiffCI/core/pull/108)) or a package's Jest, Vitest or Babel config changes ([#121](https://github.com/DiffCI/core/pull/121)), where these files used to select no tests. Regression tests for `vite.config`-only changes in Vitest projects ([#109](https://github.com/DiffCI/core/pull/109)) and for a root Vitest config that turns isolation off ([#149](https://github.com/DiffCI/core/pull/149)), and removal of dead config-file patterns with a test for every entry ([#106](https://github.com/DiffCI/core/pull/106)). Go `replace` targets inside the repository modelled under root-module scope instead of forcing the full suite ([#110](https://github.com/DiffCI/core/pull/110)). The [no-runnable-command reasons](docs/using-diffci.md#no-runnable-command), documented with a test that keeps the table complete ([#150](https://github.com/DiffCI/core/pull/150)), and `"\0"` escapes in place of raw NUL bytes, so git and ripgrep can search those source files again ([#145](https://github.com/DiffCI/core/pull/145)); document verify-workflow, pilot-packet, validate-specs and telemetry ([#153](https://github.com/DiffCI/core/pull/153)).
|
|
283
283
|
- <a href="https://github.com/robertwmccarty-caelum"><img src="https://github.com/robertwmccarty-caelum.png?size=80" width="40" height="40" alt="@robertwmccarty-caelum"></a> **[@robertwmccarty-caelum](https://github.com/robertwmccarty-caelum)**: the Vitest reporter/timeout config fixture and its narrowing conditions ([#53](https://github.com/DiffCI/core/issues/53#issuecomment-6514436312), landed in [#65](https://github.com/DiffCI/core/pull/65)).
|
|
284
284
|
- <a href="https://github.com/varshith84"><img src="https://github.com/varshith84.png?size=80" width="40" height="40" alt="@varshith84"></a> **[Varshith Sai Pasupuleti](https://github.com/varshith84)**: tests for transitive Vue selection and full fallback ([#16](https://github.com/DiffCI/core/pull/16)).
|
|
285
285
|
- <a href="https://github.com/aniKet0753"><img src="https://github.com/aniKet0753.png?size=80" width="40" height="40" alt="@aniKet0753"></a> **[@aniKet0753](https://github.com/aniKet0753)**: a `diffci help` command list and `USAGE` text that match the commands the CLI runs, with a test that fails when a command is missing ([#130](https://github.com/DiffCI/core/pull/130)).
|
|
286
|
-
- <a href="https://github.com/tyza66"><img src="https://github.com/tyza66.png?size=80" width="40" height="40" alt="@tyza66"></a> **[@tyza66](https://github.com/tyza66)**: name the tool configuration behind a fallback instead of "Unknown changed file" ([#144](https://github.com/DiffCI/core/pull/144)).
|
|
286
|
+
- <a href="https://github.com/tyza66"><img src="https://github.com/tyza66.png?size=80" width="40" height="40" alt="@tyza66"></a> **[@tyza66](https://github.com/tyza66)**: name the tool configuration behind a fallback instead of "Unknown changed file" ([#144](https://github.com/DiffCI/core/pull/144)); name a tsconfig variant as TypeScript configuration instead of unknown ([#155](https://github.com/DiffCI/core/pull/155)).
|
|
287
287
|
|
|
288
288
|
Every merged contribution is credited in the release notes, here, on [diffci.com/contributors](https://diffci.com/contributors), and next to the feature in the docs. The README and website entries are added automatically when a pull request merges. A [contributor tier](CONTRIBUTING.md#contributor-tiers) above Contributor is written after the name, as in **[Area maintainer: Rust](CONTRIBUTING.md#contributor-tiers)**, and diffci.com copies it from here.
|
|
289
289
|
|
|
@@ -144,6 +144,12 @@ export const CONFIG_PATTERNS = [
|
|
|
144
144
|
/^next\.config\./,
|
|
145
145
|
/^tsconfig\.json$/,
|
|
146
146
|
/^jsconfig\.json$/,
|
|
147
|
+
// `tsconfig.base.json`, `tsconfig.test.json`, `jsconfig.build.json`: monorepos keep shared options in
|
|
148
|
+
// the first and projects carry per-target variants of the rest (issue #141). Deliberately narrower
|
|
149
|
+
// than type-program.ts's `tsconfig[^/]*\.json`, which would also match the package name
|
|
150
|
+
// `tsconfig-paths.json`.
|
|
151
|
+
/^tsconfig\.[^/]+\.json$/,
|
|
152
|
+
/^jsconfig\.[^/]+\.json$/,
|
|
147
153
|
/^eslint\.config\./,
|
|
148
154
|
/^\.eslint/,
|
|
149
155
|
/^postcss\.config\./,
|