@diffci.com/diffci 0.2.9 → 0.2.11
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/README.md +55 -10
- package/dist-client/src/client/cli.js +45 -0
- package/dist-client/src/client/spec-conflicts.js +50 -0
- package/dist-client/src/client/verify-savings.js +311 -34
- package/dist-client/src/preflight/fingerprint.js +61 -0
- package/dist-client/src/preflight/taxonomy.js +7 -0
- package/docs/adoption-metrics.md +2 -1
- package/docs/agent-adoption-kit.md +1 -1
- package/docs/agent-adoption-targets.md +1 -1
- package/docs/ai-agents.md +7 -1
- package/docs/distribution.md +3 -3
- package/docs/mcp.md +26 -4
- package/docs/npm-adoption.md +11 -5
- package/glama.json +2 -2
- package/package.json +10 -3
- package/server.json +20 -5
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
[](https://www.npmjs.com/package/@diffci.com/diffci)
|
|
7
7
|
[](https://docs.npmjs.com/generating-provenance-statements)
|
|
8
|
-
[](
|
|
8
|
+
[](https://diffci.com/mcp-server)
|
|
9
9
|
[](docs/ai-agents.md)
|
|
10
10
|
[](https://github.com/marketplace/actions/diffci-observer)
|
|
11
11
|
|
|
@@ -54,9 +54,10 @@ maintainer PR text. AI-readable documentation is on [Context7 CLI](https://conte
|
|
|
54
54
|
and [Context7 Core](https://context7.com/diffci/core). Use the [GitHub Marketplace Action](https://github.com/marketplace/actions/diffci-observer)
|
|
55
55
|
for a separate, non-blocking observation job. Required project CI remains authoritative.
|
|
56
56
|
|
|
57
|
-
One paired run is preliminary evidence
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
One paired run is preliminary evidence. `verify-savings` can repeat comparisons, alternate arm order,
|
|
58
|
+
record declared cache state, and run an explicit cache-preparation command before every arm. A result is
|
|
59
|
+
labelled controlled only after at least three alternating, cache-prepared repetitions. On a
|
|
60
|
+
full-validation fallback, `check` runs the full command once and reports 0% reduction.
|
|
60
61
|
|
|
61
62
|
**Upgrade from 0.1.3:** tests excluded by a source-only `tsconfig.json` could be discovered without
|
|
62
63
|
their dependency edges, producing an incomplete selection. This is fixed in **0.1.4**. Revalidate
|
|
@@ -82,13 +83,50 @@ not Cal.com's production savings or a prediction for your repository.
|
|
|
82
83
|
Selection counts alone do not establish runtime savings. `check` reports a measured percentage only
|
|
83
84
|
when both commands pass and the checked-out commit and worktree remain identical across both arms.
|
|
84
85
|
The savings artifact embeds the base/head SHAs, observation SHA-256, commands, timings, and checkout
|
|
85
|
-
snapshots
|
|
86
|
+
snapshots. Snapshots use byte-level fingerprints for dirty files, manifests, lockfiles, and available
|
|
87
|
+
resolved-dependency markers; the report also records the runner identity. A mismatch invalidates the
|
|
88
|
+
comparison. `observe` does not execute tests.
|
|
86
89
|
|
|
87
90
|
For an advanced paired runtime check, you can still run `observe` first and then run `verify-savings`
|
|
88
91
|
against the observation report. It compares your normal full command with
|
|
89
92
|
DiffCI's proposed selected command and writes JSON plus Markdown evidence; see
|
|
90
93
|
[`docs/npm-adoption.md`](docs/npm-adoption.md#self-serve-runtime-pilot).
|
|
91
94
|
|
|
95
|
+
For stronger evidence, run repeated measurements with an explicit cache preparation command:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx "@diffci.com/diffci@latest" verify-savings \
|
|
99
|
+
--repo . --full "npm test" --selected-from-report ../diffci-observation.json \
|
|
100
|
+
--out ../diffci-savings.json --repetitions 3 --cache-state warm \
|
|
101
|
+
--cache-prepare "node scripts/prepare-ci-cache.mjs"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
DiffCI alternates full/selected order, reports min/median/max timings, and conservatively classifies
|
|
105
|
+
stable selection misses, likely flakes, shared/pre-existing failures, infrastructure failures, and
|
|
106
|
+
inconclusive results. Cache preparation is user-supplied because DiffCI must not delete repository or
|
|
107
|
+
tool caches on its own.
|
|
108
|
+
|
|
109
|
+
## Validate same-turn change specifications
|
|
110
|
+
|
|
111
|
+
When an agent or build tool supplies explicit specification IDs and logical targets, DiffCI can block
|
|
112
|
+
two specifications from silently changing the same target:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"specifications": [
|
|
117
|
+
{ "id": "SPEC-API", "logicalTarget": "com.example.Widget#run" },
|
|
118
|
+
{ "id": "SPEC-BEHAVIOR", "logicalTarget": "com.example.Widget#run" }
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npx "@diffci.com/diffci@latest" validate-specs --file change-specifications.json
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The command exits non-zero and names every conflicting specification ID. This surface is opt-in and
|
|
128
|
+
does not infer semantic targets from source code; callers must provide stable logical target names.
|
|
129
|
+
|
|
92
130
|
## Observe in GitHub Actions
|
|
93
131
|
|
|
94
132
|
Save this as `.github/workflows/diffci.yml` to add a dedicated, non-blocking observation job:
|
|
@@ -106,13 +144,13 @@ jobs:
|
|
|
106
144
|
- uses: actions/checkout@v4
|
|
107
145
|
with:
|
|
108
146
|
fetch-depth: 0
|
|
109
|
-
- uses: DiffCI/DiffCI.com@
|
|
147
|
+
- uses: DiffCI/DiffCI.com@e1d7bab271c5d83899bda0034d70d3e34c10c1f7
|
|
110
148
|
```
|
|
111
149
|
|
|
112
150
|
Then check the workflow locally with `npx "@diffci.com/diffci@latest" verify-workflow`. Keep the observer
|
|
113
151
|
out of required checks and other jobs' `needs` lists. The Action adds a job summary and a
|
|
114
152
|
`diffci-observation` artifact to the run; it does not alter which tests your other jobs execute.
|
|
115
|
-
The example pins release `v0.2.
|
|
153
|
+
The example pins release `v0.2.11` to its qualified feature commit SHA for reproducibility.
|
|
116
154
|
|
|
117
155
|
The CLI sends no report with `--no-send`. The Action uploads a GitHub artifact by default; sending to
|
|
118
156
|
DiffCI's hosted service requires an explicitly configured endpoint and token.
|
|
@@ -162,13 +200,20 @@ Adoption materials:
|
|
|
162
200
|
[`metrics`](docs/adoption-metrics.md) ·
|
|
163
201
|
[`targets`](docs/agent-adoption-targets.md).
|
|
164
202
|
|
|
165
|
-
For native agent integrations, DiffCI
|
|
203
|
+
For native agent integrations, DiffCI provides a stateless, read-only HTTPS MCP endpoint for validation
|
|
204
|
+
guidance:
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
https://diffci.com/mcp
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Use the stdio MCP server when tools need to inspect the local checkout or run tests:
|
|
166
211
|
|
|
167
212
|
```bash
|
|
168
213
|
npx -p "@diffci.com/diffci@latest" diffci-mcp
|
|
169
214
|
```
|
|
170
215
|
|
|
171
|
-
See [
|
|
216
|
+
See the [MCP server page](https://diffci.com/mcp-server) for Codex, Claude Code, Cursor, and VS Code setup, or [`docs/mcp.md`](docs/mcp.md) for repository documentation.
|
|
172
217
|
|
|
173
218
|
## Project background
|
|
174
219
|
|
|
@@ -308,7 +353,7 @@ npm run research:sandbox:deploy
|
|
|
308
353
|
DiffCI is intended to be installable as infrastructure, not only as a hosted shadow experiment:
|
|
309
354
|
|
|
310
355
|
```yaml
|
|
311
|
-
- uses: DiffCI/DiffCI.com@
|
|
356
|
+
- uses: DiffCI/DiffCI.com@e1d7bab271c5d83899bda0034d70d3e34c10c1f7
|
|
312
357
|
```
|
|
313
358
|
|
|
314
359
|
```bash
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* check analysis plus automatic paired runtime measurement
|
|
15
15
|
* observe analyse the checkout and write an observation report
|
|
16
16
|
* verify-savings run a paired full-versus-selected timing check
|
|
17
|
+
* validate-specs block conflicting same-turn change specifications
|
|
17
18
|
* verify-workflow check that a DiffCI job in this repository's workflows cannot affect other jobs
|
|
18
19
|
* version print the observer version
|
|
19
20
|
*
|
|
@@ -33,6 +34,7 @@ import { inferFullCommand, inferSelectedCommand } from "./full-command.js";
|
|
|
33
34
|
import { addDiffciPackageScripts, installDiffci } from "./install.js";
|
|
34
35
|
import { submitObservation } from "./submit.js";
|
|
35
36
|
import { sendUsageSignal } from "./usage-signal.js";
|
|
37
|
+
import { detectSpecificationConflicts, readSpecificationFile } from "./spec-conflicts.js";
|
|
36
38
|
import { formatVerifySavingsSummary, measureCommand, runVerifySavings, writeVerifySavingsReport } from "./verify-savings.js";
|
|
37
39
|
import { auditWorkflows, isNonInterfering } from "./workflow-guard.js";
|
|
38
40
|
function parseArgs(argv) {
|
|
@@ -378,6 +380,10 @@ async function runCheck(flags, env) {
|
|
|
378
380
|
cwd: repoPath,
|
|
379
381
|
timeoutMs,
|
|
380
382
|
tailBytes,
|
|
383
|
+
repetitions: numberFlag(flags, "repetitions"),
|
|
384
|
+
cacheState: parseCacheState(flags),
|
|
385
|
+
cachePreparationCommand: stringFlag(flags, "cache-prepare"),
|
|
386
|
+
alternateOrder: flags["fixed-order"] === true ? false : undefined,
|
|
381
387
|
});
|
|
382
388
|
writeVerifySavingsReport(savings, { out: savingsPath, markdown: markdownPath });
|
|
383
389
|
print(formatVerifySavingsSummary(savings));
|
|
@@ -516,6 +522,14 @@ function numberFlag(flags, name) {
|
|
|
516
522
|
throw new Error(`--${name} must be a non-negative number`);
|
|
517
523
|
return parsed;
|
|
518
524
|
}
|
|
525
|
+
function parseCacheState(flags) {
|
|
526
|
+
const value = stringFlag(flags, "cache-state");
|
|
527
|
+
if (value === undefined)
|
|
528
|
+
return undefined;
|
|
529
|
+
if (value !== "cold" && value !== "warm" && value !== "unknown")
|
|
530
|
+
throw new Error("--cache-state must be cold, warm, or unknown");
|
|
531
|
+
return value;
|
|
532
|
+
}
|
|
519
533
|
function parseVerifySavingsOptions(flags, env) {
|
|
520
534
|
const full = stringFlag(flags, "full");
|
|
521
535
|
const selected = stringFlag(flags, "selected");
|
|
@@ -541,6 +555,10 @@ function parseVerifySavingsOptions(flags, env) {
|
|
|
541
555
|
timeoutMs: numberFlag(flags, "timeout-ms") ?? 30 * 60 * 1000,
|
|
542
556
|
analysisOverheadMs: numberFlag(flags, "analysis-overhead-ms"),
|
|
543
557
|
tailBytes: numberFlag(flags, "tail-bytes") ?? 12_000,
|
|
558
|
+
repetitions: numberFlag(flags, "repetitions"),
|
|
559
|
+
cacheState: parseCacheState(flags),
|
|
560
|
+
cachePreparationCommand: stringFlag(flags, "cache-prepare"),
|
|
561
|
+
alternateOrder: flags["fixed-order"] === true ? false : undefined,
|
|
544
562
|
};
|
|
545
563
|
}
|
|
546
564
|
function runVerifySavingsCommand(flags, env) {
|
|
@@ -609,6 +627,10 @@ async function runPilot(flags, env) {
|
|
|
609
627
|
timeoutMs: numberFlag(flags, "timeout-ms") ?? 30 * 60 * 1000,
|
|
610
628
|
analysisOverheadMs: numberFlag(flags, "analysis-overhead-ms"),
|
|
611
629
|
tailBytes: numberFlag(flags, "tail-bytes") ?? 12_000,
|
|
630
|
+
repetitions: numberFlag(flags, "repetitions"),
|
|
631
|
+
cacheState: parseCacheState(flags),
|
|
632
|
+
cachePreparationCommand: stringFlag(flags, "cache-prepare"),
|
|
633
|
+
alternateOrder: flags["fixed-order"] === true ? false : undefined,
|
|
612
634
|
});
|
|
613
635
|
writeVerifySavingsReport(savings, { out: savingsPath, markdown: markdownPath });
|
|
614
636
|
console.log(formatVerifySavingsSummary(savings));
|
|
@@ -616,6 +638,22 @@ async function runPilot(flags, env) {
|
|
|
616
638
|
console.log(` markdown: ${markdownPath}`);
|
|
617
639
|
return savings.comparison.evidenceValid ? 0 : 1;
|
|
618
640
|
}
|
|
641
|
+
function runValidateSpecs(flags) {
|
|
642
|
+
const file = stringFlag(flags, "file");
|
|
643
|
+
if (!file)
|
|
644
|
+
throw new Error("validate-specs requires --file <json>");
|
|
645
|
+
const report = detectSpecificationConflicts(readSpecificationFile(file));
|
|
646
|
+
if (flags.json === true)
|
|
647
|
+
console.log(JSON.stringify(report, null, 2));
|
|
648
|
+
else if (report.valid)
|
|
649
|
+
console.log(`DiffCI specification validation: no conflicts across ${report.specificationsChecked} specification(s) and ${report.logicalTargetsChecked} logical target(s).`);
|
|
650
|
+
else {
|
|
651
|
+
console.log(`DiffCI specification validation: BLOCKED (${report.conflicts.length} logical-target conflict${report.conflicts.length === 1 ? "" : "s"})`);
|
|
652
|
+
for (const blocker of report.blockers)
|
|
653
|
+
console.log(` ${blocker}`);
|
|
654
|
+
}
|
|
655
|
+
return report.valid ? 0 : 1;
|
|
656
|
+
}
|
|
619
657
|
const USAGE = `diffci - change-aware CI analysis and paired timing
|
|
620
658
|
|
|
621
659
|
Usage:
|
|
@@ -630,6 +668,9 @@ Usage:
|
|
|
630
668
|
diffci verify-savings --repo <path> --full <command>
|
|
631
669
|
(--selected <command> | --selected-from-report <file>)
|
|
632
670
|
--out <file> [--markdown <file>] [--label <name>]
|
|
671
|
+
[--repetitions <1-20>] [--cache-state cold|warm|unknown]
|
|
672
|
+
[--cache-prepare <command>] [--fixed-order]
|
|
673
|
+
diffci validate-specs --file <json> [--json]
|
|
633
674
|
diffci verify-workflow [--repo <path>]
|
|
634
675
|
diffci version
|
|
635
676
|
|
|
@@ -642,6 +683,7 @@ check analyzes the change, runs inferred full and selected commands, and shows m
|
|
|
642
683
|
pilot runs observe and verify-savings together, writing reports to ../diffci-output by default.
|
|
643
684
|
observe analyses the checkout and writes one JSON report. It runs nothing and changes nothing.
|
|
644
685
|
verify-savings runs both commands and reports measured paired runtime; it is an opt-in pilot command.
|
|
686
|
+
validate-specs checks an explicit list of specification IDs and logical targets and blocks duplicates.
|
|
645
687
|
verify-workflow checks that the job running DiffCI cannot affect any other job, and exits 1 if it can.
|
|
646
688
|
|
|
647
689
|
The report is sent only when both --api-url and --api-token are given (or DIFFCI_API_URL and
|
|
@@ -677,6 +719,9 @@ async function main() {
|
|
|
677
719
|
case "verify-savings":
|
|
678
720
|
process.exitCode = runVerifySavingsCommand(flags, env);
|
|
679
721
|
return;
|
|
722
|
+
case "validate-specs":
|
|
723
|
+
process.exitCode = runValidateSpecs(flags);
|
|
724
|
+
return;
|
|
680
725
|
case "verify-workflow":
|
|
681
726
|
process.exitCode = runVerifyWorkflow(flags, env);
|
|
682
727
|
return;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
function normalizeTarget(target) {
|
|
4
|
+
return target.trim();
|
|
5
|
+
}
|
|
6
|
+
export function detectSpecificationConflicts(specifications) {
|
|
7
|
+
const ids = new Set();
|
|
8
|
+
const owners = new Map();
|
|
9
|
+
for (const specification of specifications) {
|
|
10
|
+
if (!specification || typeof specification.id !== "string" || !specification.id.trim())
|
|
11
|
+
throw new Error("every specification requires a non-empty id");
|
|
12
|
+
const id = specification.id.trim();
|
|
13
|
+
if (ids.has(id))
|
|
14
|
+
throw new Error(`duplicate specification id: ${id}`);
|
|
15
|
+
ids.add(id);
|
|
16
|
+
const rawTargets = Array.isArray(specification.logicalTarget) ? specification.logicalTarget : [specification.logicalTarget];
|
|
17
|
+
if (!rawTargets.length || rawTargets.some((target) => typeof target !== "string" || !target.trim())) {
|
|
18
|
+
throw new Error(`specification ${id} requires at least one non-empty logicalTarget`);
|
|
19
|
+
}
|
|
20
|
+
for (const rawTarget of rawTargets) {
|
|
21
|
+
const target = normalizeTarget(rawTarget);
|
|
22
|
+
const targetOwners = owners.get(target) ?? new Set();
|
|
23
|
+
targetOwners.add(id);
|
|
24
|
+
owners.set(target, targetOwners);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const conflicts = [...owners.entries()]
|
|
28
|
+
.filter(([, targetOwners]) => targetOwners.size > 1)
|
|
29
|
+
.map(([logicalTarget, targetOwners]) => ({ logicalTarget, specificationIds: [...targetOwners].sort() }))
|
|
30
|
+
.sort((a, b) => a.logicalTarget.localeCompare(b.logicalTarget));
|
|
31
|
+
return {
|
|
32
|
+
schema: "diffci.specConflicts.v1",
|
|
33
|
+
valid: conflicts.length === 0,
|
|
34
|
+
specificationsChecked: specifications.length,
|
|
35
|
+
logicalTargetsChecked: owners.size,
|
|
36
|
+
conflicts,
|
|
37
|
+
blockers: conflicts.map((conflict) => `logical target "${conflict.logicalTarget}" is changed by specifications ${conflict.specificationIds.join(", ")}`),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function readSpecificationFile(path) {
|
|
41
|
+
const parsed = JSON.parse(readFileSync(resolve(path), "utf8"));
|
|
42
|
+
const specifications = Array.isArray(parsed)
|
|
43
|
+
? parsed
|
|
44
|
+
: parsed && typeof parsed === "object" && Array.isArray(parsed.specifications)
|
|
45
|
+
? parsed.specifications
|
|
46
|
+
: undefined;
|
|
47
|
+
if (!specifications)
|
|
48
|
+
throw new Error("specification file must be an array or an object with a specifications array");
|
|
49
|
+
return specifications;
|
|
50
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
-
import {
|
|
3
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { arch, cpus, platform, release, totalmem } from "node:os";
|
|
5
|
+
import { basename, dirname, resolve } from "node:path";
|
|
6
|
+
import { classifyFailureFromEvidence, computeFailureFingerprint } from "../preflight/fingerprint.js";
|
|
5
7
|
function tail(value, bytes) {
|
|
6
8
|
if (Buffer.byteLength(value, "utf8") <= bytes)
|
|
7
9
|
return value;
|
|
@@ -32,20 +34,93 @@ function readSelectionFromObservation(path) {
|
|
|
32
34
|
observerVersion: typeof parsed.observer?.version === "string" ? parsed.observer.version : undefined,
|
|
33
35
|
};
|
|
34
36
|
}
|
|
37
|
+
const DEPENDENCY_INPUT_NAMES = new Set([
|
|
38
|
+
"package.json", "package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock", "bun.lock", "bun.lockb",
|
|
39
|
+
"pom.xml", "settings.gradle", "settings.gradle.kts", "build.gradle", "build.gradle.kts", "gradle.lockfile",
|
|
40
|
+
"go.mod", "go.sum", "go.work", "go.work.sum", "cargo.toml", "cargo.lock", "pyproject.toml", "poetry.lock",
|
|
41
|
+
"pipfile", "pipfile.lock", "uv.lock", "gemfile", "gemfile.lock", "composer.json", "composer.lock",
|
|
42
|
+
]);
|
|
43
|
+
const RESOLVED_DEPENDENCY_MARKERS = [
|
|
44
|
+
"node_modules/.package-lock.json",
|
|
45
|
+
"node_modules/.modules.yaml",
|
|
46
|
+
".pnp.cjs",
|
|
47
|
+
".pnp.data.json",
|
|
48
|
+
"vendor/composer/installed.json",
|
|
49
|
+
];
|
|
50
|
+
function gitBuffer(cwd, args) {
|
|
51
|
+
try {
|
|
52
|
+
return execFileSync("git", args, { cwd, encoding: "buffer", stdio: ["ignore", "pipe", "ignore"], maxBuffer: 256 * 1024 * 1024 });
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function nulPaths(buffer) {
|
|
59
|
+
if (!buffer)
|
|
60
|
+
return [];
|
|
61
|
+
return buffer.toString("utf8").split("\0").filter(Boolean);
|
|
62
|
+
}
|
|
63
|
+
function hashFiles(cwd, paths, seed = "") {
|
|
64
|
+
const hash = createHash("sha256").update(seed);
|
|
65
|
+
for (const path of [...new Set(paths)].sort()) {
|
|
66
|
+
hash.update("\0path\0").update(path);
|
|
67
|
+
const absolute = resolve(cwd, path);
|
|
68
|
+
try {
|
|
69
|
+
const stat = lstatSync(absolute);
|
|
70
|
+
hash.update(stat.isSymbolicLink() ? "symlink" : stat.isFile() ? "file" : "other");
|
|
71
|
+
if (stat.isFile() || stat.isSymbolicLink())
|
|
72
|
+
hash.update(readFileSync(absolute));
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
hash.update("missing");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return hash.digest("hex");
|
|
79
|
+
}
|
|
80
|
+
function dirtyContentDigest(cwd, status) {
|
|
81
|
+
const modified = nulPaths(gitBuffer(cwd, ["ls-files", "-m", "-o", "--exclude-standard", "-z"]));
|
|
82
|
+
const staged = nulPaths(gitBuffer(cwd, ["diff", "--cached", "--name-only", "-z"]));
|
|
83
|
+
return hashFiles(cwd, [...modified, ...staged], status);
|
|
84
|
+
}
|
|
85
|
+
function dependencyInputs(cwd) {
|
|
86
|
+
const listed = nulPaths(gitBuffer(cwd, ["ls-files", "-c", "-o", "--exclude-standard", "-z"]));
|
|
87
|
+
if (!listed.length)
|
|
88
|
+
return undefined;
|
|
89
|
+
const files = listed.filter((path) => {
|
|
90
|
+
if (path.split(/[\\/]/).includes("node_modules"))
|
|
91
|
+
return false;
|
|
92
|
+
const name = basename(path).toLowerCase();
|
|
93
|
+
return DEPENDENCY_INPUT_NAMES.has(name) || /^requirements(?:[-_.].+)?\.txt$/i.test(name);
|
|
94
|
+
}).sort();
|
|
95
|
+
return { files, sha256: hashFiles(cwd, files, "diffci-dependency-inputs-v1") };
|
|
96
|
+
}
|
|
97
|
+
function resolvedDependencyMarkers(cwd) {
|
|
98
|
+
const files = RESOLVED_DEPENDENCY_MARKERS.filter((path) => existsSync(resolve(cwd, path)));
|
|
99
|
+
return files.length ? { files, sha256: hashFiles(cwd, files, "diffci-resolved-dependencies-v1") } : undefined;
|
|
100
|
+
}
|
|
35
101
|
function checkoutSnapshot(cwd) {
|
|
36
102
|
const capturedAt = new Date().toISOString();
|
|
37
103
|
try {
|
|
38
104
|
const headSha = execFileSync("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
39
105
|
const status = execFileSync("git", ["status", "--porcelain=v1", "-z", "--untracked-files=all"], { cwd, encoding: "buffer", stdio: ["ignore", "pipe", "ignore"] });
|
|
40
|
-
|
|
106
|
+
const dependencies = dependencyInputs(cwd);
|
|
107
|
+
const resolved = resolvedDependencyMarkers(cwd);
|
|
108
|
+
return {
|
|
109
|
+
capturedAt,
|
|
110
|
+
headSha,
|
|
111
|
+
worktreeDigest: dirtyContentDigest(cwd, status),
|
|
112
|
+
dependencyInputsSha256: dependencies?.sha256,
|
|
113
|
+
dependencyInputFiles: dependencies?.files,
|
|
114
|
+
resolvedDependencySha256: resolved?.sha256,
|
|
115
|
+
resolvedDependencyFiles: resolved?.files,
|
|
116
|
+
};
|
|
41
117
|
}
|
|
42
118
|
catch {
|
|
43
119
|
return { capturedAt };
|
|
44
120
|
}
|
|
45
121
|
}
|
|
46
|
-
function buildProvenance(selection, beforeFull, afterFull, afterSelected) {
|
|
122
|
+
function buildProvenance(selection, beforeFull, afterFull, afterSelected, snapshots = [beforeFull, afterFull, afterSelected]) {
|
|
47
123
|
const invalidReasons = [];
|
|
48
|
-
const snapshots = [beforeFull, afterFull, afterSelected];
|
|
49
124
|
const expectedHeadSha = selection.headSha ?? (selection.source === "manual" ? beforeFull.headSha : undefined);
|
|
50
125
|
if (snapshots.some(snapshot => !snapshot.headSha || !snapshot.worktreeDigest))
|
|
51
126
|
invalidReasons.push("checkout identity could not be captured for every execution boundary");
|
|
@@ -57,6 +132,13 @@ function buildProvenance(selection, beforeFull, afterFull, afterSelected) {
|
|
|
57
132
|
invalidReasons.push("checkout HEAD changed during paired execution");
|
|
58
133
|
if (new Set(snapshots.map(snapshot => snapshot.worktreeDigest)).size !== 1)
|
|
59
134
|
invalidReasons.push("worktree changed during paired execution");
|
|
135
|
+
if (snapshots.some(snapshot => !snapshot.dependencyInputsSha256))
|
|
136
|
+
invalidReasons.push("dependency input identity could not be captured for every execution boundary");
|
|
137
|
+
if (new Set(snapshots.map(snapshot => snapshot.dependencyInputsSha256)).size !== 1)
|
|
138
|
+
invalidReasons.push("dependency manifests or lockfiles changed during paired execution");
|
|
139
|
+
const resolved = snapshots.map(snapshot => snapshot.resolvedDependencySha256);
|
|
140
|
+
if (resolved.some(Boolean) && (resolved.some(value => !value) || new Set(resolved).size !== 1))
|
|
141
|
+
invalidReasons.push("resolved dependency markers changed during paired execution");
|
|
60
142
|
return {
|
|
61
143
|
baseSha: selection.baseSha,
|
|
62
144
|
headSha: expectedHeadSha,
|
|
@@ -65,6 +147,7 @@ function buildProvenance(selection, beforeFull, afterFull, afterSelected) {
|
|
|
65
147
|
beforeFull,
|
|
66
148
|
afterFull,
|
|
67
149
|
afterSelected,
|
|
150
|
+
snapshots,
|
|
68
151
|
checkoutStable: invalidReasons.length === 0,
|
|
69
152
|
invalidReasons,
|
|
70
153
|
};
|
|
@@ -78,6 +161,83 @@ function resolveSelection(options) {
|
|
|
78
161
|
throw new Error("--selected <command> or --selected-from-report <path> is required");
|
|
79
162
|
return { command: options.selected, source: "manual" };
|
|
80
163
|
}
|
|
164
|
+
function captureRunnerIdentity(env = process.env) {
|
|
165
|
+
const identity = {
|
|
166
|
+
platform: platform(),
|
|
167
|
+
architecture: arch(),
|
|
168
|
+
osRelease: release(),
|
|
169
|
+
nodeVersion: process.version,
|
|
170
|
+
cpuModel: cpus()[0]?.model,
|
|
171
|
+
cpuCount: cpus().length,
|
|
172
|
+
totalMemoryBytes: totalmem(),
|
|
173
|
+
ci: env.GITHUB_ACTIONS === "true" ? "github-actions" : env.CI ? String(env.CI) : undefined,
|
|
174
|
+
runnerName: env.RUNNER_NAME,
|
|
175
|
+
runnerOs: env.RUNNER_OS,
|
|
176
|
+
runnerArch: env.RUNNER_ARCH,
|
|
177
|
+
runnerEnvironment: env.RUNNER_ENVIRONMENT,
|
|
178
|
+
imageOs: env.ImageOS,
|
|
179
|
+
imageVersion: env.ImageVersion,
|
|
180
|
+
};
|
|
181
|
+
return {
|
|
182
|
+
...identity,
|
|
183
|
+
fingerprintSha256: createHash("sha256").update(JSON.stringify(identity)).digest("hex"),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function range(values) {
|
|
187
|
+
if (!values.length)
|
|
188
|
+
return { min: 0, median: 0, max: 0 };
|
|
189
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
190
|
+
const middle = Math.floor(sorted.length / 2);
|
|
191
|
+
const median = sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;
|
|
192
|
+
return { min: sorted[0], median, max: sorted[sorted.length - 1] };
|
|
193
|
+
}
|
|
194
|
+
function failureEvidence(measurement, arm, trial) {
|
|
195
|
+
if (measurement.exitCode === 0 && !measurement.timedOut)
|
|
196
|
+
return undefined;
|
|
197
|
+
const errorText = `${measurement.stderrTail}\n${measurement.stdoutTail}`.trim() || `exit ${String(measurement.exitCode)}`;
|
|
198
|
+
const failureClass = measurement.timedOut
|
|
199
|
+
? "TIMEOUT"
|
|
200
|
+
: classifyFailureFromEvidence({ jobName: `verify-savings:${arm}`, command: measurement.command, errorText });
|
|
201
|
+
return {
|
|
202
|
+
arm,
|
|
203
|
+
trial,
|
|
204
|
+
failureClass,
|
|
205
|
+
// The arm is reported separately. Keep it out of the normalized fingerprint so
|
|
206
|
+
// an identical repository failure in both arms can be recognized as pre-existing.
|
|
207
|
+
fingerprint: computeFailureFingerprint({ failureClass, jobName: "verify-savings", errorText }),
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function assessFailures(trials) {
|
|
211
|
+
const evidence = trials.flatMap((trial) => [
|
|
212
|
+
failureEvidence(trial.full, "full", trial.index),
|
|
213
|
+
failureEvidence(trial.selected, "selected", trial.index),
|
|
214
|
+
]).filter((value) => value !== undefined);
|
|
215
|
+
if (!evidence.length)
|
|
216
|
+
return { kind: "none", confidence: "not-applicable", explanation: "Every measured arm passed.", evidence };
|
|
217
|
+
const fullPasses = trials.map((trial) => trial.full.exitCode === 0 && !trial.full.timedOut);
|
|
218
|
+
const selectedPasses = trials.map((trial) => trial.selected.exitCode === 0 && !trial.selected.timedOut);
|
|
219
|
+
const varying = (values) => new Set(values).size > 1;
|
|
220
|
+
if (varying(fullPasses) || varying(selectedPasses)) {
|
|
221
|
+
return { kind: "likely_flaky", confidence: trials.length >= 3 ? "medium" : "low", explanation: "At least one arm changed pass/fail outcome across repeated executions.", evidence };
|
|
222
|
+
}
|
|
223
|
+
if (evidence.some((item) => item.failureClass === "RUNNER_INFRASTRUCTURE" || item.failureClass === "TIMEOUT")) {
|
|
224
|
+
return { kind: "infrastructure", confidence: "medium", explanation: "Failure output matched a narrow timeout or runner-infrastructure signature.", evidence };
|
|
225
|
+
}
|
|
226
|
+
const fullFailures = evidence.filter((item) => item.arm === "full");
|
|
227
|
+
const selectedFailures = evidence.filter((item) => item.arm === "selected");
|
|
228
|
+
const stableFull = fullFailures.length === trials.length && new Set(fullFailures.map((item) => item.fingerprint)).size === 1;
|
|
229
|
+
const stableSelected = selectedFailures.length === trials.length && new Set(selectedFailures.map((item) => item.fingerprint)).size === 1;
|
|
230
|
+
if (stableFull && selectedFailures.length === 0) {
|
|
231
|
+
if (trials.length >= 3) {
|
|
232
|
+
return { kind: "selection_miss", confidence: "high", explanation: "The full arm reproduced the same failure in at least three trials while every selected arm passed. Inspect the omitted test before treating the selection as safe.", evidence };
|
|
233
|
+
}
|
|
234
|
+
return { kind: "inconclusive", confidence: "low", explanation: "The full arm failed while the selected arm passed, but fewer than three repetitions cannot separate a stable miss from a flake.", evidence };
|
|
235
|
+
}
|
|
236
|
+
if (stableFull && stableSelected && fullFailures[0]?.fingerprint === selectedFailures[0]?.fingerprint) {
|
|
237
|
+
return { kind: "pre_existing", confidence: trials.length >= 2 ? "medium" : "low", explanation: "Both arms reproduced the same normalized failure signature; it is shared rather than evidence of an omitted-test miss.", evidence };
|
|
238
|
+
}
|
|
239
|
+
return { kind: "inconclusive", confidence: "low", explanation: "The failures were not stable enough to classify conservatively.", evidence };
|
|
240
|
+
}
|
|
81
241
|
export function measureCommand(command, options) {
|
|
82
242
|
const startedAt = new Date().toISOString();
|
|
83
243
|
const started = Date.now();
|
|
@@ -111,15 +271,47 @@ export function measureCommand(command, options) {
|
|
|
111
271
|
};
|
|
112
272
|
}
|
|
113
273
|
export function buildVerifySavingsReport(input) {
|
|
274
|
+
const defaultProtocol = {
|
|
275
|
+
repetitions: 1,
|
|
276
|
+
alternatingOrder: false,
|
|
277
|
+
declaredCacheState: "unknown",
|
|
278
|
+
cacheStateControlled: false,
|
|
279
|
+
};
|
|
280
|
+
const protocol = input.protocol ?? defaultProtocol;
|
|
281
|
+
const provenance = input.provenance ?? {
|
|
282
|
+
beforeFull: { capturedAt: input.full.startedAt },
|
|
283
|
+
afterFull: { capturedAt: input.full.finishedAt },
|
|
284
|
+
afterSelected: { capturedAt: input.selected.finishedAt },
|
|
285
|
+
checkoutStable: false,
|
|
286
|
+
invalidReasons: ["checkout provenance was not captured"],
|
|
287
|
+
};
|
|
288
|
+
const trials = input.trials ?? [{
|
|
289
|
+
index: 1,
|
|
290
|
+
order: ["full", "selected"],
|
|
291
|
+
cacheState: { full: "unknown", selected: "potentially-warmed" },
|
|
292
|
+
preparations: [],
|
|
293
|
+
full: input.full,
|
|
294
|
+
selected: input.selected,
|
|
295
|
+
provenance,
|
|
296
|
+
}];
|
|
297
|
+
const fullRange = range(trials.map((trial) => trial.full.wallMs));
|
|
298
|
+
const selectedRange = range(trials.map((trial) => trial.selected.wallMs));
|
|
114
299
|
const overhead = input.analysisOverheadMs ?? 0;
|
|
115
|
-
const netSelectedMs =
|
|
116
|
-
const deltaMs =
|
|
117
|
-
const grossPercentChange =
|
|
118
|
-
const percentChange =
|
|
119
|
-
const fullCommandSucceeded =
|
|
120
|
-
const selectedCommandSucceeded =
|
|
121
|
-
const missedFailureSignal =
|
|
122
|
-
const
|
|
300
|
+
const netSelectedMs = selectedRange.median + overhead;
|
|
301
|
+
const deltaMs = fullRange.median - netSelectedMs;
|
|
302
|
+
const grossPercentChange = fullRange.median > 0 ? ((fullRange.median - selectedRange.median) / fullRange.median) * 100 : 0;
|
|
303
|
+
const percentChange = fullRange.median > 0 ? (deltaMs / fullRange.median) * 100 : 0;
|
|
304
|
+
const fullCommandSucceeded = trials.every((trial) => trial.full.exitCode === 0 && !trial.full.timedOut);
|
|
305
|
+
const selectedCommandSucceeded = trials.every((trial) => trial.selected.exitCode === 0 && !trial.selected.timedOut);
|
|
306
|
+
const missedFailureSignal = trials.some((trial) => (trial.full.exitCode !== 0 || trial.full.timedOut) && trial.selected.exitCode === 0 && !trial.selected.timedOut);
|
|
307
|
+
const preparationsSucceeded = trials.every((trial) => trial.preparations.every((preparation) => preparation.exitCode === 0 && !preparation.timedOut));
|
|
308
|
+
const evidenceValid = fullCommandSucceeded && selectedCommandSucceeded && provenance.checkoutStable && preparationsSucceeded;
|
|
309
|
+
const performanceEvidence = !evidenceValid
|
|
310
|
+
? "INVALID"
|
|
311
|
+
: protocol.repetitions >= 3 && protocol.alternatingOrder && protocol.cacheStateControlled
|
|
312
|
+
? "CONTROLLED"
|
|
313
|
+
: "PRELIMINARY";
|
|
314
|
+
const failureAssessment = input.failureAssessment ?? assessFailures(trials);
|
|
123
315
|
const notes = [
|
|
124
316
|
"This is paired runtime evidence, not a production-savings claim.",
|
|
125
317
|
"Full and selected commands were run sequentially in the same checkout.",
|
|
@@ -127,12 +319,15 @@ export function buildVerifySavingsReport(input) {
|
|
|
127
319
|
? "No analysis overhead was provided, so net selected runtime equals selected command runtime."
|
|
128
320
|
: "Net selected runtime includes DiffCI analysis overhead.",
|
|
129
321
|
];
|
|
322
|
+
notes.push(performanceEvidence === "CONTROLLED"
|
|
323
|
+
? "Runtime evidence used at least three alternating, cache-prepared repetitions."
|
|
324
|
+
: "Runtime evidence is preliminary until at least three alternating, cache-prepared repetitions agree.");
|
|
130
325
|
if (missedFailureSignal)
|
|
131
326
|
notes.push("Full failed while selected passed; inspect outputs before treating the selection as safe.");
|
|
132
327
|
if (input.provenance && !input.provenance.checkoutStable)
|
|
133
328
|
notes.push(`Checkout provenance invalid: ${input.provenance.invalidReasons.join("; ")}.`);
|
|
134
329
|
return {
|
|
135
|
-
schema: "diffci.verifySavings.
|
|
330
|
+
schema: "diffci.verifySavings.v3",
|
|
136
331
|
producedAt: input.producedAt ?? new Date().toISOString(),
|
|
137
332
|
label: input.label,
|
|
138
333
|
cwd: input.cwd,
|
|
@@ -142,18 +337,16 @@ export function buildVerifySavingsReport(input) {
|
|
|
142
337
|
observationReportPath: input.selection.observationReportPath,
|
|
143
338
|
selectedTestCount: input.selection.selectedTestCount,
|
|
144
339
|
totalTestCount: input.selection.totalTestCount,
|
|
145
|
-
provenance
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
invalidReasons: ["checkout provenance was not captured"],
|
|
151
|
-
},
|
|
340
|
+
provenance,
|
|
341
|
+
runnerIdentity: input.runnerIdentity ?? captureRunnerIdentity(),
|
|
342
|
+
protocol,
|
|
343
|
+
trials,
|
|
344
|
+
failureAssessment,
|
|
152
345
|
full: input.full,
|
|
153
346
|
selected: input.selected,
|
|
154
347
|
comparison: {
|
|
155
|
-
fullWallMs:
|
|
156
|
-
selectedWallMs:
|
|
348
|
+
fullWallMs: fullRange.median,
|
|
349
|
+
selectedWallMs: selectedRange.median,
|
|
157
350
|
netSelectedMs,
|
|
158
351
|
deltaMs,
|
|
159
352
|
grossPercentChange,
|
|
@@ -162,6 +355,10 @@ export function buildVerifySavingsReport(input) {
|
|
|
162
355
|
fullCommandSucceeded,
|
|
163
356
|
missedFailureSignal,
|
|
164
357
|
evidenceValid,
|
|
358
|
+
performanceEvidence,
|
|
359
|
+
repetitions: trials.length,
|
|
360
|
+
fullWallMsRange: fullRange,
|
|
361
|
+
selectedWallMsRange: selectedRange,
|
|
165
362
|
},
|
|
166
363
|
notes,
|
|
167
364
|
};
|
|
@@ -195,7 +392,9 @@ export function renderVerifySavingsMarkdown(report) {
|
|
|
195
392
|
? "Inspect the failed command output and rerun before treating this as savings evidence."
|
|
196
393
|
: !report.comparison.evidenceValid
|
|
197
394
|
? "Fix the checkout/provenance issue and rerun before treating this as savings evidence."
|
|
198
|
-
:
|
|
395
|
+
: report.comparison.performanceEvidence === "CONTROLLED"
|
|
396
|
+
? "Review the repeated-run distribution and failure assessment before considering a production trial."
|
|
397
|
+
: "Repeat at least three times with alternating order and a cache-preparation command to establish controlled cache state before making a production-savings claim.";
|
|
199
398
|
return `${title}
|
|
200
399
|
|
|
201
400
|
Produced at: ${report.producedAt}
|
|
@@ -217,6 +416,27 @@ ${!report.comparison.fullCommandSucceeded || !report.comparison.selectedCommandS
|
|
|
217
416
|
| Net selected runtime | ${formatMs(report.comparison.netSelectedMs)} |
|
|
218
417
|
| Delta vs full | ${formatMs(report.comparison.deltaMs)} ${deltaLabel} |
|
|
219
418
|
| Percent change vs full | ${formatPercent(report.comparison.percentChange)} |
|
|
419
|
+
| Runtime evidence | ${report.comparison.performanceEvidence.toLowerCase()} |
|
|
420
|
+
| Repetitions | ${report.comparison.repetitions} |
|
|
421
|
+
| Full runtime range | ${formatMs(report.comparison.fullWallMsRange.min)} / ${formatMs(report.comparison.fullWallMsRange.median)} / ${formatMs(report.comparison.fullWallMsRange.max)} (min/median/max) |
|
|
422
|
+
| Selected runtime range | ${formatMs(report.comparison.selectedWallMsRange.min)} / ${formatMs(report.comparison.selectedWallMsRange.median)} / ${formatMs(report.comparison.selectedWallMsRange.max)} (min/median/max) |
|
|
423
|
+
|
|
424
|
+
## Measurement Protocol
|
|
425
|
+
|
|
426
|
+
| Field | Value |
|
|
427
|
+
| --- | --- |
|
|
428
|
+
| Alternating arm order | ${report.protocol.alternatingOrder ? "yes" : "no"} |
|
|
429
|
+
| Declared cache state | ${report.protocol.declaredCacheState} |
|
|
430
|
+
| Cache preparation command | ${report.protocol.cachePreparationCommand ? `\`${report.protocol.cachePreparationCommand.replaceAll("|", "\\|")}\`` : "not provided"} |
|
|
431
|
+
| Cache state controlled | ${report.protocol.cacheStateControlled ? "yes" : "no"} |
|
|
432
|
+
|
|
433
|
+
## Failure Assessment
|
|
434
|
+
|
|
435
|
+
| Field | Value |
|
|
436
|
+
| --- | --- |
|
|
437
|
+
| Classification | ${report.failureAssessment.kind} |
|
|
438
|
+
| Confidence | ${report.failureAssessment.confidence} |
|
|
439
|
+
| Explanation | ${report.failureAssessment.explanation} |
|
|
220
440
|
|
|
221
441
|
## Provenance
|
|
222
442
|
|
|
@@ -227,6 +447,9 @@ ${!report.comparison.fullCommandSucceeded || !report.comparison.selectedCommandS
|
|
|
227
447
|
| Observation SHA-256 | \`${report.provenance.observationSha256 ?? "unavailable"}\` |
|
|
228
448
|
| DiffCI observer version | ${report.provenance.observerVersion ?? "unavailable"} |
|
|
229
449
|
| Checkout stable across both arms | ${report.provenance.checkoutStable ? "yes" : "no"} |
|
|
450
|
+
| Dependency inputs SHA-256 | \`${report.provenance.beforeFull.dependencyInputsSha256 ?? "unavailable"}\` |
|
|
451
|
+
| Resolved dependency markers SHA-256 | \`${report.provenance.beforeFull.resolvedDependencySha256 ?? "unavailable"}\` |
|
|
452
|
+
| Runner identity SHA-256 | \`${report.runnerIdentity.fingerprintSha256}\` |
|
|
230
453
|
|
|
231
454
|
## Commands
|
|
232
455
|
|
|
@@ -240,7 +463,7 @@ ${!report.comparison.fullCommandSucceeded || !report.comparison.selectedCommandS
|
|
|
240
463
|
| Question | Answer |
|
|
241
464
|
| --- | --- |
|
|
242
465
|
| Command coverage | ${commandCoverage} |
|
|
243
|
-
| Cache state |
|
|
466
|
+
| Cache state | ${report.protocol.cacheStateControlled ? `${report.protocol.declaredCacheState}; reset/preparation applied before each arm.` : `${report.protocol.declaredCacheState}; not independently controlled.`} |
|
|
244
467
|
| Invalid evidence handling | Failed commands or unstable checkout provenance are labelled diagnostic only above. |
|
|
245
468
|
| Next step | ${nextStep} |
|
|
246
469
|
|
|
@@ -256,21 +479,73 @@ function writeText(path, value) {
|
|
|
256
479
|
export function runVerifySavings(options) {
|
|
257
480
|
const selection = resolveSelection(options);
|
|
258
481
|
const analysisOverheadMs = options.analysisOverheadMs ?? selection.analysisOverheadMs;
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
482
|
+
const repetitions = options.repetitions ?? 1;
|
|
483
|
+
if (!Number.isInteger(repetitions) || repetitions < 1 || repetitions > 20)
|
|
484
|
+
throw new Error("--repetitions must be an integer from 1 to 20");
|
|
485
|
+
const declaredCacheState = options.cacheState ?? "unknown";
|
|
486
|
+
if (!["cold", "warm", "unknown"].includes(declaredCacheState))
|
|
487
|
+
throw new Error("--cache-state must be cold, warm, or unknown");
|
|
488
|
+
const alternatingOrder = options.alternateOrder ?? repetitions > 1;
|
|
489
|
+
const protocol = {
|
|
490
|
+
repetitions,
|
|
491
|
+
alternatingOrder,
|
|
492
|
+
declaredCacheState,
|
|
493
|
+
cachePreparationCommand: options.cachePreparationCommand,
|
|
494
|
+
cacheStateControlled: declaredCacheState !== "unknown" && Boolean(options.cachePreparationCommand),
|
|
495
|
+
};
|
|
496
|
+
const trials = [];
|
|
497
|
+
for (let index = 0; index < repetitions; index++) {
|
|
498
|
+
const order = alternatingOrder && index % 2 === 1 ? ["selected", "full"] : ["full", "selected"];
|
|
499
|
+
const preparations = [];
|
|
500
|
+
const measurements = {};
|
|
501
|
+
const snapshots = [];
|
|
502
|
+
for (const arm of order) {
|
|
503
|
+
if (options.cachePreparationCommand)
|
|
504
|
+
preparations.push(measureCommand(options.cachePreparationCommand, options));
|
|
505
|
+
snapshots.push(checkoutSnapshot(options.cwd));
|
|
506
|
+
measurements[arm] = measureCommand(arm === "full" ? options.full : selection.command, options);
|
|
507
|
+
snapshots.push(checkoutSnapshot(options.cwd));
|
|
508
|
+
}
|
|
509
|
+
const full = measurements.full;
|
|
510
|
+
const selected = measurements.selected;
|
|
511
|
+
const beforeFull = order[0] === "full" ? snapshots[0] : snapshots[2];
|
|
512
|
+
const afterFull = order[0] === "full" ? snapshots[1] : snapshots[3];
|
|
513
|
+
const afterSelected = order[0] === "selected" ? snapshots[1] : snapshots[3];
|
|
514
|
+
const provenance = buildProvenance(selection, beforeFull, afterFull, afterSelected, snapshots);
|
|
515
|
+
const firstState = declaredCacheState;
|
|
516
|
+
const secondState = options.cachePreparationCommand
|
|
517
|
+
? declaredCacheState
|
|
518
|
+
: declaredCacheState === "warm"
|
|
519
|
+
? "warm"
|
|
520
|
+
: "potentially-warmed";
|
|
521
|
+
trials.push({
|
|
522
|
+
index: index + 1,
|
|
523
|
+
order,
|
|
524
|
+
cacheState: order[0] === "full"
|
|
525
|
+
? { full: firstState, selected: secondState }
|
|
526
|
+
: { selected: firstState, full: secondState },
|
|
527
|
+
preparations,
|
|
528
|
+
full,
|
|
529
|
+
selected,
|
|
530
|
+
provenance,
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
const first = trials[0];
|
|
534
|
+
const allSnapshots = trials.flatMap((trial) => trial.provenance.snapshots ?? []);
|
|
535
|
+
const provenance = buildProvenance(selection, first.provenance.beforeFull, first.provenance.afterFull, first.provenance.afterSelected, allSnapshots);
|
|
265
536
|
return buildVerifySavingsReport({
|
|
266
537
|
label: options.label,
|
|
267
538
|
cwd: options.cwd,
|
|
268
539
|
timeoutMs: options.timeoutMs,
|
|
269
540
|
analysisOverheadMs,
|
|
270
541
|
selection,
|
|
271
|
-
full,
|
|
272
|
-
selected,
|
|
542
|
+
full: first.full,
|
|
543
|
+
selected: first.selected,
|
|
273
544
|
provenance,
|
|
545
|
+
runnerIdentity: captureRunnerIdentity(),
|
|
546
|
+
protocol,
|
|
547
|
+
trials,
|
|
548
|
+
failureAssessment: assessFailures(trials),
|
|
274
549
|
});
|
|
275
550
|
}
|
|
276
551
|
export function writeVerifySavingsReport(report, paths) {
|
|
@@ -281,16 +556,18 @@ export function writeVerifySavingsReport(report, paths) {
|
|
|
281
556
|
export function formatVerifySavingsSummary(report) {
|
|
282
557
|
if (!report.comparison.fullCommandSucceeded || !report.comparison.selectedCommandSucceeded) {
|
|
283
558
|
return "DiffCI verify-savings: comparison invalid because one or both commands failed" +
|
|
559
|
+
`\n failure assessment: ${report.failureAssessment.kind} (${report.failureAssessment.confidence}) - ${report.failureAssessment.explanation}` +
|
|
284
560
|
(report.comparison.missedFailureSignal ? "\n warning: full failed while selected passed; inspect outputs before claiming safety" : "");
|
|
285
561
|
}
|
|
286
562
|
if (!report.comparison.evidenceValid) {
|
|
287
563
|
return `DiffCI verify-savings: comparison invalid because checkout provenance failed\n ${report.provenance.invalidReasons.join("; ")}`;
|
|
288
564
|
}
|
|
289
565
|
const lines = [
|
|
290
|
-
`DiffCI verify-savings: test execution ${Math.abs(report.comparison.grossPercentChange).toFixed(1)}% ${report.comparison.grossPercentChange >= 0 ? "faster" : "slower"}
|
|
566
|
+
`DiffCI verify-savings: ${report.comparison.performanceEvidence === "CONTROLLED" ? "controlled repeated" : "preliminary"} test execution ${Math.abs(report.comparison.grossPercentChange).toFixed(1)}% ${report.comparison.grossPercentChange >= 0 ? "faster" : "slower"} (${report.comparison.repetitions} ${report.comparison.repetitions === 1 ? "trial" : "trials"})`,
|
|
291
567
|
` full: ${formatMs(report.comparison.fullWallMs)}`,
|
|
292
568
|
` selected: ${formatMs(report.comparison.selectedWallMs)} + analysis ${formatMs(report.analysisOverheadMs ?? 0)} = ${formatMs(report.comparison.netSelectedMs)}`,
|
|
293
569
|
` net including analysis: ${Math.abs(report.comparison.percentChange).toFixed(1)}% ${report.comparison.deltaMs >= 0 ? "faster" : "slower"} (${formatMs(Math.abs(report.comparison.deltaMs))} ${report.comparison.deltaMs >= 0 ? "saved" : "added"})`,
|
|
570
|
+
` cache: ${report.protocol.declaredCacheState}${report.protocol.cacheStateControlled ? " (prepared before each arm)" : " (not controlled)"}`,
|
|
294
571
|
];
|
|
295
572
|
if (report.comparison.missedFailureSignal) {
|
|
296
573
|
lines.push(" warning: full failed while selected passed; inspect outputs before claiming safety");
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Ordered most-specific-first. A pattern here is real error-message vocabulary observed in this
|
|
2
|
+
// project's own actual CI failures (see docs/research/2026-08-22-preflight-p0-historical-failure-study.md
|
|
3
|
+
// case studies) or well-known tool output, not invented from memory.
|
|
4
|
+
const CLASSIFICATION_RULES = [
|
|
5
|
+
{ failureClass: "TIMEOUT", patterns: [/timed? ?out/i, /exceeded the timeout/i, /context deadline exceeded/i] },
|
|
6
|
+
{ failureClass: "RUNNER_INFRASTRUCTURE", patterns: [/runner has received a shutdown signal/i, /lost communication with the server/i, /econnreset/i, /the job was canceled because/i, /no space left on device/i, /1101\b/i, /container (start|start collision)/i] },
|
|
7
|
+
{ failureClass: "CONFIGURATION", patterns: [/ERR_UNKNOWN_BUILTIN_MODULE/i, /environment variable .* is not set/i, /missing required secret/i, /invalid configuration/i, /engines\.node/i, /unsupported engine/i] },
|
|
8
|
+
{ failureClass: "DEPENDENCY", patterns: [/npm error (?:code )?(?:E404|ERESOLVE|EAI_AGAIN)/i, /could not resolve host/i, /module not found/i, /cannot find module/i, /peer dep(?:endency)? (?:conflict|missing)/i] },
|
|
9
|
+
{ failureClass: "TYPECHECK", patterns: [/error TS\d{4}/i, /tsc --noEmit/i] },
|
|
10
|
+
{ failureClass: "LINT", patterns: [/eslint/i, /\d+ problems? \(\d+ errors?/i] },
|
|
11
|
+
{ failureClass: "BUILD", patterns: [/build failed/i, /compilation failed/i, /webpack (?:compiled with|failed)/i] },
|
|
12
|
+
{ failureClass: "GENERATED_ARTIFACT", patterns: [/generated file(?:s)? (?:is|are) out of date/i, /diff detected in generated/i, /snapshot mismatch/i] },
|
|
13
|
+
{ failureClass: "SECURITY_SCAN", patterns: [/codeql/i, /security alert/i, /vulnerability found/i] },
|
|
14
|
+
{ failureClass: "DEPLOYMENT", patterns: [/deploy(?:ment)? failed/i, /wrangler deploy.*error/i, /rollout failed/i] },
|
|
15
|
+
{ failureClass: "INTEGRATION_TEST", patterns: [/integration test/i] },
|
|
16
|
+
{ failureClass: "UNIT_TEST", patterns: [/ERR_TEST_FAILURE/i, /not ok \d+/i, /AssertionError/i, /expected .* to (?:equal|be)/i] },
|
|
17
|
+
];
|
|
18
|
+
export function classifyFailureFromEvidence(evidence) {
|
|
19
|
+
const haystack = `${evidence.command ?? ""} ${evidence.errorText}`;
|
|
20
|
+
for (const rule of CLASSIFICATION_RULES) {
|
|
21
|
+
if (rule.patterns.some((p) => p.test(haystack)))
|
|
22
|
+
return rule.failureClass;
|
|
23
|
+
}
|
|
24
|
+
return "UNKNOWN";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Normalizes volatile, incidental details out of an error message before fingerprinting (Part 3):
|
|
28
|
+
* - absolute filesystem paths -> a repo-relative-shaped placeholder
|
|
29
|
+
* - line:column numbers -> stripped (the same logical error at a slightly different line is still the
|
|
30
|
+
* same failure family)
|
|
31
|
+
* - hex hashes/ids (commit SHAs, container ids, uuids) -> stripped
|
|
32
|
+
* - ISO timestamps and other digit runs that look like durations/ids -> stripped
|
|
33
|
+
*/
|
|
34
|
+
function normalizeErrorText(text) {
|
|
35
|
+
return text
|
|
36
|
+
.replace(/\/[\w./-]+(?:\.tsx?|\.jsx?|\.mjs|\.cjs)/g, "<path>")
|
|
37
|
+
.replace(/:\d+:\d+/g, "") // line:column
|
|
38
|
+
.replace(/\b[0-9a-f]{7,40}\b/gi, "<hash>")
|
|
39
|
+
.replace(/\b\d{4}-\d{2}-\d{2}T[\d:.]+Z?\b/g, "<timestamp>")
|
|
40
|
+
.replace(/\b\d+ms\b|\b\d+(?:\.\d+)?s\b/g, "<duration>")
|
|
41
|
+
.replace(/\b\d+\.\d+\b/g, "<duration>") // bare decimals (e.g. "duration_ms: 301.23") - almost always an incidental measurement, not part of the error's identity
|
|
42
|
+
.replace(/\s+/g, " ")
|
|
43
|
+
.trim()
|
|
44
|
+
.toLowerCase();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* failure_fingerprint (Part 3): failureClass + job/step class + a normalized error signature + (when
|
|
48
|
+
* known) the specific failing test/module identifier - deliberately NOT the raw log. Two occurrences of
|
|
49
|
+
* "the same" failure (identical error class, same test, same normalized message) produce the identical
|
|
50
|
+
* fingerprint even if timestamps/paths/durations differ between the two CI runs.
|
|
51
|
+
*/
|
|
52
|
+
export function computeFailureFingerprint(input) {
|
|
53
|
+
const parts = [
|
|
54
|
+
input.failureClass,
|
|
55
|
+
input.jobName.toLowerCase().trim(),
|
|
56
|
+
input.stepName?.toLowerCase().trim() ?? "",
|
|
57
|
+
input.failingTest?.toLowerCase().trim() ?? "",
|
|
58
|
+
normalizeErrorText(input.errorText).slice(0, 200), // bounded - a fingerprint is an identity key, not a log excerpt
|
|
59
|
+
];
|
|
60
|
+
return parts.join("|");
|
|
61
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const FAILURE_CLASSES = [
|
|
2
|
+
"TYPECHECK", "LINT", "BUILD", "UNIT_TEST", "INTEGRATION_TEST", "DEPENDENCY", "CONFIGURATION",
|
|
3
|
+
"GENERATED_ARTIFACT", "SECURITY_SCAN", "DEPLOYMENT", "RUNNER_INFRASTRUCTURE", "TIMEOUT", "FLAKY", "UNKNOWN",
|
|
4
|
+
];
|
|
5
|
+
export function isFailureClass(value) {
|
|
6
|
+
return FAILURE_CLASSES.includes(value);
|
|
7
|
+
}
|
package/docs/adoption-metrics.md
CHANGED
|
@@ -97,7 +97,7 @@ They are supporting signals only.
|
|
|
97
97
|
|
|
98
98
|
| Signal | Value | Interpretation |
|
|
99
99
|
| --- | ---: | --- |
|
|
100
|
-
| npm latest version | `0.2.
|
|
100
|
+
| npm latest version | `0.2.11` | Current CLI and MCP binaries are publicly available. |
|
|
101
101
|
| npm downloads, last complete registry week (`2026-09-15`–`2026-09-21`) | 1,929 | Distribution activity; not unique users or repositories. |
|
|
102
102
|
| GitHub stars / forks / watchers | 0 / 0 / 0 | No repository-level community conversion yet. |
|
|
103
103
|
| GitHub views, available 14-day window | 18 views / 4 unique visitors | Early discovery signal. |
|
|
@@ -120,6 +120,7 @@ Existing outreach log:
|
|
|
120
120
|
| 2026-09-22 | ciembor/agent-rules-books | Issue | https://github.com/ciembor/agent-rules-books/issues/8 | Open; no reply as of 2026-09-25 | Follow up once on 2026-09-30; offer a PR only if invited. |
|
|
121
121
|
| 2026-09-22 | jbarbier/CLAUDE.md | Issue | https://github.com/jbarbier/CLAUDE.md/issues/12 | Open; no reply as of 2026-09-25 | Follow up once on 2026-09-30; offer a PR only if invited. |
|
|
122
122
|
| 2026-09-22 | Official MCP Registry | Directory | `io.github.adityankale190895/diffci` | Published | Consider moving to `io.github.DiffCI/diffci` after GitHub org namespace authorization is available. |
|
|
123
|
+
| 2026-09-25 | Official MCP Registry | Directory | `io.github.DiffCI/diffci` | Migration in progress | Organization namespace authorized through GitHub OIDC. |
|
|
123
124
|
| 2026-09-22 | Glama | Directory | TBD | Planned | Submit repository URL. |
|
|
124
125
|
| 2026-09-22 | Smithery | Directory | TBD | Blocked | Needs Smithery account/API key. |
|
|
125
126
|
|
|
@@ -30,7 +30,7 @@ jobs:
|
|
|
30
30
|
- uses: actions/checkout@v4
|
|
31
31
|
with:
|
|
32
32
|
fetch-depth: 0
|
|
33
|
-
- uses: DiffCI/DiffCI.com@
|
|
33
|
+
- uses: DiffCI/DiffCI.com@e1d7bab271c5d83899bda0034d70d3e34c10c1f7 # v0.2.11
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
Run `npx "@diffci.com/diffci@latest" verify-workflow` before starting a pilot. The Action uploads a
|
|
@@ -31,7 +31,7 @@ small optional-instruction PR from [`agent-adoption-kit.md`](agent-adoption-kit.
|
|
|
31
31
|
|
|
32
32
|
| Directory | Submission path | Status |
|
|
33
33
|
| --- | --- | --- |
|
|
34
|
-
| [Official MCP Registry](https://github.com/modelcontextprotocol/registry) |
|
|
34
|
+
| [Official MCP Registry](https://github.com/modelcontextprotocol/registry) | Publish with GitHub OIDC as `io.github.DiffCI/diffci`. | Publishing under the authorized organization namespace. |
|
|
35
35
|
| [Glama](https://glama.ai/) | Submit the GitHub repository URL and short description; optional `glama.json` metadata can improve indexing. | Ready to submit. |
|
|
36
36
|
| [Smithery](https://smithery.ai/) | Publish through Smithery's server release flow/API. | Needs Smithery account/API key. |
|
|
37
37
|
| [PulseMCP](https://www.pulsemcp.com/) | Submit/list the MCP server if their current listing flow accepts third-party servers. | Review current submission rules first. |
|
package/docs/ai-agents.md
CHANGED
|
@@ -58,7 +58,13 @@ Examples:
|
|
|
58
58
|
|
|
59
59
|
## MCP
|
|
60
60
|
|
|
61
|
-
Agents that support MCP can
|
|
61
|
+
Agents that support remote MCP can connect to the stateless, read-only guidance endpoint:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
https://diffci.com/mcp
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
To inspect the current checkout or run tests, use the native stdio tool server:
|
|
62
68
|
|
|
63
69
|
```bash
|
|
64
70
|
npx -p "@diffci.com/diffci@latest" diffci-mcp
|
package/docs/distribution.md
CHANGED
|
@@ -68,10 +68,10 @@ jobs:
|
|
|
68
68
|
- uses: actions/checkout@v4
|
|
69
69
|
with:
|
|
70
70
|
fetch-depth: 0
|
|
71
|
-
- uses: DiffCI/DiffCI.com@
|
|
71
|
+
- uses: DiffCI/DiffCI.com@e1d7bab271c5d83899bda0034d70d3e34c10c1f7
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
The example pins release `v0.2.
|
|
74
|
+
The example pins release `v0.2.11` to its qualified feature commit SHA. `npx "@diffci.com/diffci@latest" verify-workflow`
|
|
75
75
|
checks that the job is dedicated, read-only, not required by other jobs, and unable to alter the rest
|
|
76
76
|
of CI.
|
|
77
77
|
|
|
@@ -136,7 +136,7 @@ the OSS core rather than define a separate feature tier. The readiness checklist
|
|
|
136
136
|
and documentation versions. Prepare a future release with:
|
|
137
137
|
|
|
138
138
|
```bash
|
|
139
|
-
npm run release:sync -- 0.2.
|
|
139
|
+
npm run release:sync -- 0.2.11 <qualified-40-character-action-sha>
|
|
140
140
|
npm run check:public-metadata
|
|
141
141
|
```
|
|
142
142
|
|
package/docs/mcp.md
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
|
-
# DiffCI MCP
|
|
1
|
+
# DiffCI MCP Servers
|
|
2
2
|
|
|
3
|
-
DiffCI
|
|
3
|
+
DiffCI provides a public Streamable HTTP endpoint for read-only validation guidance:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
https://diffci.com/mcp
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Add that URL to clients that accept remote HTTPS MCP servers. It exposes:
|
|
10
|
+
|
|
11
|
+
- `diffci_validation_plan` for safe local command planning;
|
|
12
|
+
- `diffci_interpret_report` for validating and summarizing `diffci.observation.v1` reports;
|
|
13
|
+
- `diffci_verify_workflow_text` for a preliminary, stateless GitHub Actions isolation check;
|
|
14
|
+
- the `diffci_validate_change` prompt and agent-policy/setup resources.
|
|
15
|
+
|
|
16
|
+
The endpoint is stateless, needs no credentials, and does not execute a command. It receives no
|
|
17
|
+
repository content unless a caller explicitly supplies a report or workflow document to a tool.
|
|
18
|
+
|
|
19
|
+
Copyable Codex, Claude Code, Cursor, and VS Code setup is at https://diffci.com/mcp-server.
|
|
20
|
+
|
|
21
|
+
## Local Checkout Tools
|
|
22
|
+
|
|
23
|
+
DiffCI also ships a stdio MCP server. Use it when MCP tools must inspect the current checkout or run
|
|
24
|
+
tests:
|
|
4
25
|
|
|
5
26
|
Run it with:
|
|
6
27
|
|
|
@@ -8,7 +29,7 @@ Run it with:
|
|
|
8
29
|
npx -p "@diffci.com/diffci@latest" diffci-mcp
|
|
9
30
|
```
|
|
10
31
|
|
|
11
|
-
## MCP Client Config
|
|
32
|
+
## Stdio MCP Client Config
|
|
12
33
|
|
|
13
34
|
Use this stdio configuration in clients that accept MCP JSON. Set `cwd` to the repository where the
|
|
14
35
|
agent should run DiffCI.
|
|
@@ -48,7 +69,7 @@ Available tools:
|
|
|
48
69
|
- `diffci_init` - runs `diffci init` to seed agent instruction files.
|
|
49
70
|
- `diffci_verify_workflow` - runs `diffci verify-workflow` to check non-interference.
|
|
50
71
|
|
|
51
|
-
The MCP server delegates to the same open-source CLI. `diffci_check` sends nothing to DiffCI Cloud,
|
|
72
|
+
The stdio MCP server delegates to the same open-source CLI. `diffci_check` sends nothing to DiffCI Cloud,
|
|
52
73
|
but it runs test commands when it can infer them. Use the CLI's `observe --no-send` for analysis only.
|
|
53
74
|
|
|
54
75
|
Keep required project CI authoritative. DiffCI output is a validation lens, not permission to skip
|
|
@@ -63,6 +84,7 @@ Discovery links:
|
|
|
63
84
|
- Agent docs: https://diffci.com/docs/ai-agents
|
|
64
85
|
- LLM discovery file: https://diffci.com/llms.txt
|
|
65
86
|
- MCP command: `npx -p "@diffci.com/diffci@latest" diffci-mcp`
|
|
87
|
+
- HTTPS MCP endpoint: https://diffci.com/mcp
|
|
66
88
|
|
|
67
89
|
Short description:
|
|
68
90
|
|
package/docs/npm-adoption.md
CHANGED
|
@@ -38,7 +38,7 @@ jobs:
|
|
|
38
38
|
- uses: actions/checkout@v4
|
|
39
39
|
with:
|
|
40
40
|
fetch-depth: 0
|
|
41
|
-
- uses: DiffCI/DiffCI.com@
|
|
41
|
+
- uses: DiffCI/DiffCI.com@e1d7bab271c5d83899bda0034d70d3e34c10c1f7
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
## Outreach Copy
|
|
@@ -98,7 +98,10 @@ What the report means:
|
|
|
98
98
|
|
|
99
99
|
Run both steps from the same repository root with the same checked-out revision. These commands
|
|
100
100
|
execute repository code. The full run can warm caches for the selected run, so repeat comparisons
|
|
101
|
-
with controlled cache state before drawing conclusions.
|
|
101
|
+
with controlled cache state before drawing conclusions. Add `--repetitions 3` to alternate arm order.
|
|
102
|
+
Use `--cache-state cold|warm` together with `--cache-prepare <command>` to run a repository-owned cache
|
|
103
|
+
preparation/reset step before every arm. Without all three, runtime evidence remains labelled
|
|
104
|
+
`PRELIMINARY`. DiffCI never deletes caches automatically. A passing pair does not establish selection safety.
|
|
102
105
|
|
|
103
106
|
- Full runtime is measured from `--full`.
|
|
104
107
|
- Selected runtime is measured from DiffCI's proposed command in the observation report.
|
|
@@ -107,10 +110,13 @@ with controlled cache state before drawing conclusions. A passing pair does not
|
|
|
107
110
|
- Net selected runtime is selected runtime plus analysis overhead.
|
|
108
111
|
- If the full command fails while the selected command passes, the report is a safety warning, not a
|
|
109
112
|
savings result.
|
|
113
|
+
- Repeated runs classify stable full-only failures, likely flakes, shared/pre-existing failures,
|
|
114
|
+
infrastructure failures, and inconclusive evidence. Fewer than three repetitions never establish a
|
|
115
|
+
high-confidence selection miss.
|
|
110
116
|
- The savings report binds the pair to the observation's base/head SHAs and SHA-256 digest, and records
|
|
111
|
-
the checked-out HEAD plus
|
|
112
|
-
|
|
113
|
-
pass.
|
|
117
|
+
the checked-out HEAD plus byte-level dirty-worktree, manifest/lockfile, available resolved-dependency,
|
|
118
|
+
and runner fingerprints at every execution boundary. A missing identity or changed fingerprint
|
|
119
|
+
invalidates the comparison even when both commands pass.
|
|
114
120
|
|
|
115
121
|
Before sharing a Markdown report with a maintainer, check that it answers these review questions:
|
|
116
122
|
|
package/glama.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "DiffCI",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "Change-aware CI validation, affected-test selection, and workflow safety for coding agents.",
|
|
4
4
|
"category": "developer-tools",
|
|
5
|
-
"homepage": "https://diffci.com/
|
|
5
|
+
"homepage": "https://diffci.com/mcp-server",
|
|
6
6
|
"repository": "https://github.com/DiffCI/DiffCI.com",
|
|
7
7
|
"license": "AGPL-3.0-only",
|
|
8
8
|
"install": {
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diffci.com/diffci",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Change-aware CI analysis and conservative affected-test selection for GitHub Actions and coding agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
7
7
|
"cicd",
|
|
8
|
+
"ci-cd",
|
|
9
|
+
"mcp",
|
|
10
|
+
"model-context-protocol",
|
|
8
11
|
"ai-agents",
|
|
9
12
|
"coding-agents",
|
|
10
13
|
"claude-code",
|
|
@@ -13,10 +16,12 @@
|
|
|
13
16
|
"copilot",
|
|
14
17
|
"grok",
|
|
15
18
|
"test-selection",
|
|
19
|
+
"test-impact-analysis",
|
|
20
|
+
"affected-tests",
|
|
16
21
|
"github-actions"
|
|
17
22
|
],
|
|
18
23
|
"license": "AGPL-3.0-only",
|
|
19
|
-
"mcpName": "io.github.
|
|
24
|
+
"mcpName": "io.github.DiffCI/diffci",
|
|
20
25
|
"repository": {
|
|
21
26
|
"type": "git",
|
|
22
27
|
"url": "git+https://github.com/DiffCI/DiffCI.com.git"
|
|
@@ -34,6 +39,7 @@
|
|
|
34
39
|
"files": [
|
|
35
40
|
"action.yml",
|
|
36
41
|
"dist-client/src/client",
|
|
42
|
+
"dist-client/src/preflight",
|
|
37
43
|
"README.md",
|
|
38
44
|
"server.json",
|
|
39
45
|
"glama.json",
|
|
@@ -132,7 +138,8 @@
|
|
|
132
138
|
"ci:benchmark": "tsx scripts/ci-inference-benchmark.ts",
|
|
133
139
|
"ci:reproduce": "tsx scripts/ci-reproduction.ts",
|
|
134
140
|
"check:oss-boundary": "node scripts/check-oss-boundary.mjs",
|
|
135
|
-
"check:public-metadata": "node scripts/check-public-metadata.mjs"
|
|
141
|
+
"check:public-metadata": "node scripts/check-public-metadata.mjs",
|
|
142
|
+
"registry:verify": "node scripts/verify-mcp-registry.mjs"
|
|
136
143
|
},
|
|
137
144
|
"dependencies": {
|
|
138
145
|
"@diffci.com/core": "git+https://github.com/DiffCI/core.git#db1d637dfcca8d8f7fa047500dfe0027d0d018a7",
|
package/server.json
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
-
"name": "io.github.
|
|
3
|
+
"name": "io.github.DiffCI/diffci",
|
|
4
4
|
"title": "DiffCI",
|
|
5
|
-
"description": "
|
|
6
|
-
"version": "0.2.
|
|
7
|
-
"websiteUrl": "https://diffci.com/
|
|
5
|
+
"description": "Change-aware CI validation and affected-test guidance for coding agents.",
|
|
6
|
+
"version": "0.2.11",
|
|
7
|
+
"websiteUrl": "https://diffci.com/mcp-server",
|
|
8
8
|
"repository": {
|
|
9
9
|
"url": "https://github.com/DiffCI/DiffCI.com",
|
|
10
10
|
"source": "github"
|
|
11
11
|
},
|
|
12
|
+
"icons": [
|
|
13
|
+
{
|
|
14
|
+
"src": "https://diffci.com/assets/diffci-mark.svg",
|
|
15
|
+
"mimeType": "image/svg+xml",
|
|
16
|
+
"sizes": [
|
|
17
|
+
"any"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
],
|
|
12
21
|
"packages": [
|
|
13
22
|
{
|
|
14
23
|
"registryType": "npm",
|
|
15
24
|
"identifier": "@diffci.com/diffci",
|
|
16
|
-
"version": "0.2.
|
|
25
|
+
"version": "0.2.11",
|
|
17
26
|
"transport": {
|
|
18
27
|
"type": "stdio"
|
|
19
28
|
},
|
|
@@ -24,5 +33,11 @@
|
|
|
24
33
|
}
|
|
25
34
|
]
|
|
26
35
|
}
|
|
36
|
+
],
|
|
37
|
+
"remotes": [
|
|
38
|
+
{
|
|
39
|
+
"type": "streamable-http",
|
|
40
|
+
"url": "https://diffci.com/mcp"
|
|
41
|
+
}
|
|
27
42
|
]
|
|
28
43
|
}
|