@holmes-lab/holmes-kit 0.40.0 → 0.40.1
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/CHANGELOG.md +234 -0
- package/README.md +70 -4
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/index.js +25 -19
- package/dist/holmes/cli/interactive-prompt.d.ts +39 -2
- package/dist/holmes/cli/interactive-prompt.js +98 -16
- package/dist/holmes/config/config.d.ts +17 -0
- package/dist/holmes/config/config.js +13 -1
- package/dist/holmes/governance/autonomy.d.ts +7 -0
- package/dist/holmes/governance/autonomy.js +36 -5
- package/dist/holmes/governance/push-gate-runner.d.ts +2 -0
- package/dist/holmes/governance/push-gate-runner.js +40 -3
- package/dist/holmes/governance/push-gate.d.ts +13 -2
- package/dist/holmes/governance/push-gate.js +106 -14
- package/dist/holmes/guardrail/advisory-line.d.ts +102 -0
- package/dist/holmes/guardrail/advisory-line.js +718 -0
- package/dist/holmes/guardrail/impact-gate.d.ts +6 -0
- package/dist/holmes/guardrail/impact-gate.js +32 -5
- package/dist/holmes/hooks/pre-tool-use.d.ts +11 -0
- package/dist/holmes/hooks/pre-tool-use.js +44 -5
- package/dist/holmes/hooks/session-start.js +17 -1
- package/dist/holmes/mcp/handlers/maintenance-analysis.d.ts +13 -0
- package/dist/holmes/mcp/handlers/maintenance-analysis.js +59 -2
- package/dist/holmes/mcp/handlers/test-execution.d.ts +470 -3
- package/dist/holmes/mcp/handlers/test-execution.js +199 -21
- package/dist/holmes/mcp/handlers.d.ts +468 -3
- package/dist/holmes/mcp/handlers.js +5 -1
- package/dist/holmes/mcp/maintenance-analyze.d.ts +5 -0
- package/dist/holmes/mcp/maintenance-analyze.js +4 -2
- package/dist/holmes/mcp/maintenance-evidence.d.ts +9 -0
- package/dist/holmes/mcp/maintenance-evidence.js +4 -1
- package/dist/holmes/mcp/tool-schemas.js +13 -7
- package/dist/holmes/project/baseline.d.ts +15 -2
- package/dist/holmes/project/baseline.js +11 -6
- package/dist/holmes/project/bounded-io.d.ts +1 -0
- package/dist/holmes/project/bounded-io.js +4 -2
- package/dist/holmes/project/change-source.d.ts +4 -0
- package/dist/holmes/project/change-source.js +13 -5
- package/dist/holmes/project/root.js +3 -1
- package/dist/holmes/review/evidence-mode.d.ts +21 -0
- package/dist/holmes/review/evidence-mode.js +33 -0
- package/dist/holmes/review/head-worktree.d.ts +55 -0
- package/dist/holmes/review/head-worktree.js +329 -0
- package/dist/holmes/review/mrp.js +13 -3
- package/dist/holmes/review/run-provenance.d.ts +45 -0
- package/dist/holmes/review/run-provenance.js +314 -0
- package/dist/holmes/review/test-evidence.d.ts +174 -0
- package/dist/holmes/review/test-evidence.js +330 -2
- package/dist/holmes/review/test-reports.d.ts +94 -0
- package/dist/holmes/review/test-reports.js +382 -0
- package/dist/holmes/review/test-runner.d.ts +176 -65
- package/dist/holmes/review/test-runner.js +531 -316
- package/dist/holmes/review/test-units.d.ts +159 -0
- package/dist/holmes/review/test-units.js +814 -0
- package/package.json +1 -1
- package/playbooks/publish/PLAYBOOK.md +2 -1
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.createTestExecutionHandlers = createTestExecutionHandlers;
|
|
37
|
-
// @implements A-SPEC-616, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-121.2, A-SPEC-121.3, A-SPEC-128, A-SPEC-130, A-SPEC-189, A-SPEC-233, A-SPEC-419, A-SPEC-433, A-SPEC-534.5, A-SPEC-534.8, A-SPEC-578.4, A-SPEC-614, A-SPEC-734, A-SPEC-768.1
|
|
37
|
+
// @implements A-SPEC-616, A-SPEC-100.2, A-SPEC-102.1, A-SPEC-121.2, A-SPEC-121.3, A-SPEC-128, A-SPEC-130, A-SPEC-189, A-SPEC-233, A-SPEC-419, A-SPEC-433, A-SPEC-534.5, A-SPEC-534.8, A-SPEC-578.4, A-SPEC-614, A-SPEC-734, A-SPEC-768.1, A-SPEC-466.1, A-SPEC-466.2, A-SPEC-466.3, A-SPEC-466.6, A-SPEC-128.2, A-SPEC-128.4, A-SPEC-128.5, A-SPEC-128.6, A-SPEC-128.7, A-SPEC-128.8, A-SPEC-128.9, A-SPEC-128.10, A-SPEC-128.13
|
|
38
38
|
const fs = __importStar(require("node:fs"));
|
|
39
39
|
const path = __importStar(require("node:path"));
|
|
40
40
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -48,10 +48,13 @@ const rtm_builder_1 = require("../../rtm/rtm-builder");
|
|
|
48
48
|
const test_scope_1 = require("../../rtm/test-scope");
|
|
49
49
|
const scope_1 = require("../../review/scope");
|
|
50
50
|
const test_runner_1 = require("../../review/test-runner");
|
|
51
|
+
const head_worktree_1 = require("../../review/head-worktree");
|
|
51
52
|
const kills_1 = require("../../spec/kills");
|
|
52
53
|
const mutate_1 = require("../../review/mutate");
|
|
53
54
|
const kills_check_1 = require("../../review/kills-check");
|
|
54
55
|
const test_evidence_1 = require("../../review/test-evidence");
|
|
56
|
+
const config_1 = require("../../config/config");
|
|
57
|
+
const evidence_mode_1 = require("../../review/evidence-mode");
|
|
55
58
|
const test_outcomes_1 = require("../../review/test-outcomes");
|
|
56
59
|
const maintenance_evidence_1 = require("../maintenance-evidence");
|
|
57
60
|
const bounded_io_1 = require("../../project/bounded-io");
|
|
@@ -111,9 +114,33 @@ function sourceFileWithMutation(root, aspecId, where) {
|
|
|
111
114
|
function createTestExecutionHandlers(context) {
|
|
112
115
|
return {
|
|
113
116
|
async test_run(a) {
|
|
117
|
+
// @implements A-SPEC-128.4 — a full run is asked for, not inferred; it selects no range, so a range beside it is refused
|
|
118
|
+
// @implements A-SPEC-128.5 — null reads as omitted (as for workers); either end of a range alone is a range too
|
|
119
|
+
if (a.full === true && (a.base != null || a.head != null)) {
|
|
120
|
+
throw context.refusal('full: true runs the whole suite; base/head select a range — pass one or the other');
|
|
121
|
+
}
|
|
122
|
+
// @implements A-SPEC-128.5 — a mutation run is not a run of the suite
|
|
123
|
+
if (a.full === true && a.mutate) {
|
|
124
|
+
throw context.refusal('full: true runs the whole suite; mutate runs one T-SPEC’s mutations — pass one or the other');
|
|
125
|
+
}
|
|
126
|
+
const range = { ...a, base: a.base ?? undefined, head: a.head ?? undefined };
|
|
114
127
|
// Closes the decision->execution loop: scope -> run -> durable per-A-SPEC EXECUTION evidence
|
|
115
128
|
// (what the constitution's ART-4 prefers over the syntactic count).
|
|
116
|
-
|
|
129
|
+
// @implements A-SPEC-466.1 — a bad count is refused before anything is derived or run
|
|
130
|
+
// @implements A-SPEC-466.2 — as a handler refusal
|
|
131
|
+
// @implements A-SPEC-466.6 — the run's time budget too, the same way; it is never a judgement input
|
|
132
|
+
let workers;
|
|
133
|
+
let timeoutMinutes;
|
|
134
|
+
// @implements A-SPEC-128.5 — a requested full run defaults to 120 minutes (the 30-minute default stops this suite)
|
|
135
|
+
const askedMinutes = a.full === true && a.timeoutMinutes == null ? evidence_mode_1.FULL_RUN_DEFAULT_MINUTES : a.timeoutMinutes;
|
|
136
|
+
try {
|
|
137
|
+
workers = (0, test_runner_1.testRunWorkers)(a.workers);
|
|
138
|
+
timeoutMinutes = (0, test_runner_1.testRunTimeoutMinutes)(askedMinutes);
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
throw context.refusal(e.message);
|
|
142
|
+
}
|
|
143
|
+
const { root, specs, scanned, changedFiles, changedSymbols, changeSource, scopeFallback, anchorImpactedSpecs, changedTestFiles, unresolvedFiles } = await context.deriveChangedContext(a.root, range, 'test_run');
|
|
117
144
|
// @implements A-SPEC-534.8 — `mutate`: run a T-SPEC's declared `kills` mutations against the
|
|
118
145
|
// A-SPEC's source and report which SURVIVED (a discriminating-power gap). Selective, opt-in via
|
|
119
146
|
// the argument; absent → the ordinary run below is untouched.
|
|
@@ -128,14 +155,16 @@ function createTestExecutionHandlers(context) {
|
|
|
128
155
|
const src = aspecId ? sourceFileWithMutation(root, aspecId, m.where) : null;
|
|
129
156
|
if (!src)
|
|
130
157
|
return { mutation: m, applied: false, reason: 'no governed source anchors this A-SPEC and contains `where`' };
|
|
131
|
-
const r = (0, mutate_1.runKillsOnFile)(src, m, coveringFiles, (files) => (0, test_runner_1.runJestOutcomes)(files, root));
|
|
158
|
+
const r = (0, mutate_1.runKillsOnFile)(src, m, coveringFiles, (files) => (0, test_runner_1.runJestOutcomes)(files, root, timeoutMinutes));
|
|
132
159
|
return { mutation: m, ...r };
|
|
133
160
|
});
|
|
134
161
|
// @implements A-SPEC-662 — a mutation that never applied is UNAPPLIED, not a survivor: measured
|
|
135
162
|
// 2026-09-17, 22/22 entries here failed to apply and the response read `survivors: []` — the
|
|
136
163
|
// shape of a clean run. The pair (unapplied, survivors) now says "unverified" when it is.
|
|
137
164
|
const { survivors, unapplied } = (0, kills_check_1.partitionMutateResults)(results);
|
|
138
|
-
|
|
165
|
+
// @implements A-SPEC-466.2 — a valid count is ignored here, and the answer says so
|
|
166
|
+
return { mutate: { tspec: a.mutate, aspec: aspecId, coveringFiles, results, survivors, unapplied },
|
|
167
|
+
workers: null, workersIgnored: workers !== undefined ? 'mutate' : undefined, timeoutMinutes };
|
|
139
168
|
}
|
|
140
169
|
const g = new rtm_graph_1.RtmGraph();
|
|
141
170
|
let testScope;
|
|
@@ -155,7 +184,11 @@ function createTestExecutionHandlers(context) {
|
|
|
155
184
|
// @implements A-SPEC-128
|
|
156
185
|
// No change set means no basis for narrowing. Widening is the same fail-safe direction
|
|
157
186
|
// computeTestScope already takes when no anchored test resolves — never a silently narrow run.
|
|
158
|
-
if (
|
|
187
|
+
if (a.full === true) {
|
|
188
|
+
// @implements A-SPEC-128.4 — the same widening path, asked for by name
|
|
189
|
+
testScope = { ...testScope, tier: 'full', reason: 'full run requested (full: true) — the whole suite, as push evidence needs' };
|
|
190
|
+
}
|
|
191
|
+
else if (scopeFallback === 'full') {
|
|
159
192
|
testScope = { ...testScope, tier: 'full', reason: `${changeSource.reason ?? 'no change set'} — cannot narrow safely, full regression` };
|
|
160
193
|
}
|
|
161
194
|
}
|
|
@@ -165,30 +198,155 @@ function createTestExecutionHandlers(context) {
|
|
|
165
198
|
// @implements A-SPEC-128.1 — the baseline is the tree this run TESTED, so it is hashed before the runner starts:
|
|
166
199
|
// hashed afterwards, a test file written during a passing run and an edit made during it entered last-green as
|
|
167
200
|
// green, and the next scoped run skipped them as unchanged (measured 2026-10-01).
|
|
168
|
-
const ig = (0, ignore_1.loadIgnore)(root); // parse .gitignore ONCE, not per file (round-10)
|
|
169
|
-
const testedTree = (0, change_source_1.hashTree)(root, { isIgnored: (p) => ig.isIgnored(p) });
|
|
170
|
-
const result = (0, test_runner_1.runTestScope)(testScope, root);
|
|
171
|
-
const anchors = (0, test_scope_1.scanTestAnchors)(root);
|
|
172
|
-
const executedByAspec = (0, test_evidence_1.computeExecutedByAspec)(result.executedByFile ?? {}, anchors);
|
|
173
|
-
// @implements A-SPEC-768.1 — an anchor list the grammar does not read is named beside the attribution it could
|
|
174
|
-
// not make (measured 2026-10-11: `A-SPEC-107; A-SPEC-122` counted A-SPEC-107 only, silently). Diagnosis only:
|
|
175
|
-
// `executedByAspec` is exactly what the grammar read.
|
|
176
|
-
const anchorDiagnostics = (0, test_scope_1.scanTestAnchorDiagnostics)(root).map((d) => ({ ...d, hint: ANCHOR_SEPARATOR_HINT }));
|
|
177
201
|
let head = '';
|
|
178
202
|
try {
|
|
179
203
|
head = (0, node_child_process_1.execFileSync)('git', ['-C', root, 'rev-parse', 'HEAD'], { timeout: bounded_io_1.GIT_TIMEOUT_MS, maxBuffer: bounded_io_1.GIT_MAX_BUFFER, encoding: 'utf8', env: (0, root_1.cleanSubprocessEnv)(), stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
180
204
|
}
|
|
181
205
|
catch { /* non-git */ }
|
|
206
|
+
// @implements A-SPEC-128.13 — W1/W4: a full run answers "is this commit green" on the commit itself: a clean
|
|
207
|
+
// worktree of HEAD (outside the repository, A-SPEC-128.14), where the scan, the configuration and the ignore rules are HEAD's. Scoped
|
|
208
|
+
// runs stay in the work tree (W5); a tree with no git or no commit runs in place and is never push evidence.
|
|
209
|
+
const opened = testScope.tier === 'full' && head !== '' ? (0, head_worktree_1.openHeadWorktree)(root, head, {
|
|
210
|
+
prepareOf: (dir) => { try {
|
|
211
|
+
return (0, config_1.loadConfig)(dir).testRun.prepare;
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
return undefined;
|
|
215
|
+
} },
|
|
216
|
+
// @implements A-SPEC-128.14 — L4: the prepare is bounded by the run's own budget
|
|
217
|
+
run: (cmd, args, cwd, budgetMs) => (0, test_runner_1.runBounded)(cmd, args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: bounded_io_1.GIT_MAX_BUFFER, env: (0, root_1.cleanSubprocessEnv)() }, budgetMs),
|
|
218
|
+
prepareBudgetMs: timeoutMinutes * 60_000,
|
|
219
|
+
// @implements A-SPEC-128.16 — W1: the walk bound is HEAD's declared testRun.linkWalk, only when both are positive numbers
|
|
220
|
+
walkBoundOf: (dir) => {
|
|
221
|
+
try {
|
|
222
|
+
const w = (0, config_1.loadConfig)(dir).testRun.linkWalk;
|
|
223
|
+
return w && Number.isFinite(w.entries) && Number.isFinite(w.seconds) && w.entries > 0 && w.seconds > 0 ? { entries: w.entries, seconds: w.seconds } : undefined;
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
}) : null;
|
|
230
|
+
const execRoot = opened?.ok ? opened.wt.dir : root;
|
|
231
|
+
const ig = (0, ignore_1.loadIgnore)(execRoot); // parse .gitignore ONCE, not per file (round-10)
|
|
232
|
+
const testedTree = (0, change_source_1.hashTree)(execRoot, { isIgnored: (p) => ig.isIgnored(p) });
|
|
233
|
+
// @implements A-SPEC-128.6 — the project's own exclusions reach detection as an argument
|
|
234
|
+
let excludeDirs = [];
|
|
235
|
+
try {
|
|
236
|
+
excludeDirs = (0, config_1.loadConfig)(execRoot).testRun.excludeDirs;
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
excludeDirs = [];
|
|
240
|
+
}
|
|
241
|
+
// @implements A-SPEC-128.8 — entries that match nothing (absolute, outside the root, empty) are named in the answer
|
|
242
|
+
const excludeDirsIgnored = (0, test_runner_1.normaliseExcludeDirs)(excludeDirs).ignored;
|
|
243
|
+
// @implements A-SPEC-128.9 — E3: the project's .gitignore reaches detection and the runners, beside excludeDirs
|
|
244
|
+
const isIgnored = (rel) => ig.isIgnored(rel);
|
|
245
|
+
const runStarted = Date.now();
|
|
246
|
+
let result;
|
|
247
|
+
// @implements A-SPEC-128.14 — H3: attribution, its diagnostics and the RED-first records read the anchors of the tree
|
|
248
|
+
// that ran — HEAD's worktree, read before it is closed — never the work tree's (B H3)
|
|
249
|
+
let anchors = {};
|
|
250
|
+
let anchorRows = [];
|
|
251
|
+
let worktreeLeft = null;
|
|
252
|
+
try {
|
|
253
|
+
result = opened && !opened.ok
|
|
254
|
+
// W1: a worktree that could not be made, linked or prepared is the run's environment — nothing ran
|
|
255
|
+
? { tier: testScope.tier, mode: 'full', ranFiles: [], passed: false, skipped: false, tail: opened.reason, executedByFile: {}, ranWith: [], workers: null,
|
|
256
|
+
testsRun: 0, testsRunBy: {}, stopped: false, detected: [], units: [], environment: [{ ecosystem: 'git', dir: '', reason: opened.reason }] }
|
|
257
|
+
// @implements A-SPEC-128.15 — L6: prepare and the units share one budget (at least one second is left for the units)
|
|
258
|
+
: (0, test_runner_1.runTestScope)(testScope, execRoot, { ...(workers === undefined ? {} : { workers }), excludeDirs, isIgnored,
|
|
259
|
+
timeoutMinutes: opened?.ok ? Math.max(1 / 60, timeoutMinutes - opened.wt.prepareMs / 60_000) : timeoutMinutes, ...(opened?.ok ? { sourceRoot: root } : {}) });
|
|
260
|
+
anchors = (0, test_scope_1.scanTestAnchors)(execRoot);
|
|
261
|
+
anchorRows = (0, test_scope_1.scanTestAnchorDiagnostics)(execRoot);
|
|
262
|
+
}
|
|
263
|
+
finally {
|
|
264
|
+
// @implements A-SPEC-128.15 — L5: a worktree git could not remove is named in the answer, never left silent
|
|
265
|
+
if (opened?.ok)
|
|
266
|
+
worktreeLeft = opened.wt.close();
|
|
267
|
+
}
|
|
268
|
+
// @implements A-SPEC-128.13 — W6: the marker the push gate requires, and the three times the run spent
|
|
269
|
+
const worktree = opened?.ok ? { ranIn: 'head-worktree', worktree: { createMs: opened.wt.createMs, prepareMs: opened.wt.prepareMs, runMs: Date.now() - runStarted } } : {};
|
|
270
|
+
// @implements A-SPEC-466.2 — what reached the jest argv, echoed and recorded; a given count no jest group took is named
|
|
271
|
+
const applied = result.workers ?? null;
|
|
272
|
+
// @implements A-SPEC-466.3 — nothing ran is its own reason; the runners that ran and took no count are named
|
|
273
|
+
const nothingRan = (result.ranWith ?? []).length === 0;
|
|
274
|
+
const ignored = workers !== undefined && applied === null ? { workersIgnored: nothingRan ? 'nothing ran' : 'no jest group' } : {};
|
|
275
|
+
const ignoredBy = result.workersIgnoredBy && result.workersIgnoredBy.length > 0 ? { workersIgnoredBy: result.workersIgnoredBy } : {};
|
|
276
|
+
const executedByAspec = (0, test_evidence_1.computeExecutedByAspec)(result.executedByFile ?? {}, anchors);
|
|
277
|
+
// @implements A-SPEC-768.1 — an anchor list the grammar does not read is named beside the attribution it could
|
|
278
|
+
// not make (measured 2026-10-11: `A-SPEC-107; A-SPEC-122` counted A-SPEC-107 only, silently). Diagnosis only:
|
|
279
|
+
// `executedByAspec` is exactly what the grammar read.
|
|
280
|
+
const anchorDiagnostics = anchorRows.map((d) => ({ ...d, hint: ANCHOR_SEPARATOR_HINT }));
|
|
182
281
|
// Record ONLY an actually-executed, GREEN run (review C4/C7): a red suite must not stand as
|
|
183
282
|
// coverage evidence at the moment the code is broken, and a no-op run must not overwrite a real
|
|
184
283
|
// record with a dishonest `passed: true` over an empty result.
|
|
185
284
|
// @implements A-SPEC-578.4 — read BEFORE the write below replaces it: the calibration window
|
|
186
285
|
// is "since the previous evidence run", and this line is the only moment that value exists.
|
|
187
|
-
|
|
286
|
+
// @implements A-SPEC-128.4 — the window starts at the LAST run, scoped or full: a scoped run no longer moves test-evidence
|
|
287
|
+
const previousEvidenceTs = [(0, test_evidence_1.readTestEvidence)(root)?.ts, (0, test_evidence_1.readScopedEvidence)(root)?.takenAt]
|
|
288
|
+
.filter((t) => typeof t === 'string' && t !== '').sort().pop();
|
|
188
289
|
const verified = (0, baseline_1.shouldRecordBaseline)(result);
|
|
189
|
-
|
|
190
|
-
|
|
290
|
+
// @implements A-SPEC-128.2 — only a run of the whole suite writes test-evidence and a baseline; any other run that
|
|
291
|
+
// ran writes its own record (measured 2026-11-05: a 25-test scoped green overwrote both after two red full runs).
|
|
292
|
+
// @implements A-SPEC-128.4 — decided by the same predicate the gate reads; counted by the files that executed
|
|
293
|
+
const fullRun = (0, test_evidence_1.isFullEvidence)({ mode: result.mode, tier: testScope.tier });
|
|
294
|
+
const ranFileCount = Object.keys(result.executedByFile ?? {}).length;
|
|
295
|
+
const ranWith = result.ranWith ?? [];
|
|
296
|
+
// @implements A-SPEC-128.5 — the tests that ran, and the ecosystems the project has that this run did not run
|
|
297
|
+
const testsRun = result.testsRun ?? 0;
|
|
298
|
+
// @implements A-SPEC-128.6 — per ecosystem, so an ecosystem that ran nothing cannot hide behind another's count
|
|
299
|
+
const testsRunBy = result.testsRunBy ?? {};
|
|
300
|
+
const detected = result.detected ?? [];
|
|
301
|
+
// @implements A-SPEC-128.7 — the predicate's own reading of "ran no test"
|
|
302
|
+
const missingEcosystems = (0, test_evidence_1.idleEcosystems)({ detected, testsRunBy });
|
|
303
|
+
const stopped = result.stopped === true;
|
|
304
|
+
// @implements A-SPEC-128.7 — whose each ecosystem is, what ran red, what was left out: the words a refusal needs
|
|
305
|
+
// @implements A-SPEC-128.9 — the units each ran, the runners missing, and the implementation count E2 reads
|
|
306
|
+
const named = { ...(result.detectedBy ? { detectedBy: result.detectedBy } : {}),
|
|
307
|
+
...(result.notRun?.length ? { notRun: result.notRun } : {}), ...(result.notDetected?.length ? { notDetected: result.notDetected } : {}),
|
|
308
|
+
...(result.units ? { units: result.units } : {}), ...(result.environment?.length ? { environment: result.environment } : {}),
|
|
309
|
+
...(typeof result.implementationCount === 'number' ? { implementationCount: result.implementationCount } : {}),
|
|
310
|
+
// @implements A-SPEC-128.13 — "nothing to test" also needs no test file at all
|
|
311
|
+
...(typeof result.testFileCount === 'number' ? { testFileCount: result.testFileCount } : {}),
|
|
312
|
+
// @implements A-SPEC-128.10 — what did not run (I3) and the build roots left untested (R2)
|
|
313
|
+
...(result.notExecuted?.length ? { notExecuted: result.notExecuted } : {}), ...(result.untestedCode?.length ? { untestedCode: result.untestedCode } : {}) };
|
|
314
|
+
const candidate = { ts: new Date().toISOString(), head, tier: testScope.tier, mode: evidence_mode_1.FULL_MODE, ranFileCount, ranWith, testsRun, testsRunBy, detected,
|
|
315
|
+
...named, passed: result.passed, executedByAspec, workers: applied, ...ignoredBy, timeoutMinutes, ...worktree };
|
|
316
|
+
// @implements A-SPEC-128.6 — the writer asks THE push-evidence predicate about the record it is about to write
|
|
317
|
+
const fullEvidence = verified && fullRun && !stopped && (0, test_evidence_1.isPushEvidence)(candidate, head);
|
|
318
|
+
// @implements A-SPEC-128.7 — a record that could not be written or voided is named; the run is then not judged
|
|
319
|
+
const recordFailed = [];
|
|
320
|
+
if (fullEvidence && !(0, test_evidence_1.writeTestEvidence)(root, candidate))
|
|
321
|
+
recordFailed.push('test-evidence');
|
|
322
|
+
let scopedEvidenceRecorded = false;
|
|
323
|
+
if (result.mode === 'scoped' && !result.skipped) {
|
|
324
|
+
scopedEvidenceRecorded = (0, test_evidence_1.writeScopedEvidence)(root, { takenAt: new Date().toISOString(), head, tier: testScope.tier,
|
|
325
|
+
mode: 'scoped', ranFiles: result.ranFiles ?? [], ranWith, testsRun, passed: result.passed, executedByAspec });
|
|
326
|
+
}
|
|
327
|
+
else if (fullRun && !fullEvidence && !result.skipped) {
|
|
328
|
+
// @implements A-SPEC-128.5 — a full run that is not evidence (red, stopped, or short of an ecosystem) is still a
|
|
329
|
+
// run history: without it the first push after a red full run took the unrun pass
|
|
330
|
+
// @implements A-SPEC-128.6 — and it is the newest observation: the older evidence it supersedes goes
|
|
331
|
+
// @implements A-SPEC-128.7 — the attempt is written FIRST, then the older evidence is voided; removed before an
|
|
332
|
+
// attempt that then failed to write, the push took the unrun pass
|
|
333
|
+
const attemptRecord = { takenAt: new Date().toISOString(), head, tier: testScope.tier,
|
|
334
|
+
mode: 'full-attempt', ranFiles: [], ranWith, testsRun, testsRunBy, detected, missing: missingEcosystems,
|
|
335
|
+
// @implements A-SPEC-128.9 — the REQUESTED workers, as nextCall keeps them (B L1: the two had drifted)
|
|
336
|
+
...(result.failedBy?.length ? { failedBy: result.failedBy } : {}), ...named, timeoutMinutes, workers: workers ?? null,
|
|
337
|
+
passed: result.passed, judged: !stopped, executedByAspec, ...worktree };
|
|
338
|
+
scopedEvidenceRecorded = (0, test_evidence_1.writeScopedEvidence)(root, attemptRecord);
|
|
339
|
+
if (!scopedEvidenceRecorded)
|
|
340
|
+
recordFailed.push('scoped-evidence');
|
|
341
|
+
if (!(0, test_evidence_1.voidTestEvidence)(root, attemptRecord, scopedEvidenceRecorded))
|
|
342
|
+
recordFailed.push('test-evidence');
|
|
191
343
|
}
|
|
344
|
+
const notFullBecause = verified && fullRun && !stopped && !fullEvidence
|
|
345
|
+
? (0, test_evidence_1.pushEvidenceProblem)(candidate, head) ?? undefined : undefined;
|
|
346
|
+
// @implements A-SPEC-128.5 — a full run stopped at its budget names the call that gives it more
|
|
347
|
+
// @implements A-SPEC-128.6 — keeping the worker count, and at the ceiling it says so instead of repeating itself
|
|
348
|
+
// @implements A-SPEC-128.8 — built where the gate's stopped-attempt refusal builds it
|
|
349
|
+
const nextCall = !(fullRun && stopped) ? undefined : (0, evidence_mode_1.nextFullCall)(timeoutMinutes, workers);
|
|
192
350
|
// @implements A-SPEC-534.5 — RED-first outcome evidence for ART-8. Recorded UNCONDITIONALLY,
|
|
193
351
|
// unlike the green-only baseline above: a red-assertion recorded before the code is exactly what
|
|
194
352
|
// the red→green sequence needs. Append-only, one record per (A-SPEC, outcome) at this HEAD.
|
|
@@ -214,18 +372,38 @@ function createTestExecutionHandlers(context) {
|
|
|
214
372
|
catch { /* the loop is observation; it never touches the verdict */ }
|
|
215
373
|
// @implements A-SPEC-128
|
|
216
374
|
let baseline;
|
|
217
|
-
if (
|
|
375
|
+
if (fullEvidence) {
|
|
218
376
|
baseline = a.mark ?? context.defaultBaseline;
|
|
219
377
|
// A-SPEC-256.2 round-4 — surfaced to the report below
|
|
220
|
-
|
|
378
|
+
// @implements A-SPEC-128.2 — the anchor says which run verified this tree
|
|
379
|
+
(0, baseline_1.writeBaseline)(root, baseline, testedTree, { tier: testScope.tier, mode: evidence_mode_1.FULL_MODE, ranFileCount });
|
|
221
380
|
}
|
|
222
381
|
return { tier: testScope.tier, mode: result.mode, passed: result.passed, skipped: result.skipped,
|
|
223
|
-
ranFiles: result.ranFiles, executedByAspec, tail: result.tail,
|
|
382
|
+
ranFiles: result.ranFiles, ranWith, executedByAspec, tail: result.tail, workers: applied, ...ignored, ...ignoredBy, timeoutMinutes,
|
|
224
383
|
// @implements A-SPEC-130 — the remediation rides in the answer: these are the files to anchor.
|
|
225
384
|
unresolvedFiles: testScope.unresolvedFiles,
|
|
226
385
|
changeSource, ...(scopeFallback ? { scopeFallback } : {}), ...(baseline ? { baselineRecorded: baseline } : {}),
|
|
386
|
+
// @implements A-SPEC-128.2 — a green that was not the full suite says why nothing became the baseline
|
|
387
|
+
...(verified && !fullEvidence ? { baselineSkipped: 'not a full run' } : {}),
|
|
388
|
+
...(scopedEvidenceRecorded ? { scopedEvidenceRecorded: true } : {}),
|
|
389
|
+
testsRun, testsRunBy, ...(fullRun ? { detected } : {}),
|
|
390
|
+
// @implements A-SPEC-128.7 — I1's notRun, the build files left out, and a record that could not be kept
|
|
391
|
+
...(fullRun && result.notRun?.length ? { notRun: result.notRun } : {}),
|
|
392
|
+
// @implements A-SPEC-128.9 — the units, the missing runners, the code count and the test-named non-tests
|
|
393
|
+
...(fullRun && result.units ? { units: result.units } : {}),
|
|
394
|
+
...(fullRun && result.environment?.length ? { environment: result.environment } : {}),
|
|
395
|
+
...(fullRun && typeof result.implementationCount === 'number' ? { implementationCount: result.implementationCount } : {}),
|
|
396
|
+
...(fullRun && result.notTests?.length ? { notTests: result.notTests } : {}),
|
|
397
|
+
...(fullRun && result.notExecuted?.length ? { notExecuted: result.notExecuted } : {}),
|
|
398
|
+
...(fullRun && result.untestedCode?.length ? { untestedCode: result.untestedCode } : {}),
|
|
399
|
+
...(fullRun && result.notDetected?.length ? { notDetected: result.notDetected } : {}),
|
|
400
|
+
...(fullRun && result.notBuilt?.length ? { notBuilt: result.notBuilt } : {}), ...worktree,
|
|
401
|
+
// @implements A-SPEC-128.8 — recordFailed alone: a real red is not "not judged" (B L3)
|
|
402
|
+
...(recordFailed.length ? { recordFailed } : {}),
|
|
403
|
+
...(excludeDirsIgnored.length ? { excludeDirsIgnored } : {}),
|
|
404
|
+
...(notFullBecause ? { notFullBecause } : {}), ...(nextCall ? { nextCall } : {}),
|
|
227
405
|
...(calibrationClosed ? { calibrationClosed } : {}),
|
|
228
|
-
...(anchorDiagnostics.length > 0 ? { anchorDiagnostics } : {}) };
|
|
406
|
+
...(anchorDiagnostics.length > 0 ? { anchorDiagnostics } : {}), ...(worktreeLeft !== null ? { worktreeLeft } : {}) };
|
|
229
407
|
},
|
|
230
408
|
};
|
|
231
409
|
}
|