@diffci.com/diffci 0.3.51 → 0.3.52
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.
|
@@ -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)
|
|
@@ -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) {
|