@holmes-lab/holmes-kit 0.29.0 → 0.30.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 +62 -0
- package/README.md +6 -5
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/agents-guidance-history.d.ts +1 -1
- package/dist/holmes/cli/agents-guidance-history.js +11 -2
- package/dist/holmes/cli/agents-guidance.d.ts +1 -0
- package/dist/holmes/cli/agents-guidance.js +11 -8
- package/dist/holmes/cli/codex-toml.d.ts +23 -1
- package/dist/holmes/cli/codex-toml.js +151 -4
- package/dist/holmes/cli/doctor.d.ts +11 -1
- package/dist/holmes/cli/doctor.js +88 -12
- package/dist/holmes/cli/init.d.ts +2 -0
- package/dist/holmes/cli/init.js +20 -40
- package/dist/holmes/cli/interactive-prompt.js +2 -2
- package/dist/holmes/cli/worktree-readiness.d.ts +1 -0
- package/dist/holmes/cli/worktree-readiness.js +17 -3
- package/dist/holmes/governance/autonomy.d.ts +9 -0
- package/dist/holmes/governance/autonomy.js +28 -1
- package/dist/holmes/hooks/rtm-refresh-child.d.ts +22 -1
- package/dist/holmes/hooks/rtm-refresh-child.js +100 -18
- package/dist/holmes/hooks/rtm-refresh.d.ts +20 -1
- package/dist/holmes/hooks/rtm-refresh.js +56 -15
- package/dist/holmes/mcp/approval-adapters.d.ts +22 -0
- package/dist/holmes/mcp/approval-adapters.js +21 -0
- package/dist/holmes/mcp/approval-commit.d.ts +21 -0
- package/dist/holmes/mcp/approval-commit.js +92 -0
- package/dist/holmes/mcp/approval-intent.d.ts +44 -0
- package/dist/holmes/mcp/approval-intent.js +67 -0
- package/dist/holmes/mcp/approval-policy.d.ts +14 -0
- package/dist/holmes/mcp/approval-policy.js +18 -0
- package/dist/holmes/mcp/elicit-approval.d.ts +2 -0
- package/dist/holmes/mcp/elicit-approval.js +5 -2
- package/dist/holmes/mcp/handlers/graph-operations.d.ts +17 -1
- package/dist/holmes/mcp/handlers/graph-operations.js +13 -5
- package/dist/holmes/mcp/handlers/maintenance-evidence.js +1 -1
- package/dist/holmes/mcp/handlers/requirement-triage.d.ts +26 -0
- package/dist/holmes/mcp/handlers/requirement-triage.js +45 -10
- package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -1
- package/dist/holmes/mcp/handlers/review-evidence.js +9 -5
- package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +7 -0
- package/dist/holmes/mcp/handlers/slice-orchestration.js +8 -1
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +26 -2
- package/dist/holmes/mcp/handlers/spec-approval.js +72 -47
- package/dist/holmes/mcp/handlers/spec-authoring.js +20 -2
- package/dist/holmes/mcp/handlers.d.ts +46 -0
- package/dist/holmes/mcp/handlers.js +57 -13
- package/dist/holmes/mcp/maintenance-analyze.js +28 -4
- package/dist/holmes/mcp/maintenance-evidence.js +1 -1
- package/dist/holmes/mcp/requirement-triage-evidence.d.ts +36 -2
- package/dist/holmes/mcp/requirement-triage-evidence.js +71 -1
- package/dist/holmes/mcp/server.js +5 -3
- package/dist/holmes/mcp/supervisor.js +7 -3
- package/dist/holmes/mcp/tool-schemas.d.ts +8 -0
- package/dist/holmes/mcp/tool-schemas.js +31 -1
- package/dist/holmes/refresh/freshness-coordinator.d.ts +67 -0
- package/dist/holmes/refresh/freshness-coordinator.js +230 -0
- package/dist/holmes/review/condition-hunk-replay.d.ts +12 -0
- package/dist/holmes/review/condition-hunk-replay.js +11 -1
- package/dist/holmes/review/condition-hunk-resolution.js +59 -8
- package/dist/holmes/review/requirement-triage-human-records.d.ts +59 -0
- package/dist/holmes/review/requirement-triage-human-records.js +119 -0
- package/dist/holmes/review/scope.js +6 -1
- package/dist/holmes/review/test-outcomes.d.ts +28 -0
- package/dist/holmes/review/test-outcomes.js +90 -1
- package/package.json +1 -1
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FRESHNESS_REREFRESH_MS = exports.FRESHNESS_RETRY_MS = exports.FRESHNESS_LEASE_MS = exports.FRESHNESS_RECEIPT_FILE = void 0;
|
|
37
|
+
exports.intakeUsable = intakeUsable;
|
|
38
|
+
exports.lexicalOnly = lexicalOnly;
|
|
39
|
+
exports.readFreshnessReceipt = readFreshnessReceipt;
|
|
40
|
+
exports.requestRefresh = requestRefresh;
|
|
41
|
+
exports.ownsLease = ownsLease;
|
|
42
|
+
exports.completeRefresh = completeRefresh;
|
|
43
|
+
exports.workspaceIdFor = workspaceIdFor;
|
|
44
|
+
// @implements A-SPEC-719
|
|
45
|
+
/**
|
|
46
|
+
* The durable source of truth for refresh work. A receipt names the workspace and
|
|
47
|
+
* commit it describes, so an old detached worker cannot make a newer tree look
|
|
48
|
+
* current merely by leaving behind a successful timestamp.
|
|
49
|
+
*/
|
|
50
|
+
const crypto = __importStar(require("node:crypto"));
|
|
51
|
+
const fs = __importStar(require("node:fs"));
|
|
52
|
+
const path = __importStar(require("node:path"));
|
|
53
|
+
const workspace_identity_1 = require("../project/workspace-identity");
|
|
54
|
+
exports.FRESHNESS_RECEIPT_FILE = path.join('.ax', 'state', 'fresh-evidence.json');
|
|
55
|
+
// A crashed detached child becomes eligible quickly. This is intentionally much
|
|
56
|
+
// shorter than the former 30-minute marker window, while still bounding spawn bursts.
|
|
57
|
+
exports.FRESHNESS_LEASE_MS = 2 * 60 * 1000;
|
|
58
|
+
/** A failed detached worker is visible immediately but retries only after this bounded pause. */
|
|
59
|
+
exports.FRESHNESS_RETRY_MS = 30 * 1000;
|
|
60
|
+
/**
|
|
61
|
+
* A usable terminal receipt coalesces for its HEAD only this long. HEAD alone does not move while
|
|
62
|
+
* someone edits, so without an interval the graph would never refresh between commits — the former
|
|
63
|
+
* marker's 30-minute window, which A-SPEC-566.4 measured as the advisory's quality factor.
|
|
64
|
+
*/
|
|
65
|
+
exports.FRESHNESS_REREFRESH_MS = 30 * 60 * 1000;
|
|
66
|
+
/** Requirement lanes a receipt may carry and still ground intake (A-SPEC-719, owner decision 2026-09-23). */
|
|
67
|
+
const INTAKE_REQUIREMENT_LANES = new Set(['current', 'not-adopted', 'suppressed']);
|
|
68
|
+
/**
|
|
69
|
+
* Whether a receipt can ground requirement intake: a current graph plus a requirement lane that is
|
|
70
|
+
* current or the owner-chosen lexical-only `not-adopted`/`suppressed`. The source lane never counts.
|
|
71
|
+
*/
|
|
72
|
+
function intakeUsable(receipt) {
|
|
73
|
+
return !!receipt && receipt.graph === 'current' && receipt.state === (receipt.requirementSemantic === 'current' ? 'current' : receipt.requirementSemantic)
|
|
74
|
+
&& INTAKE_REQUIREMENT_LANES.has(receipt.requirementSemantic);
|
|
75
|
+
}
|
|
76
|
+
/** Usable, but without requirement vectors: triage ran on lexical evidence alone. */
|
|
77
|
+
function lexicalOnly(receipt) {
|
|
78
|
+
return intakeUsable(receipt) && receipt.requirementSemantic !== 'current';
|
|
79
|
+
}
|
|
80
|
+
const lanes = new Set(['current', 'refreshing', 'retry-at', 'failed', 'suppressed', 'not-adopted', 'stale']);
|
|
81
|
+
const receiptPath = (root) => path.join(root, exports.FRESHNESS_RECEIPT_FILE);
|
|
82
|
+
const sameIdentity = (r, i) => r.workspaceId === i.workspaceId && r.head === i.head;
|
|
83
|
+
function isReceipt(value) {
|
|
84
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
85
|
+
return false;
|
|
86
|
+
const r = value;
|
|
87
|
+
return r.schema === 'fresh-evidence/1' && typeof r.workspaceId === 'string'
|
|
88
|
+
&& (typeof r.head === 'string' || r.head === null) && typeof r.generation === 'string'
|
|
89
|
+
&& typeof r.state === 'string' && lanes.has(r.state)
|
|
90
|
+
&& typeof r.attempt === 'number' && Number.isInteger(r.attempt) && r.attempt > 0
|
|
91
|
+
&& typeof r.graph === 'string' && lanes.has(r.graph)
|
|
92
|
+
&& typeof r.sourceSemantic === 'string' && lanes.has(r.sourceSemantic)
|
|
93
|
+
&& typeof r.requirementSemantic === 'string' && lanes.has(r.requirementSemantic)
|
|
94
|
+
&& (r.startedAt === undefined || typeof r.startedAt === 'string')
|
|
95
|
+
&& (r.completedAt === undefined || typeof r.completedAt === 'string')
|
|
96
|
+
&& (r.retryAt === undefined || typeof r.retryAt === 'string');
|
|
97
|
+
}
|
|
98
|
+
function storedReceipt(root) {
|
|
99
|
+
try {
|
|
100
|
+
const parsed = JSON.parse(fs.readFileSync(receiptPath(root), 'utf8'));
|
|
101
|
+
return isReceipt(parsed) ? parsed : null;
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function writeReceipt(root, receipt) {
|
|
108
|
+
const file = receiptPath(root), dir = path.dirname(file);
|
|
109
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
110
|
+
const temp = path.join(dir, `.fresh-evidence-${crypto.randomUUID()}.tmp`);
|
|
111
|
+
let written = false;
|
|
112
|
+
try {
|
|
113
|
+
const fd = fs.openSync(temp, 'wx', 0o600);
|
|
114
|
+
written = true;
|
|
115
|
+
try {
|
|
116
|
+
fs.writeFileSync(fd, JSON.stringify(receipt, null, 2) + '\n');
|
|
117
|
+
fs.fsyncSync(fd);
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
fs.closeSync(fd);
|
|
121
|
+
}
|
|
122
|
+
fs.renameSync(temp, file);
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
if (written) {
|
|
126
|
+
try {
|
|
127
|
+
fs.unlinkSync(temp);
|
|
128
|
+
}
|
|
129
|
+
catch { /* rename consumed the temporary file */ }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function expired(receipt, now) {
|
|
134
|
+
if (receipt.state !== 'refreshing' || !receipt.startedAt)
|
|
135
|
+
return false;
|
|
136
|
+
const started = Date.parse(receipt.startedAt);
|
|
137
|
+
return !Number.isFinite(started) || now.getTime() - started >= exports.FRESHNESS_LEASE_MS;
|
|
138
|
+
}
|
|
139
|
+
function stale(receipt) {
|
|
140
|
+
return { ...receipt, state: 'stale', graph: 'stale', sourceSemantic: 'stale', requirementSemantic: 'stale' };
|
|
141
|
+
}
|
|
142
|
+
/** Read-only judgement: untrusted, expired, foreign, and commit-mismatched state is never current. */
|
|
143
|
+
function readFreshnessReceipt(root, expected) {
|
|
144
|
+
const receipt = storedReceipt(root);
|
|
145
|
+
if (!receipt)
|
|
146
|
+
return null;
|
|
147
|
+
return sameIdentity(receipt, expected) && !expired(receipt, expected.now) ? receipt : stale(receipt);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Publish a new lease before the detached worker is started. The caller alone
|
|
151
|
+
* performs spawning when `spawn` is true; all matching live callers coalesce.
|
|
152
|
+
*/
|
|
153
|
+
function requestRefresh(root, input) {
|
|
154
|
+
const previous = storedReceipt(root);
|
|
155
|
+
if (previous && sameIdentity(previous, input) && previous.state === 'refreshing' && !expired(previous, input.now)) {
|
|
156
|
+
return { spawn: false, receipt: previous };
|
|
157
|
+
}
|
|
158
|
+
if (previous && sameIdentity(previous, input) && previous.state === 'retry-at'
|
|
159
|
+
&& previous.retryAt && Date.parse(previous.retryAt) > input.now.getTime()) {
|
|
160
|
+
return { spawn: false, receipt: previous };
|
|
161
|
+
}
|
|
162
|
+
if (previous && sameIdentity(previous, input) && intakeUsable(previous)) {
|
|
163
|
+
const completed = previous.completedAt ? Date.parse(previous.completedAt) : NaN;
|
|
164
|
+
const age = input.now.getTime() - completed; // a future stamp (clock skew) is not fresh: refresh
|
|
165
|
+
if (Number.isFinite(completed) && age >= 0 && age <= exports.FRESHNESS_REREFRESH_MS)
|
|
166
|
+
return { spawn: false, receipt: previous };
|
|
167
|
+
}
|
|
168
|
+
const attempt = previous && sameIdentity(previous, input) ? previous.attempt + 1 : 1;
|
|
169
|
+
const receipt = {
|
|
170
|
+
schema: 'fresh-evidence/1', workspaceId: input.workspaceId, head: input.head,
|
|
171
|
+
generation: crypto.randomUUID(), state: 'refreshing', startedAt: input.now.toISOString(), attempt,
|
|
172
|
+
graph: 'refreshing', sourceSemantic: 'refreshing', requirementSemantic: 'refreshing',
|
|
173
|
+
};
|
|
174
|
+
writeReceipt(root, receipt);
|
|
175
|
+
return { spawn: true, receipt };
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* True only while `generation` still holds the live lease in an existing root. A worker asks this
|
|
179
|
+
* before each phase that writes, so a superseded or orphaned child stops instead of recreating
|
|
180
|
+
* `.ax` under a root that was removed (A-SPEC-724).
|
|
181
|
+
*/
|
|
182
|
+
function ownsLease(root, generation) {
|
|
183
|
+
const receipt = storedReceipt(root);
|
|
184
|
+
return receipt !== null && receipt.generation === generation && receipt.state === 'refreshing';
|
|
185
|
+
}
|
|
186
|
+
/** Publish only the lease owner’s terminal observation; a superseded worker cannot overwrite a newer lease. */
|
|
187
|
+
function completeRefresh(root, generation, completion, now) {
|
|
188
|
+
const previous = storedReceipt(root);
|
|
189
|
+
if (!previous || previous.generation !== generation || previous.state !== 'refreshing')
|
|
190
|
+
return null;
|
|
191
|
+
if (previous.head !== completion.head) {
|
|
192
|
+
const superseded = stale(previous);
|
|
193
|
+
writeReceipt(root, superseded);
|
|
194
|
+
return superseded;
|
|
195
|
+
}
|
|
196
|
+
// Currentness is the graph and requirement lanes (A-SPEC-719). The source lane is reported beside
|
|
197
|
+
// them and never substitutes for, nor withholds, requirement coverage.
|
|
198
|
+
const judged = [completion.graph, completion.requirementSemantic];
|
|
199
|
+
const lanesCurrent = judged.every((lane) => lane === 'current');
|
|
200
|
+
const retry = judged.some((lane) => lane === 'failed' || lane === 'retry-at');
|
|
201
|
+
const state = lanesCurrent ? 'current'
|
|
202
|
+
: judged.includes('suppressed') ? 'suppressed'
|
|
203
|
+
: judged.includes('not-adopted') ? 'not-adopted'
|
|
204
|
+
: retry ? 'retry-at' : 'failed';
|
|
205
|
+
const receipt = {
|
|
206
|
+
...previous, ...completion, state, completedAt: now.toISOString(),
|
|
207
|
+
...(retry ? { retryAt: new Date(now.getTime() + exports.FRESHNESS_RETRY_MS).toISOString() } : {}),
|
|
208
|
+
};
|
|
209
|
+
writeReceipt(root, receipt);
|
|
210
|
+
return receipt;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Initialized/registered workspaces use their governed identity. Legacy
|
|
214
|
+
* workspaces remain safe to refresh: their canonical real path is a local,
|
|
215
|
+
* deterministic identity and is never persisted as a secret or sent remotely.
|
|
216
|
+
*/
|
|
217
|
+
function workspaceIdFor(root) {
|
|
218
|
+
try {
|
|
219
|
+
const identity = (0, workspace_identity_1.workspaceIdentity)(root, 'status');
|
|
220
|
+
if (identity.state !== 'legacy')
|
|
221
|
+
return identity.workspaceId;
|
|
222
|
+
}
|
|
223
|
+
catch { /* maintenance is fail-soft; fall through to local identity */ }
|
|
224
|
+
let canonical = root;
|
|
225
|
+
try {
|
|
226
|
+
canonical = fs.realpathSync(root);
|
|
227
|
+
}
|
|
228
|
+
catch { /* retain caller root */ }
|
|
229
|
+
return `legacy-${crypto.createHash('sha256').update(canonical).digest('hex')}`;
|
|
230
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReplayCase } from './replay-corpus';
|
|
2
|
+
import { type HunkResolution } from './condition-hunk-resolution';
|
|
2
3
|
export interface ConditionHunkReplayReport {
|
|
3
4
|
schema: 'condition-hunk-replay/1';
|
|
4
5
|
commits: string[];
|
|
@@ -23,6 +24,17 @@ export interface ConditionHunkReplayReport {
|
|
|
23
24
|
conditionResolution: number;
|
|
24
25
|
overheadPct: number | null;
|
|
25
26
|
};
|
|
27
|
+
/** Auditable summaries only; source blobs and candidate lists remain outside the replay report. */
|
|
28
|
+
records: Array<{
|
|
29
|
+
commit: string;
|
|
30
|
+
file: string;
|
|
31
|
+
state: HunkResolution['state'];
|
|
32
|
+
direction: HunkResolution['direction'];
|
|
33
|
+
symbol?: string;
|
|
34
|
+
conditionText?: string;
|
|
35
|
+
reason?: string;
|
|
36
|
+
hunk: Pick<HunkResolution['hunk'], 'startLine' | 'endLine' | 'deletionOnly'>;
|
|
37
|
+
}>;
|
|
26
38
|
elapsedMs: number;
|
|
27
39
|
limitations: string[];
|
|
28
40
|
}
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.replayConditionHunks = replayConditionHunks;
|
|
37
|
+
// @implements A-SPEC-717
|
|
37
38
|
// @implements A-SPEC-661
|
|
38
39
|
/** Historical, read-only measurement for the condition-hunk advisory. */
|
|
39
40
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -57,6 +58,7 @@ async function replayConditionHunks(input) {
|
|
|
57
58
|
const started = Date.now();
|
|
58
59
|
const parser = new language_parser_1.TreeSitterTsParser();
|
|
59
60
|
const resolutions = [];
|
|
61
|
+
const records = [];
|
|
60
62
|
let files = 0, symbols = 0, candidateSymbols = 0, baselineMs = 0, conditionResolutionMs = 0;
|
|
61
63
|
const commits = [];
|
|
62
64
|
for (const replayCase of input.cases) {
|
|
@@ -85,7 +87,14 @@ async function replayConditionHunks(input) {
|
|
|
85
87
|
symbols += rows.length;
|
|
86
88
|
candidateSymbols += hunks.reduce((total, hunk) => total + rows.filter((symbol) => symbol.startLine <= hunk.startLine && symbol.endLine >= hunk.endLine).length, 0);
|
|
87
89
|
const conditionStart = Date.now();
|
|
88
|
-
|
|
90
|
+
const resolvedRows = await (0, condition_hunk_resolution_1.resolveConditionHunksFromSources)({ diff, sources: [{ file, source }], symbols: rows });
|
|
91
|
+
resolutions.push(...resolvedRows);
|
|
92
|
+
records.push(...resolvedRows.map((row) => ({ commit: replayCase.commit, file, state: row.state, direction: row.direction,
|
|
93
|
+
...(row.symbol === undefined ? {} : { symbol: row.symbol }),
|
|
94
|
+
...(row.conditionText === undefined ? {} : { conditionText: row.conditionText }),
|
|
95
|
+
...(row.reason === undefined ? {} : { reason: row.reason }),
|
|
96
|
+
hunk: { startLine: row.hunk.startLine, endLine: row.hunk.endLine, ...(row.hunk.deletionOnly ? { deletionOnly: true } : {}) },
|
|
97
|
+
})));
|
|
89
98
|
conditionResolutionMs += Date.now() - conditionStart;
|
|
90
99
|
}
|
|
91
100
|
}
|
|
@@ -101,6 +110,7 @@ async function replayConditionHunks(input) {
|
|
|
101
110
|
candidateReduction: { hunkToResolved: candidateSymbols === 0 ? null : 1 - resolved / candidateSymbols },
|
|
102
111
|
timingMs: { baseline: baselineMs, conditionResolution: conditionResolutionMs,
|
|
103
112
|
overheadPct: baselineMs === 0 ? null : conditionResolutionMs / baselineMs * 100 },
|
|
113
|
+
records,
|
|
104
114
|
elapsedMs: Date.now() - started,
|
|
105
115
|
limitations: [
|
|
106
116
|
'This measures only caller-selected TypeScript/JavaScript files with readable commit blobs.',
|
|
@@ -4,6 +4,7 @@ exports.parseUnifiedZeroDiff = parseUnifiedZeroDiff;
|
|
|
4
4
|
exports.classifyConditionDirection = classifyConditionDirection;
|
|
5
5
|
exports.resolveConditionHunks = resolveConditionHunks;
|
|
6
6
|
exports.resolveConditionHunksFromSources = resolveConditionHunksFromSources;
|
|
7
|
+
// @implements A-SPEC-717
|
|
7
8
|
// @implements A-SPEC-661
|
|
8
9
|
/** Pure, advisory-only resolution from a supplied zero-context diff to declared source spans. */
|
|
9
10
|
const ast_store_1 = require("../cpg/foundation/ast-store");
|
|
@@ -84,22 +85,50 @@ function predicateInChangedLine(line) {
|
|
|
84
85
|
}
|
|
85
86
|
return undefined;
|
|
86
87
|
}
|
|
88
|
+
/** A multiline hunk is usable only when it contains one balanced, complete control predicate. */
|
|
89
|
+
function completePredicateInChangedLines(lines) {
|
|
90
|
+
if (!Array.isArray(lines) || lines.length === 0)
|
|
91
|
+
return undefined;
|
|
92
|
+
const text = lines.join('\n');
|
|
93
|
+
const keywords = [...text.matchAll(/\b(?:if|while|switch)\s*\(/g)];
|
|
94
|
+
if (keywords.length !== 1)
|
|
95
|
+
return undefined;
|
|
96
|
+
const keyword = keywords[0];
|
|
97
|
+
const open = keyword.index + keyword[0].lastIndexOf('(');
|
|
98
|
+
let depth = 0;
|
|
99
|
+
for (let index = open; index < text.length; index++) {
|
|
100
|
+
if (text[index] === '(')
|
|
101
|
+
depth++;
|
|
102
|
+
if (text[index] === ')')
|
|
103
|
+
depth--;
|
|
104
|
+
if (depth < 0)
|
|
105
|
+
return undefined;
|
|
106
|
+
if (depth === 0) {
|
|
107
|
+
const predicate = text.slice(open + 1, index);
|
|
108
|
+
return predicate.trim() === '' ? undefined : predicate;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
87
113
|
/**
|
|
88
114
|
* Match a changed after-predicate to the CFG span, then take only the same-position removed
|
|
89
115
|
* predicate. Multiple matches, line-count changes, and non-control statements deliberately stay
|
|
90
116
|
* unknown: a zero-context diff cannot establish their correspondence.
|
|
91
117
|
*/
|
|
92
118
|
function beforeConditionFromHunk(hunk, afterCondition) {
|
|
93
|
-
if (afterCondition === undefined || hunk.addedLines === undefined || hunk.removedLines === undefined
|
|
94
|
-
|| hunk.addedLines.length !== hunk.removedLines.length)
|
|
119
|
+
if (afterCondition === undefined || hunk.addedLines === undefined || hunk.removedLines === undefined)
|
|
95
120
|
return undefined;
|
|
96
121
|
const expected = unwrapOuterParens(afterCondition);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
122
|
+
if (hunk.addedLines.length === hunk.removedLines.length) {
|
|
123
|
+
const matches = hunk.addedLines.map(predicateInChangedLine)
|
|
124
|
+
.map((predicate, index) => ({ predicate, index }))
|
|
125
|
+
.filter(({ predicate }) => predicate !== undefined && unwrapOuterParens(predicate) === expected);
|
|
126
|
+
if (matches.length === 1)
|
|
127
|
+
return predicateInChangedLine(hunk.removedLines[matches[0].index]);
|
|
128
|
+
}
|
|
129
|
+
const added = completePredicateInChangedLines(hunk.addedLines);
|
|
130
|
+
const removed = completePredicateInChangedLines(hunk.removedLines);
|
|
131
|
+
return added !== undefined && removed !== undefined && unwrapOuterParens(added) === expected ? removed : undefined;
|
|
103
132
|
}
|
|
104
133
|
/** Classifies only syntactic changes with a local, monotonic meaning; all other changes are unknown. */
|
|
105
134
|
function classifyConditionDirection(before, after) {
|
|
@@ -114,6 +143,16 @@ function classifyConditionDirection(before, after) {
|
|
|
114
143
|
return 'relaxed';
|
|
115
144
|
if (unaryRemoval && count(right, '!') < count(left, '!'))
|
|
116
145
|
return 'relaxed';
|
|
146
|
+
// A conjunction can inherit a direction from exactly one changed simple term. Do not split OR
|
|
147
|
+
// expressions or reorder terms: both require semantic reasoning this advisory does not claim.
|
|
148
|
+
if (!left.includes('||') && !right.includes('||')) {
|
|
149
|
+
const oldTerms = left.split(/\s*&&\s*/), newTerms = right.split(/\s*&&\s*/);
|
|
150
|
+
if (oldTerms.length > 1 && oldTerms.length === newTerms.length) {
|
|
151
|
+
const changed = oldTerms.map((term, index) => ({ term, next: newTerms[index] })).filter(({ term, next }) => term !== next);
|
|
152
|
+
if (changed.length === 1)
|
|
153
|
+
return classifyConditionDirection(changed[0].term, changed[0].next);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
117
156
|
const relation = /^(.+?)\s*(<=|<|>=|>)\s*(-?\d+(?:\.\d+)?)$/.exec(left);
|
|
118
157
|
const next = /^(.+?)\s*(<=|<|>=|>)\s*(-?\d+(?:\.\d+)?)$/.exec(right);
|
|
119
158
|
if (!relation || !next || compact(relation[1]) !== compact(next[1]))
|
|
@@ -173,6 +212,18 @@ function resolveConditionHunks(input) {
|
|
|
173
212
|
if (branches.length !== 1)
|
|
174
213
|
return { file: hunk.file, hunk, symbol: symbol.name, direction: 'unknown', state: 'ambiguous', reason: 'tied-condition-spans', candidates: branches };
|
|
175
214
|
const selected = branches[0];
|
|
215
|
+
const requiresCompletePredicate = (hunk.addedLines?.length ?? 0) > 1 || (hunk.removedLines?.length ?? 0) === 0;
|
|
216
|
+
const addedPredicate = completePredicateInChangedLines(hunk.addedLines);
|
|
217
|
+
if (requiresCompletePredicate) {
|
|
218
|
+
if (addedPredicate === undefined)
|
|
219
|
+
return { file: hunk.file, hunk, symbol: symbol.name, direction: 'unknown', state: 'unavailable', reason: 'incomplete-or-multiple-predicate' };
|
|
220
|
+
if (unwrapOuterParens(addedPredicate) !== unwrapOuterParens(selected.conditionText ?? '')) {
|
|
221
|
+
return { file: hunk.file, hunk, symbol: symbol.name, direction: 'unknown', state: 'unavailable', reason: 'predicate-does-not-match-condition' };
|
|
222
|
+
}
|
|
223
|
+
if ((hunk.removedLines?.length ?? 0) > 0 && completePredicateInChangedLines(hunk.removedLines) === undefined) {
|
|
224
|
+
return { file: hunk.file, hunk, symbol: symbol.name, direction: 'unknown', state: 'unavailable', reason: 'incomplete-before-predicate' };
|
|
225
|
+
}
|
|
226
|
+
}
|
|
176
227
|
const beforeConditionText = selected.beforeConditionText ?? beforeConditionFromHunk(hunk, selected.conditionText);
|
|
177
228
|
const branch = beforeConditionText === undefined ? selected : { ...selected, beforeConditionText };
|
|
178
229
|
return { file: hunk.file, hunk, symbol: symbol.name, branch, conditionText: branch.conditionText,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { RequirementVerdict } from './requirement-triage';
|
|
2
|
+
export type RecordKind = 'analyst' | 'prediction';
|
|
3
|
+
export interface AnalystTriageRecord {
|
|
4
|
+
analyst: string;
|
|
5
|
+
caseId: string;
|
|
6
|
+
verdict: RequirementVerdict;
|
|
7
|
+
preferredReqId?: string;
|
|
8
|
+
elapsedMs: number;
|
|
9
|
+
evidenceComplete?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ProductTriageRecord {
|
|
12
|
+
caseId: string;
|
|
13
|
+
verdict: RequirementVerdict;
|
|
14
|
+
candidates: Array<{
|
|
15
|
+
reqId?: string;
|
|
16
|
+
evidenceComplete?: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
elapsedMs: number;
|
|
19
|
+
}
|
|
20
|
+
export interface FrozenRequirementTriageRecords<T extends AnalystTriageRecord | ProductTriageRecord> {
|
|
21
|
+
schema: 'requirement-triage-records/1';
|
|
22
|
+
kind: RecordKind;
|
|
23
|
+
caseIds: readonly string[];
|
|
24
|
+
records: readonly T[];
|
|
25
|
+
digest: string;
|
|
26
|
+
}
|
|
27
|
+
export interface AnswerKeyEntry {
|
|
28
|
+
verdict: RequirementVerdict;
|
|
29
|
+
preferredReqId?: string;
|
|
30
|
+
}
|
|
31
|
+
type Metric = {
|
|
32
|
+
numerator: number;
|
|
33
|
+
denominator: number;
|
|
34
|
+
value: number | null;
|
|
35
|
+
unavailable?: string;
|
|
36
|
+
};
|
|
37
|
+
export interface HumanModelMeasurementReport {
|
|
38
|
+
analystCount: number;
|
|
39
|
+
caseCount: number;
|
|
40
|
+
metrics: {
|
|
41
|
+
retrievalCoverage: Metric;
|
|
42
|
+
humanChoiceAgreement: Metric;
|
|
43
|
+
falseReuse: Metric;
|
|
44
|
+
falseNew: Metric;
|
|
45
|
+
evidenceCompleteness: Metric;
|
|
46
|
+
ambiguityPreservation: Metric;
|
|
47
|
+
medianElapsedMs: {
|
|
48
|
+
value: number | null;
|
|
49
|
+
denominator: number;
|
|
50
|
+
unavailable?: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
conclusion: string;
|
|
54
|
+
}
|
|
55
|
+
/** Validate and content-address independent records before joining evaluator-only truth. */
|
|
56
|
+
export declare function freezeRequirementTriageRecords<T extends AnalystTriageRecord | ProductTriageRecord>(kind: RecordKind, caseIds: readonly string[], input: readonly T[]): FrozenRequirementTriageRecords<T>;
|
|
57
|
+
/** Join frozen independent records; answer key fields stay evaluator-only. */
|
|
58
|
+
export declare function joinRequirementTriageHumanRecords(analysts: FrozenRequirementTriageRecords<AnalystTriageRecord>, predictions: FrozenRequirementTriageRecords<ProductTriageRecord>, answerKey: Readonly<Record<string, AnswerKeyEntry>>): HumanModelMeasurementReport;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.freezeRequirementTriageRecords = freezeRequirementTriageRecords;
|
|
4
|
+
exports.joinRequirementTriageHumanRecords = joinRequirementTriageHumanRecords;
|
|
5
|
+
// @implements A-SPEC-715
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const VERDICTS = new Set(['fulfilled', 'existing-change', 'new', 'ambiguous']);
|
|
8
|
+
const ANSWER_KEY_FIELDS = new Set(['expectedVerdict', 'humanChoice', 'answerKey', 'expectedChoice']);
|
|
9
|
+
const ANALYST_FIELDS = new Set(['analyst', 'caseId', 'verdict', 'preferredReqId', 'elapsedMs', 'evidenceComplete']);
|
|
10
|
+
const PREDICTION_FIELDS = new Set(['caseId', 'verdict', 'candidates', 'elapsedMs']);
|
|
11
|
+
const stable = (value) => JSON.stringify(value);
|
|
12
|
+
const digest = (value) => 'sha256:' + (0, node_crypto_1.createHash)('sha256').update(stable(value)).digest('hex');
|
|
13
|
+
const ratio = (numerator, denominator, unavailable) => denominator ? { numerator, denominator, value: numerator / denominator } : { numerator, denominator, value: null, unavailable };
|
|
14
|
+
const copy = (value) => JSON.parse(JSON.stringify(value));
|
|
15
|
+
function validateCandidate(candidate, caseId) {
|
|
16
|
+
if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate))
|
|
17
|
+
throw new Error(`invalid candidate for ${caseId}`);
|
|
18
|
+
const fields = Object.keys(candidate);
|
|
19
|
+
for (const field of fields) {
|
|
20
|
+
if (ANSWER_KEY_FIELDS.has(field))
|
|
21
|
+
throw new Error(`answer-key candidate field is forbidden: ${field}`);
|
|
22
|
+
if (field !== 'reqId' && field !== 'evidenceComplete')
|
|
23
|
+
throw new Error(`unsupported candidate field: ${field}`);
|
|
24
|
+
}
|
|
25
|
+
const value = candidate;
|
|
26
|
+
if (value.reqId !== undefined && (typeof value.reqId !== 'string' || value.reqId.trim() === ''))
|
|
27
|
+
throw new Error(`invalid candidate reqId for ${caseId}`);
|
|
28
|
+
if (value.evidenceComplete !== undefined && typeof value.evidenceComplete !== 'boolean')
|
|
29
|
+
throw new Error(`invalid candidate evidenceComplete for ${caseId}`);
|
|
30
|
+
}
|
|
31
|
+
/** Validate and content-address independent records before joining evaluator-only truth. */
|
|
32
|
+
function freezeRequirementTriageRecords(kind, caseIds, input) {
|
|
33
|
+
const declared = [...new Set(caseIds)].sort();
|
|
34
|
+
if (declared.length !== caseIds.length || declared.some((id) => id.trim() === ''))
|
|
35
|
+
throw new Error('declared case ids must be unique and non-empty');
|
|
36
|
+
const seen = new Set(), covered = new Set(), coveredByAnalyst = new Map();
|
|
37
|
+
for (const raw of input) {
|
|
38
|
+
const allowed = kind === 'analyst' ? ANALYST_FIELDS : PREDICTION_FIELDS;
|
|
39
|
+
for (const field of Object.keys(raw)) {
|
|
40
|
+
if (ANSWER_KEY_FIELDS.has(field))
|
|
41
|
+
throw new Error(`answer-key field is forbidden: ${field}`);
|
|
42
|
+
if (!allowed.has(field))
|
|
43
|
+
throw new Error(`unsupported field: ${field}`);
|
|
44
|
+
}
|
|
45
|
+
const caseId = typeof raw.caseId === 'string' ? raw.caseId : '';
|
|
46
|
+
if (!declared.includes(caseId))
|
|
47
|
+
throw new Error(`unknown case id: ${caseId}`);
|
|
48
|
+
if (!VERDICTS.has(raw.verdict))
|
|
49
|
+
throw new Error(`invalid verdict for ${caseId}`);
|
|
50
|
+
if (!Number.isFinite(raw.elapsedMs) || Number(raw.elapsedMs) < 0)
|
|
51
|
+
throw new Error(`invalid elapsedMs for ${caseId}`);
|
|
52
|
+
const analyst = kind === 'analyst' ? (typeof raw.analyst === 'string' ? raw.analyst.trim() : '') : '';
|
|
53
|
+
if (kind === 'analyst' && analyst === '')
|
|
54
|
+
throw new Error(`analyst label is required for ${caseId}`);
|
|
55
|
+
if (kind === 'analyst' && raw.preferredReqId !== undefined && (typeof raw.preferredReqId !== 'string' || raw.preferredReqId.trim() === ''))
|
|
56
|
+
throw new Error(`invalid preferredReqId for ${caseId}`);
|
|
57
|
+
if (kind === 'analyst' && raw.evidenceComplete !== undefined && typeof raw.evidenceComplete !== 'boolean')
|
|
58
|
+
throw new Error(`invalid evidenceComplete for ${caseId}`);
|
|
59
|
+
if (kind === 'prediction') {
|
|
60
|
+
if (!Array.isArray(raw.candidates))
|
|
61
|
+
throw new Error(`prediction candidates are required for ${caseId}`);
|
|
62
|
+
for (const candidate of raw.candidates)
|
|
63
|
+
validateCandidate(candidate, caseId);
|
|
64
|
+
}
|
|
65
|
+
const key = kind === 'analyst' ? `${analyst}\u0000${caseId}` : caseId;
|
|
66
|
+
if (seen.has(key))
|
|
67
|
+
throw new Error(`duplicate record: ${caseId}`);
|
|
68
|
+
seen.add(key);
|
|
69
|
+
covered.add(caseId);
|
|
70
|
+
if (kind === 'analyst') {
|
|
71
|
+
const analystCases = coveredByAnalyst.get(analyst) ?? new Set();
|
|
72
|
+
analystCases.add(caseId);
|
|
73
|
+
coveredByAnalyst.set(analyst, analystCases);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (input.length > 0 && covered.size !== declared.length)
|
|
77
|
+
throw new Error('incomplete declared case set');
|
|
78
|
+
if (kind === 'analyst' && [...coveredByAnalyst.values()].some((analystCases) => analystCases.size !== declared.length)) {
|
|
79
|
+
throw new Error('incomplete declared case set for analyst');
|
|
80
|
+
}
|
|
81
|
+
const records = [...copy(input)].sort((a, b) => String(a.analyst ?? '').localeCompare(String(b.analyst ?? '')) || a.caseId.localeCompare(b.caseId));
|
|
82
|
+
const unsigned = { schema: 'requirement-triage-records/1', kind, caseIds: declared, records };
|
|
83
|
+
return Object.freeze({ ...unsigned, digest: digest(unsigned) });
|
|
84
|
+
}
|
|
85
|
+
function assertFrozen(receipt, kind) {
|
|
86
|
+
if (receipt.schema !== 'requirement-triage-records/1' || receipt.kind !== kind)
|
|
87
|
+
throw new Error('wrong record receipt kind');
|
|
88
|
+
const unsigned = { schema: receipt.schema, kind: receipt.kind, caseIds: [...receipt.caseIds], records: [...receipt.records] };
|
|
89
|
+
if (receipt.digest !== digest(unsigned))
|
|
90
|
+
throw new Error('record receipt digest mismatch');
|
|
91
|
+
}
|
|
92
|
+
/** Join frozen independent records; answer key fields stay evaluator-only. */
|
|
93
|
+
function joinRequirementTriageHumanRecords(analysts, predictions, answerKey) {
|
|
94
|
+
assertFrozen(analysts, 'analyst');
|
|
95
|
+
assertFrozen(predictions, 'prediction');
|
|
96
|
+
const caseIds = [...analysts.caseIds];
|
|
97
|
+
if (stable(caseIds) !== stable([...predictions.caseIds]))
|
|
98
|
+
throw new Error('record case sets differ');
|
|
99
|
+
if (Object.keys(answerKey).some((id) => !caseIds.includes(id)))
|
|
100
|
+
throw new Error('answer key contains unknown case id');
|
|
101
|
+
const product = new Map(predictions.records.map((record) => [record.caseId, record]));
|
|
102
|
+
const analystCount = new Set(analysts.records.map((record) => record.analyst)).size;
|
|
103
|
+
const predicted = caseIds.flatMap((caseId) => product.has(caseId) && answerKey[caseId] ? [{ prediction: product.get(caseId), answer: answerKey[caseId] }] : []);
|
|
104
|
+
const pairs = analysts.records.flatMap((analyst) => product.has(analyst.caseId) && answerKey[analyst.caseId] ? [{ analyst, prediction: product.get(analyst.caseId) }] : []);
|
|
105
|
+
const reuse = predicted.filter(({ answer }) => answer.verdict === 'fulfilled' || answer.verdict === 'existing-change');
|
|
106
|
+
const newCases = predicted.filter(({ answer }) => answer.verdict === 'new');
|
|
107
|
+
const ambiguous = predicted.filter(({ answer }) => answer.verdict === 'ambiguous');
|
|
108
|
+
const preferred = predicted.filter(({ answer }) => answer.preferredReqId !== undefined);
|
|
109
|
+
const median = (values) => { const sorted = [...values].sort((a, b) => a - b), m = Math.floor(sorted.length / 2); return sorted.length % 2 ? sorted[m] : (sorted[m - 1] + sorted[m]) / 2; };
|
|
110
|
+
return { analystCount, caseCount: caseIds.length, metrics: {
|
|
111
|
+
retrievalCoverage: ratio(preferred.filter(({ prediction, answer }) => prediction.candidates.some((candidate) => candidate.reqId === answer.preferredReqId)).length, preferred.length, 'no answer-key preferred requirement cases'),
|
|
112
|
+
humanChoiceAgreement: ratio(pairs.filter(({ analyst, prediction }) => analyst.verdict === prediction.verdict && (analyst.preferredReqId ?? null) === (prediction.candidates[0]?.reqId ?? null)).length, pairs.length, analystCount ? 'no overlapping analyst and prediction records' : 'no independent analyst records'),
|
|
113
|
+
falseReuse: ratio(newCases.filter(({ prediction }) => prediction.verdict === 'fulfilled' || prediction.verdict === 'existing-change').length, newCases.length, 'no answer-key new cases'),
|
|
114
|
+
falseNew: ratio(reuse.filter(({ prediction }) => prediction.verdict === 'new').length, reuse.length, 'no answer-key reuse cases'),
|
|
115
|
+
evidenceCompleteness: ratio(predicted.filter(({ prediction }) => prediction.candidates.length > 0 && prediction.candidates.every((candidate) => candidate.evidenceComplete === true)).length, predicted.length, 'no scored prediction cases'),
|
|
116
|
+
ambiguityPreservation: ratio(ambiguous.filter(({ prediction }) => prediction.verdict === 'ambiguous').length, ambiguous.length, 'no ambiguous answer-key cases'),
|
|
117
|
+
medianElapsedMs: predicted.length ? { value: median(predicted.map(({ prediction }) => prediction.elapsedMs)), denominator: predicted.length } : { value: null, denominator: 0, unavailable: 'no scored prediction cases' },
|
|
118
|
+
}, conclusion: analystCount === 0 || predicted.length === 0 ? 'Insufficient independent data; no comparative conclusion.' : 'Measured comparison only; sample and corpus limitations remain part of the result.' };
|
|
119
|
+
}
|
|
@@ -36,7 +36,12 @@ function obligationGapsFor(specs, impactedSpecIds) {
|
|
|
36
36
|
const parent = specs.find((s) => s.type === 'H-SPEC' && (a.dependsOn ?? []).includes(s.id));
|
|
37
37
|
if (!parent)
|
|
38
38
|
continue;
|
|
39
|
-
const
|
|
39
|
+
const siblingAspecIds = new Set(specs
|
|
40
|
+
.filter((s) => s.type === 'A-SPEC' && s.status === 'approved' && (s.dependsOn ?? []).includes(parent.id))
|
|
41
|
+
.map((s) => s.id));
|
|
42
|
+
// The impacted slice's own T-SPECs count as they always did; approved siblings only add to them.
|
|
43
|
+
const tspecs = specs.filter((s) => s.type === 'T-SPEC' && ((s.dependsOn ?? []).includes(a.id)
|
|
44
|
+
|| (s.status === 'approved' && (s.dependsOn ?? []).some((id) => siblingAspecIds.has(id)))));
|
|
40
45
|
for (const o of (0, nonfunctional_1.unmetObligations)(parent.sections?.['Non-Functional'] ?? '', tspecs.map((t) => t.sections ?? {}))) {
|
|
41
46
|
out.push(`${a.id} [${o.tag}]`);
|
|
42
47
|
}
|
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
import { ExecutionContext } from '../project/execution-context';
|
|
2
2
|
import { TestOutcome } from './test-runner';
|
|
3
3
|
export declare const OUTCOMES_FILE: string;
|
|
4
|
+
export declare const RELEASE_TEST_LANE_FILE: string;
|
|
5
|
+
export declare const RELEASE_TEST_LANE_SCHEMA: "release-test-lane/1";
|
|
6
|
+
export interface ReleaseTestLaneReceipt {
|
|
7
|
+
schema: typeof RELEASE_TEST_LANE_SCHEMA;
|
|
8
|
+
root: string;
|
|
9
|
+
head: string;
|
|
10
|
+
completedAt: string;
|
|
11
|
+
passed: true;
|
|
12
|
+
externalAccess: 'forbidden';
|
|
13
|
+
command: string[];
|
|
14
|
+
include: string[];
|
|
15
|
+
exclusions: Array<{
|
|
16
|
+
pattern: string;
|
|
17
|
+
reason: string;
|
|
18
|
+
}>;
|
|
19
|
+
digest: string;
|
|
20
|
+
}
|
|
21
|
+
export type ReleaseTestLaneValidation = {
|
|
22
|
+
valid: true;
|
|
23
|
+
receipt: ReleaseTestLaneReceipt;
|
|
24
|
+
} | {
|
|
25
|
+
valid: false;
|
|
26
|
+
reason: string;
|
|
27
|
+
};
|
|
28
|
+
/** Persist only evidence whose scope is explicit and bounded; callers cannot choose its path. */
|
|
29
|
+
export declare function writeReleaseTestLaneReceipt(root: string, input: Omit<ReleaseTestLaneReceipt, 'schema' | 'digest'>): ReleaseTestLaneReceipt | null;
|
|
30
|
+
/** Read the sole project-local receipt and fail closed for every missing or unprovable condition. */
|
|
31
|
+
export declare function validateReleaseTestLaneReceipt(root: string, head: string, now?: number): ReleaseTestLaneValidation;
|
|
4
32
|
export declare function outcomesFilename(replica: string): string;
|
|
5
33
|
export declare function isOutcomesFilename(name: string): boolean;
|
|
6
34
|
/**
|