@sabaiway/agent-workflow-kit 23.4.1 → 23.6.0
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 +42 -0
- package/README.md +2 -2
- package/SKILL.md +1 -1
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/modes/commit-guard.md +1 -1
- package/references/modes/coverage-check.md +1 -1
- package/references/modes/gates.md +3 -3
- package/references/scripts/archives/archive-changelog.mjs +110 -113
- package/references/scripts/archives/archive-decisions.mjs +3 -62
- package/references/scripts/archives/archive-issues.mjs +87 -114
- package/references/scripts/archives/rotation-conservation.mjs +45 -0
- package/references/scripts/archives/whole-write.mjs +63 -0
- package/references/scripts/family.json +5 -0
- package/references/scripts/shared/index.mjs +2 -1
- package/references/scripts/shared/markdown-blocks.mjs +4 -1
- package/references/scripts/shared/verdict-block.mjs +123 -0
- package/tools/commands.mjs +1 -1
- package/tools/commit-guard.mjs +10 -4
- package/tools/core-evidence-store-read.mjs +4 -0
- package/tools/coverage-check.mjs +40 -26
- package/tools/coverage-declared/config.mjs +186 -0
- package/tools/coverage-declared/index.mjs +2 -0
- package/tools/coverage-declared/judge.mjs +88 -0
- package/tools/doc-parity.mjs +8 -1
- package/tools/run-gates.mjs +33 -13
- package/tools/script-priors.mjs +1 -0
- package/tools/tracked-tree-census.mjs +8 -4
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { COVERAGE_DECLARED_REL, parseDeclaredList } from './config.mjs';
|
|
3
|
+
import { probeRegularFileNoFollow } from '../fs-read-nofollow.mjs';
|
|
4
|
+
import { listGitNamedPaths } from '../tracked-tree-census.mjs';
|
|
5
|
+
|
|
6
|
+
export const DECLARED_LINE_PREFIX = 'coverage-check: declared list — ';
|
|
7
|
+
export const DECLARED_MOVED_FAILURE = 'the declared coverage list moved under the final run';
|
|
8
|
+
|
|
9
|
+
const ABSENT = 'absent';
|
|
10
|
+
const UNREADABLE = 'unreadable';
|
|
11
|
+
const FOREIGN = 'foreign';
|
|
12
|
+
const ERROR = 'error';
|
|
13
|
+
const UTF8 = 'utf8';
|
|
14
|
+
const ZERO = 0;
|
|
15
|
+
const ASCII_FIRST = 32;
|
|
16
|
+
const ASCII_LAST = 126;
|
|
17
|
+
const HEX_RADIX = 16;
|
|
18
|
+
const ESCAPE_WIDTH = 4;
|
|
19
|
+
const ESCAPE_PADDING = '0';
|
|
20
|
+
const EMPTY_TEXT = '';
|
|
21
|
+
const CONFIG_FAILURE_PREFIX = `coverage-check: FAIL — ${COVERAGE_DECLARED_REL}: `;
|
|
22
|
+
const PASS_LINE = 'coverage-check: PASS — every changed Node line is covered';
|
|
23
|
+
|
|
24
|
+
const makeResult = (configFailure = null) => ({ configFailure, notJudged: [], lines: [], failures: [] });
|
|
25
|
+
const makeConfigFailure = (defect) => makeResult(`${CONFIG_FAILURE_PREFIX}${defect}`);
|
|
26
|
+
const renderAsciiLine = (value) => Array.from(String(value), (character) => {
|
|
27
|
+
const codePoint = character.codePointAt(ZERO);
|
|
28
|
+
return codePoint >= ASCII_FIRST && codePoint <= ASCII_LAST
|
|
29
|
+
? character : `\\u{${codePoint.toString(HEX_RADIX).padStart(ESCAPE_WIDTH, ESCAPE_PADDING)}}`;
|
|
30
|
+
}).join(EMPTY_TEXT);
|
|
31
|
+
|
|
32
|
+
export const judgeDeclaredList = ({ top, read, changed, spawn }) => {
|
|
33
|
+
if (read.state === ABSENT) return makeResult();
|
|
34
|
+
if (read.state === UNREADABLE) return makeConfigFailure(read.defect);
|
|
35
|
+
const parsed = parseDeclaredList(read.bytes);
|
|
36
|
+
if (!parsed.ok) return makeConfigFailure(parsed.defect);
|
|
37
|
+
const entries = parsed.entries;
|
|
38
|
+
if (entries.length === ZERO) return makeResult();
|
|
39
|
+
const listed = (() => {
|
|
40
|
+
try {
|
|
41
|
+
return { paths: listGitNamedPaths(top, { untracked: true, spawn }) };
|
|
42
|
+
} catch (error) {
|
|
43
|
+
return { failure: makeConfigFailure(renderAsciiLine(error.message)) };
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
46
|
+
if (listed.failure) return listed.failure;
|
|
47
|
+
const result = makeResult();
|
|
48
|
+
const unchanged = [];
|
|
49
|
+
for (const entry of entries) {
|
|
50
|
+
const entryBytes = Buffer.from(entry.path, UTF8);
|
|
51
|
+
const named = listed.paths.some((name) => name.equals(entryBytes));
|
|
52
|
+
const probe = named ? probeRegularFileNoFollow(join(top, entry.path)) : { outcome: ABSENT };
|
|
53
|
+
if (probe.outcome === ABSENT) {
|
|
54
|
+
result.lines.push(`${DECLARED_LINE_PREFIX}names no file of this tree: ${entry.path}`);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (probe.outcome === FOREIGN || probe.outcome === ERROR) {
|
|
58
|
+
result.failures.push(`${entry.path}: listed in ${COVERAGE_DECLARED_REL} but not a regular file`);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (changed === null) continue;
|
|
62
|
+
if (!changed.has(entry.path)) {
|
|
63
|
+
unchanged.push(entry.path);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const lineMap = changed.get(entry.path);
|
|
67
|
+
const executed = lineMap !== undefined && [...lineMap.values()].some((hits) => hits > ZERO);
|
|
68
|
+
if (executed) {
|
|
69
|
+
result.lines.push(`${DECLARED_LINE_PREFIX}did not apply, the coverage data shows an executed line: ${entry.path}`);
|
|
70
|
+
} else {
|
|
71
|
+
result.notJudged.push(entry.path);
|
|
72
|
+
result.lines.push(`${DECLARED_LINE_PREFIX}not judged, no executed line in the coverage data: ${entry.path} — ${entry.reason}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (changed === null) {
|
|
76
|
+
result.lines.push(`${DECLARED_LINE_PREFIX}no coverage data was read, so no entry applied (${entries.length} listed)`);
|
|
77
|
+
} else if (unchanged.length > ZERO) {
|
|
78
|
+
result.lines.push(`${DECLARED_LINE_PREFIX}${unchanged.length} listed file(s) unchanged, not looked up`);
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const declaredPassLine = (count) => count > ZERO
|
|
84
|
+
? `coverage-check: PASS — ${count} listed file(s) not judged; every other changed Node line is covered`
|
|
85
|
+
: PASS_LINE;
|
|
86
|
+
|
|
87
|
+
export const declaredStartRefusal = (read) =>
|
|
88
|
+
`[run-gates] --final: ${COVERAGE_DECLARED_REL} is not readable (${read.defect}) — the declared coverage list cannot be bound; nothing was recorded`;
|
package/tools/doc-parity.mjs
CHANGED
|
@@ -64,6 +64,7 @@ import { COVERAGE } from './coverage-state.mjs';
|
|
|
64
64
|
// The canonical producer body: gates.md prints the whole command byte for byte, so the doc is a
|
|
65
65
|
// hand copy of a moving constant unless it is bound here.
|
|
66
66
|
import { COVERAGE_PRODUCER_BODY } from './coverage-producer.mjs';
|
|
67
|
+
import { COVERAGE_DECLARED_REL } from './coverage-declared/index.mjs';
|
|
67
68
|
// The ensure outcomes upgrade.md relays: the doc enumerates them for the agent, so an outcome the
|
|
68
69
|
// tool renames or drops must fail here rather than leave the doc teaching a vocabulary nobody emits.
|
|
69
70
|
// Imported from the VOCABULARY leaf, never from the ops: a read-only lint must not pull the ensure
|
|
@@ -86,6 +87,8 @@ const PROCEDURES_DOC = 'references/modes/procedures.md';
|
|
|
86
87
|
const SET_FLOW_DOC = 'references/modes/set-flow.md';
|
|
87
88
|
const RECEIPT_DEADLINE_DOC = 'references/modes/receipt-deadline.md';
|
|
88
89
|
const GATES_DOC = 'references/modes/gates.md';
|
|
90
|
+
const COVERAGE_CHECK_DOC = 'references/modes/coverage-check.md';
|
|
91
|
+
const COMMIT_GUARD_DOC = 'references/modes/commit-guard.md';
|
|
89
92
|
const MCP_DOC = 'references/modes/mcp.md';
|
|
90
93
|
const UNINSTALL_DOC = 'references/modes/uninstall.md';
|
|
91
94
|
const STATUS_DOC = 'references/modes/status.md';
|
|
@@ -230,6 +233,9 @@ export const BINDINGS = Object.freeze([
|
|
|
230
233
|
// sees the doc. Bound here, a future move fails a declared gate instead of leaving the contract
|
|
231
234
|
// doc quietly describing a command the kit no longer emits.
|
|
232
235
|
valueBinding('coverage-producer-body', COVERAGE_PRODUCER_BODY, COVERAGE_PRODUCER_BODY, [GATES_DOC]),
|
|
236
|
+
valueBinding('coverage-declared-rel', COVERAGE_DECLARED_REL, `\`${COVERAGE_DECLARED_REL}\``, [
|
|
237
|
+
COVERAGE_CHECK_DOC, GATES_DOC, COMMIT_GUARD_DOC,
|
|
238
|
+
]),
|
|
233
239
|
// The MCP registration's four public strings (mode: mcp). TWO docs quote each of them: the mode
|
|
234
240
|
// contract, which tells a reader what will be declared, and the uninstall KEEP list, which tells
|
|
235
241
|
// them what to edit to undo it — so a renamed key or tool would otherwise leave one of the two
|
|
@@ -313,7 +319,8 @@ FORM-only + aggregate-refusal contract and the routing advisor's two honesty sen
|
|
|
313
319
|
advice never gates, and the harness-subagent lane carries no availability verdict (dispatch.md), the
|
|
314
320
|
runner's closed coverage= summary
|
|
315
321
|
vocabulary (gates.md), the canonical coverage-producer-body command the same doc prints in full
|
|
316
|
-
(gates.md),
|
|
322
|
+
(gates.md), the declared coverage list's path coverage-declared-rel (coverage-check.md, gates.md,
|
|
323
|
+
commit-guard.md), and the MCP registration's five public strings — mcp-json-rel, mcp-enabled-key,
|
|
317
324
|
mcp-server-name and the two mcp-allow-rule entries, each quoted by BOTH the mcp mode contract and the
|
|
318
325
|
uninstall KEEP list that undoes it (mcp.md, uninstall.md) — to
|
|
319
326
|
the exact token its references/modes/*.md contract must carry, and
|
package/tools/run-gates.mjs
CHANGED
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
commitmentFor,
|
|
57
57
|
ATTEST_NONCE_ENV,
|
|
58
58
|
ATTEST_FINGERPRINT_ENV,
|
|
59
|
-
ATTEST_BASE_ENV,
|
|
59
|
+
ATTEST_BASE_ENV, ATTEST_DECLARED_ENV, ATTEST_ENV_VARS,
|
|
60
60
|
} from './coverage-check.mjs';
|
|
61
61
|
// The declaration load/validation + the canonical checker predicate family live in the
|
|
62
62
|
// gates-declaration.mjs LEAF (FLOW-READ-GRAPH-PURITY / the R10 rider: the locked subset-attempt
|
|
@@ -73,6 +73,10 @@ import {
|
|
|
73
73
|
// only direction that has no cycle. Re-exported here: this module is the vocabulary's public face.
|
|
74
74
|
import { COVERAGE } from './coverage-state.mjs';
|
|
75
75
|
import { CHECKER_CLAIM, SOURCE_SIZE_WARNING_PREFIX, classifySourceSizeGate } from './source-size-core.mjs';
|
|
76
|
+
import { checkerClaimTool, classifyCheckerClaim } from './checker-claim.mjs';
|
|
77
|
+
import { resolveGitLocation } from './git-env.mjs';
|
|
78
|
+
import { escapeForDisplay } from './repo-lex.mjs';
|
|
79
|
+
import { COVERAGE_DECLARED_REL, DECLARED_LINE_PREFIX, DECLARED_MOVED_FAILURE, resolveDeclaredListPath, readDeclaredList, declaredStartRefusal, declaredAttestValue, compareDeclaredAttest } from './coverage-declared/index.mjs';
|
|
76
80
|
|
|
77
81
|
export { GATES_REL, loadDeclaration, validateDeclaration, canonicalCheckerGates, isFinalCapableDeclaration, isReviewDependentGate };
|
|
78
82
|
export { COVERAGE };
|
|
@@ -98,6 +102,7 @@ export const fail = (exitCode, message) => Object.assign(new Error(message), { e
|
|
|
98
102
|
const NO_FAILED_IDS = '-';
|
|
99
103
|
const SPAWN_FAILED_CODE = -1;
|
|
100
104
|
const MAX_GATE_OUTPUT_BYTES = 64 * 1024 * 1024;
|
|
105
|
+
const NO_ECHO_SKIP_INDEX = -1;
|
|
101
106
|
|
|
102
107
|
const USAGE = [
|
|
103
108
|
'usage: run-gates.mjs [--cwd <dir>] [--only <id>]... [--final] [--pre-review [--diagnosis <text>]] [--help]',
|
|
@@ -127,6 +132,9 @@ const USAGE = [
|
|
|
127
132
|
'degrade evidence hashes, the lcov sha, the run\'s own coverage token, and — when a flow store',
|
|
128
133
|
'exists — evidenceHashes.flow, the owner-scoped flow projection hash (D10; projection movement',
|
|
129
134
|
'under the run is a red integrityFailure) }. --final refuses --only (a subset never attests).',
|
|
135
|
+
`--final needs one git work tree, and binds the declared coverage list ${COVERAGE_DECLARED_REL}: an`,
|
|
136
|
+
'unreadable list refuses (exit 8), a list that moves under the run is a red integrityFailure, its hash',
|
|
137
|
+
'rides evidenceHashes.coverageDeclared. A green coverage-check gate echoes the list lines on every run.',
|
|
130
138
|
'',
|
|
131
139
|
`Runs the gates declared in <cwd>/${GATES_REL} (one bash command line each, project root as cwd).`,
|
|
132
140
|
'Prints a per-gate PASS/FAIL table + one machine-readable summary line; exit 0 iff all green.',
|
|
@@ -188,7 +196,7 @@ export const RESERVED_PRODUCER_ENV = Object.freeze(['AW_GIT_DIR', 'AW_LCOV_FILE'
|
|
|
188
196
|
// other child (and any descendant it spawns) must see it absent, host-set copies included, or that
|
|
189
197
|
// descendant could certify a foreign lcov later. Conflating the two lists made a gate that merely
|
|
190
198
|
// MENTIONS the name refuse the whole run.
|
|
191
|
-
export const RESERVED_CAPABILITY_ENV =
|
|
199
|
+
export const RESERVED_CAPABILITY_ENV = ATTEST_ENV_VARS;
|
|
192
200
|
|
|
193
201
|
export const spawnGateViaBash = (cmd, cwd, extraEnv = {}) => {
|
|
194
202
|
const env = { ...process.env };
|
|
@@ -228,19 +236,21 @@ export const BASH_PROBE_CMD = 'true';
|
|
|
228
236
|
const formatSeconds = (ms) => `${(ms / 1000).toFixed(1)}s`;
|
|
229
237
|
const trimTrailingNewline = (text) => text.replace(/\n$/, '');
|
|
230
238
|
|
|
231
|
-
// A green
|
|
232
|
-
//
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
239
|
+
// A green size or coverage check marks every-run lines with its prefix; the matrix echoes only
|
|
240
|
+
// those lines under a gate running the canonical checker or a regular-file copy of it elsewhere.
|
|
241
|
+
const COVERAGE_CHECK_TOOL = checkerClaimTool('coverage-check.mjs', FINAL_CORE_CHECKS[1].canonical);
|
|
242
|
+
const GREEN_GATE_LINE_PREFIXES = Object.freeze([
|
|
243
|
+
[(cmd, cwd) => [CHECKER_CLAIM.CANONICAL, CHECKER_CLAIM.ELSEWHERE].includes(classifySourceSizeGate(cmd, cwd)), SOURCE_SIZE_WARNING_PREFIX],
|
|
244
|
+
[(cmd, cwd) => matchesCanonicalCheck(FINAL_CORE_CHECKS[1], cmd, cwd) || classifyCheckerClaim(COVERAGE_CHECK_TOOL, cmd, cwd) === CHECKER_CLAIM.ELSEWHERE, DECLARED_LINE_PREFIX],
|
|
245
|
+
]);
|
|
246
|
+
const selectGreenGateLines = (gate, cwd, stdout) => GREEN_GATE_LINE_PREFIXES.flatMap(([matches, prefix]) => matches(gate.cmd, cwd) ? String(stdout).split(/\r?\n/).filter((line) => line.startsWith(prefix)) : []);
|
|
237
247
|
|
|
238
248
|
// Run the selected gates sequentially (declaration order). A green gate logs one PASS line (and a
|
|
239
249
|
// source-size check its warnings); a failing gate logs FAIL + its captured stdout/stderr VERBATIM
|
|
240
250
|
// (triage without re-running).
|
|
241
|
-
export const runGates = (gates, { cwd, spawn = spawnGateViaBash, now = Date.now, log = console.log }) => {
|
|
251
|
+
export const runGates = (gates, { cwd, spawn = spawnGateViaBash, now = Date.now, log = console.log, echoSkipAt = NO_ECHO_SKIP_INDEX }) => {
|
|
242
252
|
const results = [];
|
|
243
|
-
for (const gate of gates) {
|
|
253
|
+
for (const [gateIndex, gate] of gates.entries()) {
|
|
244
254
|
log(`── ${gate.id} — ${gate.title}`);
|
|
245
255
|
const startedAt = now();
|
|
246
256
|
const res = spawn(gate.cmd, cwd);
|
|
@@ -251,7 +261,7 @@ export const runGates = (gates, { cwd, spawn = spawnGateViaBash, now = Date.now,
|
|
|
251
261
|
results.push({ id: gate.id, title: gate.title, ok, code, elapsedMs, stdout: res.stdout ? String(res.stdout) : '' });
|
|
252
262
|
if (ok) {
|
|
253
263
|
log(` PASS (${formatSeconds(elapsedMs)})`);
|
|
254
|
-
for (const line of
|
|
264
|
+
if (gateIndex !== echoSkipAt) for (const line of selectGreenGateLines(gate, cwd, res.stdout ?? '')) log(line);
|
|
255
265
|
} else {
|
|
256
266
|
log(` FAIL exit=${code} (${formatSeconds(elapsedMs)})`);
|
|
257
267
|
if (res.stdout) log(trimTrailingNewline(res.stdout));
|
|
@@ -584,6 +594,7 @@ export const runCli = (argv, deps = {}) => {
|
|
|
584
594
|
const dirRes = spawnSync('git', ['rev-parse', '--absolute-git-dir'], { cwd: projectDir, windowsHide: true });
|
|
585
595
|
const gitDir = dirRes.error || dirRes.status !== 0 ? null : dirRes.stdout.toString('utf8').replace(/\r?\n$/, '');
|
|
586
596
|
let gateSpawn = gitDir === null ? spawn : (cmd, cwd2) => spawn(cmd, cwd2, { AW_GIT_DIR: gitDir });
|
|
597
|
+
const finalLocation = opts.final ? resolveGitLocation(projectDir, { env }) : null;
|
|
587
598
|
// ── --final preflight (D3(a)): the declaration must carry the canonical core checks; the TRUE
|
|
588
599
|
// git dir resolves AW_GIT_DIR; the stale lcov dies BEFORE the suite so it is never consumed.
|
|
589
600
|
if (opts.final) {
|
|
@@ -602,7 +613,7 @@ export const runCli = (argv, deps = {}) => {
|
|
|
602
613
|
if (!matchesCanonicalCheck(FINAL_CORE_CHECKS[1], lastGate.cmd, projectDir)) {
|
|
603
614
|
throw fail(EXIT.malformed, `--final refuses the declaration — the CANONICAL coverage-check gate must be the LAST declared gate (nothing may run after the checker consumed the lcov; "${lastGate.id}" is declared last)`);
|
|
604
615
|
}
|
|
605
|
-
if (
|
|
616
|
+
if (finalLocation.state !== 'work-tree') throw fail(EXIT.fail, `--final needs a git work tree (${finalLocation.state}: ${escapeForDisplay(finalLocation.cause)})`);
|
|
606
617
|
try {
|
|
607
618
|
unlinkSync(join(gitDir, LCOV_BASENAME)); // a stale lcov is never consumed
|
|
608
619
|
} catch (err) {
|
|
@@ -642,6 +653,12 @@ export const runCli = (argv, deps = {}) => {
|
|
|
642
653
|
// --final needs the pre-run fingerprint (the receipt binds before == after == current).
|
|
643
654
|
const finalFingerprintBefore = opts.final ? fingerprint(projectDir) : null;
|
|
644
655
|
const finalBase = opts.final ? resolveBase(projectDir) ?? '' : null;
|
|
656
|
+
const declaredStart = opts.final ? readDeclaredList(resolveDeclaredListPath(finalLocation.top)) : null;
|
|
657
|
+
if (declaredStart?.state === 'unreadable') {
|
|
658
|
+
logError(declaredStartRefusal(declaredStart));
|
|
659
|
+
log(composeSummaryLine({ status: 'fail' }));
|
|
660
|
+
return EXIT.finalFailed;
|
|
661
|
+
}
|
|
645
662
|
// The attestation handshake (see coverage-check.mjs): a fresh random nonce rides the child
|
|
646
663
|
// environment, and the attempt id this run records is the one-way COMMITMENT over it plus the
|
|
647
664
|
// identity. Persisting only the commitment is what makes the context unreproducible from the
|
|
@@ -661,6 +678,7 @@ export const runCli = (argv, deps = {}) => {
|
|
|
661
678
|
[ATTEST_NONCE_ENV]: finalNonce,
|
|
662
679
|
[ATTEST_FINGERPRINT_ENV]: finalFingerprintBefore ?? '',
|
|
663
680
|
[ATTEST_BASE_ENV]: finalBase,
|
|
681
|
+
[ATTEST_DECLARED_ENV]: declaredAttestValue(declaredStart),
|
|
664
682
|
});
|
|
665
683
|
};
|
|
666
684
|
}
|
|
@@ -742,7 +760,7 @@ export const runCli = (argv, deps = {}) => {
|
|
|
742
760
|
// The checker's position is pinned BEFORE the matrix spawns; the tree it leaves behind never
|
|
743
761
|
// gets to re-decide which gate this run selected.
|
|
744
762
|
const checkerAt = resolveCheckerIndex(selected, projectDir);
|
|
745
|
-
const results = runGates(selected, { cwd: projectDir, spawn: gateSpawn, log, now });
|
|
763
|
+
const results = runGates(selected, { cwd: projectDir, spawn: gateSpawn, log, now, echoSkipAt: opts.final ? checkerAt : NO_ECHO_SKIP_INDEX });
|
|
746
764
|
// Decided once, from the checker's own machine lines, and carried to BOTH surfaces of this run:
|
|
747
765
|
// the checker's table row and the machine summary field (Decision 7/8).
|
|
748
766
|
const coverage = coverageSignal(checkerAt, results);
|
|
@@ -854,6 +872,7 @@ export const runCli = (argv, deps = {}) => {
|
|
|
854
872
|
integrityFailure = 'the flow store moved under the final run (the owner-scoped projection changed)';
|
|
855
873
|
}
|
|
856
874
|
}
|
|
875
|
+
if (integrityFailure === null && !compareDeclaredAttest(declaredAttestValue(declaredStart), readDeclaredList(resolveDeclaredListPath(finalLocation.top))).accepted) integrityFailure = DECLARED_MOVED_FAILURE;
|
|
857
876
|
// Exactly ONE full machine line binds the receipt — an unanchored first-match would let
|
|
858
877
|
// an injected/duplicated line shadow the real one and skip the end re-hash.
|
|
859
878
|
const shaLines = anchoredMachineLines(checkerRow?.stdout, LCOV_SHA_LINE_RE);
|
|
@@ -908,6 +927,7 @@ export const runCli = (argv, deps = {}) => {
|
|
|
908
927
|
degrade: sha256Hex(canonicalKindSerialization(endRead.records, 'degrade')),
|
|
909
928
|
}),
|
|
910
929
|
...(finalFlow?.present ? { flow: finalFlow.hash } : {}),
|
|
930
|
+
...(declaredStart.state === 'regular' ? { coverageDeclared: declaredStart.hash } : {}),
|
|
911
931
|
},
|
|
912
932
|
lcovSha256,
|
|
913
933
|
// The run's OWN coverage token, recorded rather than re-derived: `lcovSha256` says what
|
package/tools/script-priors.mjs
CHANGED
|
@@ -88,6 +88,7 @@ export const SCRIPT_PRIORS = Object.freeze([
|
|
|
88
88
|
prior('migrate-gates.mjs', '8.1.5', '9.0.0', 'd9c3f9da27397dd94ad866c3cbac72e529ad2e6311ffa15de7478a960800cdfa'),
|
|
89
89
|
prior('migrate-gates.test.mjs', '8.1.5', '9.0.0', '8f99a2f65f1f3db0eb3464a0382c208ca5076388b6df0596cf099d53ab2a1f86'),
|
|
90
90
|
prior('spec-schema.test.mjs', '8.7.0', '9.0.0', '6a602a93e9f9f21f0bc10c50e356de693936d3e204987efbab1a1d7674030498'),
|
|
91
|
+
prior('markdown-blocks.mjs', '4.0.0', '9.0.0', '5a9fb45d4248c53dee9694b2d95c1cf98fe08a55c41429cf72826aa218f0ad2d'),
|
|
91
92
|
]);
|
|
92
93
|
|
|
93
94
|
export const digestOf = (bytes) => createHash('sha256').update(bytes).digest('hex');
|
|
@@ -43,8 +43,11 @@ const splitOnNul = (buffer) => {
|
|
|
43
43
|
return parts;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const
|
|
47
|
-
|
|
46
|
+
const TRACKED_PATH_ARGS = ['ls-files', '-z'];
|
|
47
|
+
const ALL_NAMED_PATH_ARGS = ['ls-files', '-z', '--cached', '--others', '--exclude-standard'];
|
|
48
|
+
export const listGitNamedPaths = (root, { untracked = false, spawn = spawnSync } = {}) => {
|
|
49
|
+
const args = untracked ? ALL_NAMED_PATH_ARGS : TRACKED_PATH_ARGS;
|
|
50
|
+
const result = spawn('git', args, { cwd: root, maxBuffer: GIT_MAX_BUFFER, windowsHide: true });
|
|
48
51
|
if (result.error || result.status !== 0) {
|
|
49
52
|
const reason = result.error ? (result.error.code ?? result.error.message) : `git exited ${result.status}`;
|
|
50
53
|
throw Object.assign(new Error(`tracked-tree census unavailable: ${reason}`), { code: 'CENSUS_UNAVAILABLE' });
|
|
@@ -57,7 +60,7 @@ const listTrackedPaths = (root, spawn) => {
|
|
|
57
60
|
const identity = part.toString('latin1'); // byte-exact key: one char per byte, never lossy
|
|
58
61
|
if (seenBytes.has(identity)) continue;
|
|
59
62
|
seenBytes.add(identity);
|
|
60
|
-
paths.push(part
|
|
63
|
+
paths.push(part);
|
|
61
64
|
}
|
|
62
65
|
return paths;
|
|
63
66
|
};
|
|
@@ -76,7 +79,8 @@ const listTrackedPaths = (root, spawn) => {
|
|
|
76
79
|
export const takeCensus = (root, { spawn = spawnSync } = {}) => {
|
|
77
80
|
const counts = { assessable: 0, unsupported: 0, 'out-of-domain': 0, 'excluded-test': 0 };
|
|
78
81
|
const unsupportedExtensions = new Set();
|
|
79
|
-
for (const
|
|
82
|
+
for (const name of listGitNamedPaths(root, { spawn })) {
|
|
83
|
+
const path = name.toString('utf8');
|
|
80
84
|
const kind = classifyChangedPath(path);
|
|
81
85
|
counts[kind] += 1;
|
|
82
86
|
if (kind === 'unsupported') {
|