@holmes-lab/holmes-kit 0.29.0 → 0.31.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 +556 -0
- package/README.md +15 -5
- package/bin/holmes-hook-antigravity.js +4 -0
- package/bin/holmes-kit.js +4 -0
- package/bin/holmes-pre-push.js +3 -0
- package/bin/holmes-stop-antigravity.js +4 -0
- 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/agents.d.ts +41 -0
- package/dist/holmes/cli/agents.js +382 -2
- package/dist/holmes/cli/attest.d.ts +2 -0
- package/dist/holmes/cli/attest.js +66 -15
- package/dist/holmes/cli/ci-gate.js +16 -1
- package/dist/holmes/cli/claude-switches.d.ts +95 -0
- package/dist/holmes/cli/claude-switches.js +967 -0
- package/dist/holmes/cli/codex-hooks.d.ts +77 -0
- package/dist/holmes/cli/codex-hooks.js +802 -0
- package/dist/holmes/cli/codex-oracle.d.ts +194 -0
- package/dist/holmes/cli/codex-oracle.js +1245 -0
- package/dist/holmes/cli/codex-toml.d.ts +58 -1
- package/dist/holmes/cli/codex-toml.js +456 -40
- package/dist/holmes/cli/doctor.d.ts +108 -8
- package/dist/holmes/cli/doctor.js +1408 -98
- package/dist/holmes/cli/index.js +23 -11
- package/dist/holmes/cli/init.d.ts +13 -0
- package/dist/holmes/cli/init.js +749 -77
- package/dist/holmes/cli/interactive-prompt.js +2 -2
- package/dist/holmes/cli/mcp-launcher.d.ts +64 -6
- package/dist/holmes/cli/mcp-launcher.js +189 -6
- package/dist/holmes/cli/mcp-version.js +13 -2
- package/dist/holmes/cli/settings-merge.js +8 -2
- package/dist/holmes/cli/upgrade.d.ts +13 -0
- package/dist/holmes/cli/upgrade.js +116 -23
- package/dist/holmes/cli/workspace-scope.d.ts +22 -0
- package/dist/holmes/cli/workspace-scope.js +375 -0
- package/dist/holmes/cli/worktree-readiness.d.ts +1 -0
- package/dist/holmes/cli/worktree-readiness.js +17 -3
- package/dist/holmes/cpg/cpg-scanner.d.ts +29 -0
- package/dist/holmes/cpg/cpg-scanner.js +403 -3
- package/dist/holmes/cpg/cycle-detect.js +2 -1
- package/dist/holmes/cpg/forbidden-edges.js +9 -2
- package/dist/holmes/cpg/required-calls.js +8 -1
- package/dist/holmes/governance/autonomy.d.ts +9 -0
- package/dist/holmes/governance/autonomy.js +28 -1
- package/dist/holmes/governance/constitution-debt.js +3 -2
- package/dist/holmes/governance/constitution.js +15 -3
- package/dist/holmes/governance/provenance-chain.js +3 -2
- package/dist/holmes/governance/push-gate-runner.js +4 -3
- package/dist/holmes/guardrail/dependency-delta.js +4 -3
- package/dist/holmes/guardrail/linear-match.d.ts +57 -0
- package/dist/holmes/guardrail/linear-match.js +256 -0
- package/dist/holmes/guardrail/risk-classifier.d.ts +6 -7
- package/dist/holmes/guardrail/risk-classifier.js +931 -44
- package/dist/holmes/guardrail/risk-types.d.ts +6 -0
- package/dist/holmes/guardrail/scope-judgment.d.ts +4 -24
- package/dist/holmes/guardrail/scope-judgment.js +100 -23
- package/dist/holmes/guardrail/shell-words.d.ts +42 -0
- package/dist/holmes/guardrail/shell-words.js +1720 -0
- package/dist/holmes/guardrail/write-target.d.ts +168 -3
- package/dist/holmes/guardrail/write-target.js +2379 -87
- package/dist/holmes/hooks/adapters/antigravity.d.ts +3 -1
- package/dist/holmes/hooks/adapters/antigravity.js +115 -11
- package/dist/holmes/hooks/pre-tool-use.d.ts +32 -6
- package/dist/holmes/hooks/pre-tool-use.js +923 -87
- package/dist/holmes/hooks/rtm-refresh-child.d.ts +22 -1
- package/dist/holmes/hooks/rtm-refresh-child.js +102 -18
- package/dist/holmes/hooks/rtm-refresh.d.ts +20 -1
- package/dist/holmes/hooks/rtm-refresh.js +60 -15
- package/dist/holmes/hooks/session-start.d.ts +10 -0
- package/dist/holmes/hooks/session-start.js +31 -7
- package/dist/holmes/hooks/stop.d.ts +2 -1
- package/dist/holmes/hooks/stop.js +197 -91
- 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 +20 -0
- package/dist/holmes/mcp/approval-commit.js +108 -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 +8 -3
- package/dist/holmes/mcp/handlers/graph-operations.d.ts +17 -1
- package/dist/holmes/mcp/handlers/graph-operations.js +15 -6
- package/dist/holmes/mcp/handlers/maintenance-analysis.js +11 -5
- package/dist/holmes/mcp/handlers/maintenance-evidence.js +3 -2
- package/dist/holmes/mcp/handlers/phase-queries.d.ts +22 -7
- package/dist/holmes/mcp/handlers/phase-queries.js +81 -2
- package/dist/holmes/mcp/handlers/requirement-triage.d.ts +26 -0
- package/dist/holmes/mcp/handlers/requirement-triage.js +48 -11
- package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -1
- package/dist/holmes/mcp/handlers/review-evidence.js +15 -5
- package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +18 -0
- package/dist/holmes/mcp/handlers/slice-orchestration.js +122 -16
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +35 -2
- package/dist/holmes/mcp/handlers/spec-approval.js +175 -57
- package/dist/holmes/mcp/handlers/spec-authoring.js +36 -3
- package/dist/holmes/mcp/handlers/spec-queries.d.ts +39 -3
- package/dist/holmes/mcp/handlers/spec-queries.js +114 -7
- package/dist/holmes/mcp/handlers/test-execution.js +9 -3
- package/dist/holmes/mcp/handlers.d.ts +126 -8
- package/dist/holmes/mcp/handlers.js +109 -18
- package/dist/holmes/mcp/harness-attestation.d.ts +20 -0
- package/dist/holmes/mcp/harness-attestation.js +179 -0
- 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 +72 -2
- package/dist/holmes/mcp/requirement-triage-evidence.js +227 -1
- package/dist/holmes/mcp/server.js +24 -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 +54 -7
- package/dist/holmes/mcp/validate-args.js +12 -0
- package/dist/holmes/project/bounded-io.d.ts +102 -0
- package/dist/holmes/project/bounded-io.js +212 -0
- package/dist/holmes/project/change-source.js +3 -1
- package/dist/holmes/project/ci-runs.js +3 -2
- package/dist/holmes/project/ignore.d.ts +31 -2
- package/dist/holmes/project/ignore.js +409 -50
- package/dist/holmes/project/regular-file-guard.d.ts +13 -0
- package/dist/holmes/project/regular-file-guard.js +149 -0
- package/dist/holmes/project/root.js +12 -3
- package/dist/holmes/refresh/freshness-coordinator.d.ts +67 -0
- package/dist/holmes/refresh/freshness-coordinator.js +230 -0
- package/dist/holmes/reverse/anchor.js +4 -3
- package/dist/holmes/reverse/scan.js +6 -2
- package/dist/holmes/review/commit-text.js +3 -2
- package/dist/holmes/review/condition-hunk-replay.d.ts +12 -0
- package/dist/holmes/review/condition-hunk-replay.js +13 -2
- package/dist/holmes/review/condition-hunk-resolution.js +59 -8
- package/dist/holmes/review/failed-test-names.js +13 -10
- package/dist/holmes/review/findings.js +3 -1
- package/dist/holmes/review/kills-check.js +6 -1
- package/dist/holmes/review/point-in-time-replay.js +5 -4
- package/dist/holmes/review/replay-corpus.js +5 -4
- 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/run-replay.js +3 -2
- package/dist/holmes/review/scope.js +6 -1
- package/dist/holmes/review/temporal-prior.js +3 -2
- package/dist/holmes/review/test-evidence.js +3 -2
- package/dist/holmes/review/test-outcomes.d.ts +28 -0
- package/dist/holmes/review/test-outcomes.js +92 -2
- package/dist/holmes/review/test-runner.d.ts +6 -0
- package/dist/holmes/review/test-runner.js +36 -15
- package/dist/holmes/rtm/advisory-outcomes.js +3 -2
- package/dist/holmes/rtm/anchor-ids.js +42 -2
- package/dist/holmes/rtm/file-anchors.js +4 -1
- package/dist/holmes/rtm/ftt-fulfilment.js +8 -3
- package/dist/holmes/rtm/git-changes.js +3 -1
- package/dist/holmes/rtm/graph-store.js +3 -2
- package/dist/holmes/rtm/test-scope.js +9 -4
- package/dist/holmes/spec/compat-impact.d.ts +25 -4
- package/dist/holmes/spec/compat-impact.js +682 -11
- package/dist/holmes/spec/entity-git-snapshot.js +3 -2
- package/dist/holmes/spec/entity-integration.js +3 -2
- package/dist/holmes/spec/entity-renumber-transaction.d.ts +19 -0
- package/dist/holmes/spec/entity-renumber-transaction.js +79 -6
- package/dist/holmes/spec/remote-spec-refs.js +3 -2
- package/dist/holmes/spec/renumber.js +25 -10
- package/dist/holmes/spec/spec-parser.js +9 -3
- package/dist/holmes/spec/yaml-scalar.js +2 -2
- package/dist/holmes/update/refresh.js +3 -1
- package/dist/holmes/update/update-notice.d.ts +6 -0
- package/dist/holmes/update/update-notice.js +18 -1
- package/package.json +11 -4
|
@@ -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,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// @implements A-SPEC-582.1
|
|
2
|
+
// @implements A-SPEC-582.1, A-SPEC-733
|
|
3
3
|
/**
|
|
4
4
|
* The names behind a red release gate.
|
|
5
5
|
*
|
|
@@ -14,7 +14,9 @@ exports.failedTestNames = failedTestNames;
|
|
|
14
14
|
/** How many names a refusal lists before it counts the rest. */
|
|
15
15
|
exports.FAILED_NAME_CAP = 10;
|
|
16
16
|
/** Jest's summary marks each failure with `● <suite> › <test>`. */
|
|
17
|
-
|
|
17
|
+
// @implements A-SPEC-733 (round 9 census) — `(.+?)\s*$` rescanned a blank run from every lazy step
|
|
18
|
+
// (a name holding 80 KB of blanks: 3.7 s); the greedy capture is trimmed instead.
|
|
19
|
+
const SUMMARY_LINE = /^\s*●\s+(\S.*)$/;
|
|
18
20
|
/**
|
|
19
21
|
* Pull the failing test names out of a jest run's output.
|
|
20
22
|
*
|
|
@@ -24,20 +26,21 @@ const SUMMARY_LINE = /^\s*●\s+(.+?)\s*$/;
|
|
|
24
26
|
* failure.
|
|
25
27
|
*/
|
|
26
28
|
function failedTestNames(output) {
|
|
27
|
-
|
|
29
|
+
// @implements A-SPEC-733 (round 11) — a Set: `seen.includes` was quadratic (100k distinct names: 10.5 s).
|
|
30
|
+
const seen = new Set();
|
|
28
31
|
for (const line of String(output ?? '').split('\n')) {
|
|
29
32
|
const m = SUMMARY_LINE.exec(line);
|
|
30
33
|
if (m === null)
|
|
31
34
|
continue;
|
|
32
|
-
const name = m[1];
|
|
35
|
+
const name = m[1].trimEnd();
|
|
33
36
|
// A `●` line that is not a test name (jest uses the bullet for Console blocks too).
|
|
34
37
|
if (name === '' || name === 'Console' || !name.includes('›'))
|
|
35
38
|
continue;
|
|
36
|
-
|
|
37
|
-
seen.push(name);
|
|
39
|
+
seen.add(name);
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const names = [...seen];
|
|
42
|
+
if (names.length <= exports.FAILED_NAME_CAP)
|
|
43
|
+
return names;
|
|
44
|
+
const rest = names.length - exports.FAILED_NAME_CAP;
|
|
45
|
+
return [...names.slice(0, exports.FAILED_NAME_CAP), `… and ${rest} more`];
|
|
43
46
|
}
|
|
@@ -34,8 +34,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.FindingsLedger = void 0;
|
|
37
|
+
// @implements A-SPEC-734
|
|
37
38
|
const fs = __importStar(require("node:fs"));
|
|
38
39
|
const path = __importStar(require("node:path"));
|
|
40
|
+
const bounded_io_1 = require("../project/bounded-io");
|
|
39
41
|
// @implements A-SPEC-102.1
|
|
40
42
|
/**
|
|
41
43
|
* Append-only, spec/code-linked audit trail of review findings. Each call to
|
|
@@ -67,7 +69,7 @@ class FindingsLedger {
|
|
|
67
69
|
list(filter) {
|
|
68
70
|
let raw;
|
|
69
71
|
try {
|
|
70
|
-
raw =
|
|
72
|
+
raw = (0, bounded_io_1.readRegularTextSync)(this.path);
|
|
71
73
|
}
|
|
72
74
|
catch (err) {
|
|
73
75
|
// Missing file: no findings recorded yet, not an error. Any other
|
|
@@ -52,6 +52,7 @@ exports.anchoredSourceTexts = anchoredSourceTexts;
|
|
|
52
52
|
*/
|
|
53
53
|
const fs = __importStar(require("node:fs"));
|
|
54
54
|
const path = __importStar(require("node:path"));
|
|
55
|
+
const cpg_scanner_1 = require("../cpg/cpg-scanner");
|
|
55
56
|
// A bare relative path with an extension and no whitespace — the shape all 22 measured entries had.
|
|
56
57
|
const LOOKS_LIKE_PATH = /^[\w@./-]+\.[A-Za-z0-9]{1,6}$/;
|
|
57
58
|
/** Reason precedence: empty → no source at all → found (applicable) → path-shaped → not found. Pure. */
|
|
@@ -125,12 +126,16 @@ function anchoredSourceTexts(root, aspecId) {
|
|
|
125
126
|
if (SKIP_DIRS.has(e.name) || e.name.startsWith('.'))
|
|
126
127
|
continue;
|
|
127
128
|
const p = path.join(d, e.name);
|
|
129
|
+
// @implements A-SPEC-734 (round 10) — nested trees skipped, regular files only (a FIFO hung the seal).
|
|
128
130
|
if (e.isDirectory()) {
|
|
129
|
-
|
|
131
|
+
if (!(0, cpg_scanner_1.isNestedWorkTree)(p, root))
|
|
132
|
+
walk(p);
|
|
130
133
|
continue;
|
|
131
134
|
}
|
|
132
135
|
if (!SOURCE.test(e.name) || /\.test\./.test(e.name))
|
|
133
136
|
continue;
|
|
137
|
+
if (!(0, cpg_scanner_1.isRegularSource)(e, p, root))
|
|
138
|
+
continue;
|
|
134
139
|
let text;
|
|
135
140
|
try {
|
|
136
141
|
text = fs.readFileSync(p, 'utf8');
|
|
@@ -35,13 +35,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.materializeTreeAt = materializeTreeAt;
|
|
37
37
|
exports.verifyTreeFidelity = verifyTreeFidelity;
|
|
38
|
-
// @implements A-SPEC-599
|
|
38
|
+
// @implements A-SPEC-599, A-SPEC-734
|
|
39
39
|
// @implements A-SPEC-297
|
|
40
40
|
const fs = __importStar(require("node:fs"));
|
|
41
41
|
const os = __importStar(require("node:os"));
|
|
42
42
|
const path = __importStar(require("node:path"));
|
|
43
43
|
const crypto = __importStar(require("node:crypto"));
|
|
44
44
|
const node_child_process_1 = require("node:child_process");
|
|
45
|
+
const bounded_io_1 = require("../project/bounded-io");
|
|
45
46
|
/**
|
|
46
47
|
* A pathspec is ours to control, but a caller mistake here writes outside the destination, so it is
|
|
47
48
|
* checked rather than trusted: repo-relative, no escape, no absolute root.
|
|
@@ -53,7 +54,7 @@ function pathspecIsSafe(pathspec) {
|
|
|
53
54
|
return !normalized.startsWith('..') && !normalized.split(path.sep).includes('..');
|
|
54
55
|
}
|
|
55
56
|
function git(repoRoot, args) {
|
|
56
|
-
return (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, ...args], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
57
|
+
return (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, ...args], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
57
58
|
}
|
|
58
59
|
/** `path mode sha` triples the commit records for the pathspec, keyed by repo-relative path. */
|
|
59
60
|
function blobsAt(repoRoot, commitish, pathspec) {
|
|
@@ -119,7 +120,7 @@ function materializeTreeAt(repoRoot, commitish, pathspec, destDir, opts) {
|
|
|
119
120
|
// the fidelity check would see a file the commit never had.
|
|
120
121
|
const tarPath = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'pit-tar-')), 'tree.tar');
|
|
121
122
|
try {
|
|
122
|
-
const tar = (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, 'archive', '--format=tar', commitish, '--', pathspec], { maxBuffer: 512 * 1024 * 1024 });
|
|
123
|
+
const tar = (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, 'archive', '--format=tar', commitish, '--', pathspec], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, maxBuffer: 512 * 1024 * 1024 });
|
|
123
124
|
fs.writeFileSync(tarPath, tar);
|
|
124
125
|
(0, node_child_process_1.execFileSync)('tar', ['-x', '-C', destDir, '-f', tarPath], { maxBuffer: 512 * 1024 * 1024 });
|
|
125
126
|
// Archive preserves modes/layout, but applies EOL/export substitutions. Read raw objects in
|
|
@@ -129,7 +130,7 @@ function materializeTreeAt(repoRoot, commitish, pathspec, destDir, opts) {
|
|
|
129
130
|
const refs = fs.openSync(refsPath, 'r');
|
|
130
131
|
let raw;
|
|
131
132
|
try {
|
|
132
|
-
raw = (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, 'cat-file', '--batch'], {
|
|
133
|
+
raw = (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, 'cat-file', '--batch'], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS,
|
|
133
134
|
stdio: [refs, 'pipe', 'pipe'], maxBuffer: 512 * 1024 * 1024,
|
|
134
135
|
});
|
|
135
136
|
}
|
|
@@ -38,12 +38,13 @@ exports.changedParentLines = changedParentLines;
|
|
|
38
38
|
exports.casesFor = casesFor;
|
|
39
39
|
exports.thinSpecs = thinSpecs;
|
|
40
40
|
exports.casesAvoidingRecent = casesAvoidingRecent;
|
|
41
|
-
// @implements A-SPEC-345
|
|
41
|
+
// @implements A-SPEC-345, A-SPEC-734
|
|
42
42
|
// @implements A-SPEC-387
|
|
43
43
|
const os = __importStar(require("node:os"));
|
|
44
44
|
const path = __importStar(require("node:path"));
|
|
45
45
|
const node_child_process_1 = require("node:child_process");
|
|
46
46
|
const maintenance_analyze_1 = require("../mcp/maintenance-analyze");
|
|
47
|
+
const bounded_io_1 = require("../project/bounded-io");
|
|
47
48
|
const TS_FAMILY = (f) => f.endsWith('.ts') && !f.endsWith('.d.ts');
|
|
48
49
|
// @implements A-SPEC-573.3
|
|
49
50
|
/**
|
|
@@ -59,7 +60,7 @@ const TS_FAMILY = (f) => f.endsWith('.ts') && !f.endsWith('.d.ts');
|
|
|
59
60
|
function changedParentLines(root, commit, file) {
|
|
60
61
|
let raw;
|
|
61
62
|
try {
|
|
62
|
-
raw = (0, node_child_process_1.execFileSync)('git', ['-C', root, 'show', '--unified=0', '--format=', commit, '--', file], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 });
|
|
63
|
+
raw = (0, node_child_process_1.execFileSync)('git', ['-C', root, 'show', '--unified=0', '--format=', commit, '--', file], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 });
|
|
63
64
|
}
|
|
64
65
|
catch {
|
|
65
66
|
return [];
|
|
@@ -151,7 +152,7 @@ function casesFor(corpus, limit, offset = 0) {
|
|
|
151
152
|
// proved present FIRST; only after that does a pin failure become an error.
|
|
152
153
|
const here = (() => {
|
|
153
154
|
try {
|
|
154
|
-
(0, node_child_process_1.execFileSync)('git', ['-C', corpus.root, 'rev-parse', '--git-dir'], { encoding: 'utf8', stdio: 'pipe' });
|
|
155
|
+
(0, node_child_process_1.execFileSync)('git', ['-C', corpus.root, 'rev-parse', '--git-dir'], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, maxBuffer: bounded_io_1.GIT_MAX_BUFFER, encoding: 'utf8', stdio: 'pipe' });
|
|
155
156
|
return true;
|
|
156
157
|
}
|
|
157
158
|
catch {
|
|
@@ -164,7 +165,7 @@ function casesFor(corpus, limit, offset = 0) {
|
|
|
164
165
|
let raw;
|
|
165
166
|
try {
|
|
166
167
|
raw = (0, node_child_process_1.execFileSync)('git', ['-C', corpus.root, 'log', from, '--no-merges', '--format=%H\x1f%s',
|
|
167
|
-
'--name-only', '--', ...corpus.sourcePathspec], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
168
|
+
'--name-only', '--', ...corpus.sourcePathspec], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
168
169
|
}
|
|
169
170
|
catch (e) {
|
|
170
171
|
// The repository is here, so this is a configuration error, not a missing corpus.
|
|
@@ -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,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.uncitedDiffs = uncitedDiffs;
|
|
37
37
|
exports.runReplay = runReplay;
|
|
38
38
|
exports.semanticCaseRanking = semanticCaseRanking;
|
|
39
|
-
// @implements A-SPEC-346
|
|
39
|
+
// @implements A-SPEC-346, A-SPEC-734
|
|
40
40
|
// @implements A-SPEC-347
|
|
41
41
|
// @implements A-SPEC-348
|
|
42
42
|
// @implements A-SPEC-349
|
|
@@ -82,6 +82,7 @@ const dense_retrieval_1 = require("./dense-retrieval");
|
|
|
82
82
|
const explore_1 = require("../assoc/explore");
|
|
83
83
|
const temporal_prior_1 = require("./temporal-prior");
|
|
84
84
|
const commit_text_1 = require("./commit-text");
|
|
85
|
+
const bounded_io_1 = require("../project/bounded-io");
|
|
85
86
|
/**
|
|
86
87
|
* @implements A-SPEC-578.7
|
|
87
88
|
* The paired differences on the UNCITED axis, ready for `pairedPower`.
|
|
@@ -374,7 +375,7 @@ async function runReplay(corpus, limit, opts = {}) {
|
|
|
374
375
|
const { buildJudgementBundle } = require('./judgement-bundle');
|
|
375
376
|
const gitQ = (args) => {
|
|
376
377
|
try {
|
|
377
|
-
return (0, node_child_process_1.execFileSync)('git', ['-C', corpus.root, ...args], { encoding: 'utf8', stdio: 'pipe' });
|
|
378
|
+
return (0, node_child_process_1.execFileSync)('git', ['-C', corpus.root, ...args], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, maxBuffer: bounded_io_1.GIT_MAX_BUFFER, encoding: 'utf8', stdio: 'pipe' });
|
|
378
379
|
}
|
|
379
380
|
catch {
|
|
380
381
|
return '';
|
|
@@ -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
|
}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.temporalPrior = temporalPrior;
|
|
4
4
|
exports.priorFor = priorFor;
|
|
5
|
-
// @implements A-SPEC-377
|
|
5
|
+
// @implements A-SPEC-377, A-SPEC-734
|
|
6
6
|
const node_child_process_1 = require("node:child_process");
|
|
7
7
|
const maintenance_analyze_1 = require("../mcp/maintenance-analyze");
|
|
8
|
+
const bounded_io_1 = require("../project/bounded-io");
|
|
8
9
|
function temporalPrior(root, before, limit = 200) {
|
|
9
10
|
let raw;
|
|
10
11
|
try {
|
|
11
|
-
raw = (0, node_child_process_1.execFileSync)('git', ['-C', root, 'log', '--no-merges', `-${limit}`, '--format=%H', '--name-only', before], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
12
|
+
raw = (0, node_child_process_1.execFileSync)('git', ['-C', root, 'log', '--no-merges', `-${limit}`, '--format=%H', '--name-only', before], { timeout: bounded_io_1.GIT_TIMEOUT_MS, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
12
13
|
}
|
|
13
14
|
catch {
|
|
14
15
|
// A repository or revision this machine does not have is unmeasured, not empty.
|
|
@@ -38,9 +38,10 @@ exports.computeExecutedByAspec = computeExecutedByAspec;
|
|
|
38
38
|
exports.isFresh = isFresh;
|
|
39
39
|
exports.writeTestEvidence = writeTestEvidence;
|
|
40
40
|
exports.readTestEvidence = readTestEvidence;
|
|
41
|
-
// @implements A-SPEC-102.1
|
|
41
|
+
// @implements A-SPEC-102.1, A-SPEC-734
|
|
42
42
|
const fs = __importStar(require("node:fs"));
|
|
43
43
|
const path = __importStar(require("node:path"));
|
|
44
|
+
const bounded_io_1 = require("../project/bounded-io");
|
|
44
45
|
/** Map per-test-file executed counts onto the A-SPECs those files @implement (pure). */
|
|
45
46
|
function computeExecutedByAspec(executedByFile, testAnchors) {
|
|
46
47
|
const out = {};
|
|
@@ -68,7 +69,7 @@ function writeTestEvidence(root, ev) {
|
|
|
68
69
|
}
|
|
69
70
|
function readTestEvidence(root) {
|
|
70
71
|
try {
|
|
71
|
-
const ev = JSON.parse(
|
|
72
|
+
const ev = JSON.parse((0, bounded_io_1.readRegularTextSync)(path.join(root, exports.EVIDENCE_FILE)));
|
|
72
73
|
return ev && typeof ev.head === 'string' && ev.executedByAspec && typeof ev.executedByAspec === 'object' ? ev : undefined;
|
|
73
74
|
}
|
|
74
75
|
catch {
|
|
@@ -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
|
/**
|