forgedock 1.67.0 → 1.68.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/bin/config-schema.mjs +1 -0
- package/bin/engine/outcome-codes.mjs +1 -0
- package/bin/engine-cli.mjs +99 -12
- package/bin/engine.mjs +10 -0
- package/bin/forgedock.mjs +17 -1
- package/bin/help-text.mjs +1 -0
- package/bin/lean/admission.mjs +21 -0
- package/bin/lean/admission.test.mjs +30 -0
- package/bin/lean/advisory.test.mjs +25 -10
- package/bin/lean/amendment-schema.mjs +3 -4
- package/bin/lean/attempts.mjs +34 -31
- package/bin/lean/attempts.test.mjs +33 -19
- package/bin/lean/basered.mjs +26 -0
- package/bin/lean/batch-health.mjs +17 -12
- package/bin/lean/batch-health.test.mjs +39 -11
- package/bin/lean/batch.test.mjs +51 -2
- package/bin/lean/ci-gate.mjs +2 -90
- package/bin/lean/ci-gate.test.mjs +1 -127
- package/bin/lean/ci-precheck.mjs +25 -8
- package/bin/lean/ci-precheck.test.mjs +24 -0
- package/bin/lean/clear-breaker.test.mjs +4 -3
- package/bin/lean/commentstate.mjs +10 -5
- package/bin/lean/commentstate.test.mjs +12 -1
- package/bin/lean/conformance.e2e.test.mjs +9 -6
- package/bin/lean/conformance.mjs +56 -196
- package/bin/lean/conformance.test.mjs +40 -376
- package/bin/lean/depcache.mjs +100 -10
- package/bin/lean/depcache.test.mjs +105 -0
- package/bin/lean/docsgate.mjs +0 -32
- package/bin/lean/docsgate.test.mjs +2 -23
- package/bin/lean/effects-cap.test.mjs +9 -1
- package/bin/lean/effects-killtree.test.mjs +35 -0
- package/bin/lean/effects.mjs +42 -24
- package/bin/lean/engine-readmit.test.mjs +35 -0
- package/bin/lean/envgap.mjs +93 -0
- package/bin/lean/envgap.test.mjs +53 -0
- package/bin/lean/execution.mjs +10 -4
- package/bin/lean/execution.test.mjs +12 -0
- package/bin/lean/failure-census.mjs +170 -0
- package/bin/lean/failure-census.test.mjs +59 -0
- package/bin/lean/guardgate.test.mjs +2 -3
- package/bin/lean/heavy.mjs +33 -4
- package/bin/lean/heavy.test.mjs +38 -6
- package/bin/lean/hotarea.mjs +0 -36
- package/bin/lean/hotarea.test.mjs +1 -22
- package/bin/lean/issuewatch-verify.mjs +19 -4
- package/bin/lean/issuewatch.mjs +21 -4
- package/bin/lean/issuewatch.test.mjs +48 -1
- package/bin/lean/lane-audit-gap.mjs +66 -0
- package/bin/lean/lane-audit-gap.test.mjs +59 -0
- package/bin/lean/lane-audit-llm.mjs +5 -0
- package/bin/lean/lane-audit-query.mjs +47 -0
- package/bin/lean/lane-audit-query.test.mjs +44 -0
- package/bin/lean/lane-audit-signatures.mjs +33 -0
- package/bin/lean/lane-audit.mjs +110 -0
- package/bin/lean/lane-audit.test.mjs +97 -0
- package/bin/lean/lane-recovery.test.mjs +33 -0
- package/bin/lean/lanecheck.mjs +5 -3
- package/bin/lean/lanecheck.test.mjs +6 -0
- package/bin/lean/lean.mjs +206 -148
- package/bin/lean/lean.test.mjs +406 -190
- package/bin/lean/limits.mjs +17 -0
- package/bin/lean/limits.test.mjs +15 -1
- package/bin/lean/live-execution.mjs +21 -2
- package/bin/lean/live-execution.test.mjs +39 -0
- package/bin/lean/orchestrate-attempts.test.mjs +17 -9
- package/bin/lean/orchestrate-envhold.test.mjs +47 -0
- package/bin/lean/orchestrate-heldroot.test.mjs +72 -0
- package/bin/lean/orchestrate-hostfallback.test.mjs +59 -1
- package/bin/lean/orchestrate-overload-recovery.test.mjs +37 -0
- package/bin/lean/orchestrate-pause.test.mjs +53 -1
- package/bin/lean/orchestrate-reconcile.test.mjs +17 -0
- package/bin/lean/orchestrate-relaunch-gates.test.mjs +57 -0
- package/bin/lean/orchestrate-stacking.test.mjs +10 -0
- package/bin/lean/orchestrate.mjs +188 -33
- package/bin/lean/postdeploy-check.test.mjs +1 -3
- package/bin/lean/precheck.mjs +20 -0
- package/bin/lean/preflight.mjs +100 -11
- package/bin/lean/preflight.test.mjs +44 -4
- package/bin/lean/prompts.mjs +10 -21
- package/bin/lean/recurrence.mjs +6 -148
- package/bin/lean/recurrence.test.mjs +11 -147
- package/bin/lean/release-flakes.mjs +14 -2
- package/bin/lean/release-flakes.test.mjs +17 -1
- package/bin/lean/release-ledger.mjs +19 -1
- package/bin/lean/release-ledger.test.mjs +23 -0
- package/bin/lean/release-preflight.mjs +28 -0
- package/bin/lean/release-preflight.test.mjs +42 -1
- package/bin/lean/release-review.mjs +40 -5
- package/bin/lean/release-review.test.mjs +43 -2
- package/bin/lean/release.mjs +43 -14
- package/bin/lean/release.test.mjs +32 -0
- package/bin/lean/retry.mjs +1 -1
- package/bin/lean/retry.test.mjs +6 -1
- package/bin/lean/rotator.mjs +9 -0
- package/bin/lean/rotator.test.mjs +11 -1
- package/bin/lean/sandbox-remote.mjs +16 -9
- package/bin/lean/schedd.mjs +11 -6
- package/bin/lean/schedd.test.mjs +65 -5
- package/bin/lean/selfreview.mjs +1 -1
- package/bin/lean/statuscomment.mjs +4 -1
- package/bin/lean/validate-catalog.mjs +108 -0
- package/bin/lean/validate-catalog.test.mjs +46 -1
- package/bin/lean/verify.mjs +1 -1
- package/bin/pool/affinity.test.mjs +91 -0
- package/bin/pool/agent.mjs +143 -9
- package/bin/pool/cache-sweep.mjs +31 -10
- package/bin/pool/ci-autoscale.mjs +160 -0
- package/bin/pool/cli.mjs +37 -8
- package/bin/pool/docker.mjs +3 -0
- package/bin/pool/engine-placement.test.mjs +94 -0
- package/bin/pool/lane-target.mjs +41 -0
- package/bin/pool/lane-tools.mjs +7 -2
- package/bin/pool/lane-tools.test.mjs +9 -0
- package/bin/pool/mirror-seed.mjs +15 -11
- package/bin/pool/router.mjs +88 -32
- package/bin/pool/version.mjs +29 -2
- package/bin/review-staging.mjs +11 -3
- package/bin/runner.mjs +59 -11
- package/bin/stats/release.mjs +7 -0
- package/bin/stats/release.test.mjs +20 -0
- package/bin/stats/scorecard.mjs +187 -0
- package/bin/stats/scorecard.test.mjs +89 -0
- package/docs/CONFIG.md +41 -0
- package/docs/OUTCOME-CODES.md +1 -0
- package/docs/STATS.md +17 -0
- package/package.json +1 -1
- package/pool/image/Dockerfile +14 -2
- package/pool/image/manifest.json +25 -0
- package/pool/image/mirror.sh +11 -2
- package/pool/install/install-agent.ps1 +11 -4
- package/scripts/ci-local/adapters/github-actions.mjs +8 -0
- package/scripts/ci-local/cli.mjs +1 -1
- package/scripts/ci-local/plan.mjs +3 -2
- package/scripts/ci-local.test.sh +11 -0
- package/scripts/failure-census.mjs +67 -0
- package/scripts/review-finalize.sh +5 -5
- package/scripts/review-finalize.test.sh +8 -1
- package/scripts/verify-phase-trail.sh +11 -0
- package/scripts/verify-phase-trail.test.sh +9 -0
|
@@ -4,7 +4,7 @@ import { readFileSync } from "node:fs";
|
|
|
4
4
|
import { describe, it } from "node:test";
|
|
5
5
|
import assert from "node:assert/strict";
|
|
6
6
|
import { toolMisses } from "./toolplace.mjs";
|
|
7
|
-
import { BINDING, GUIDANCE, guidanceStance, FORGEDOCK_CHECKS_VAR, FORGEDOCK_ENTRY_VAR, portableForgedockPaths, resolvingIo, testPlanProblems, proofEchoesDeliverable, outputTail, isEnvValidateFailure,
|
|
7
|
+
import { BINDING, GUIDANCE, guidanceStance, FORGEDOCK_CHECKS_VAR, FORGEDOCK_ENTRY_VAR, portableForgedockPaths, resolvingIo, testPlanProblems, proofEchoesDeliverable, outputTail, isEnvValidateFailure, removedPathsOf, shellSyntaxError, unrunnableValidate, describesUnrunnableCommand, vitestQuietFlag, normalizeRunnerCommand, cliUsageError, validateContract, applyAmendments, precheck, reproFailures, reproQualityFailures, isBugIssue, parseReview, checkCompleteness, decide, closePlan, isInvestigation, formatShadowSummary, followupItems, inIssue, snapQuote, snapQuotes, isTestPath, normalizeEvidencePath, mergeReviewRows, reviewSkeleton, missingIds, resolveEvidencePath, movingBaseDiff, scopeText, evidencePathLine, evidencePathOnly, reaskable, matchCriterion, criterionLines, fillEngineRows, explainFailures, resolveForgedockPaths, missingTool, repoTracks, tmpdirInputs, isScopeCheck, isPureScopeCheck, dropScopeValidates, tagOutOfBand, outOfBandRequirements, isOutOfBand, followupMap, renderPendingFollowups, VERIFY_MODES, OUT_OF_BAND_RE, FOLLOWUP_CLASSES, followupClass, inLaneDeferral, pendingTracking, BUCKETS, bucketKind, bucketProblems, bucketTally, isE2eCommand, e2eVerified, applyValidateRecipes, deferChecklessPostDeploy, reproEnvMiss, ORCHESTRATOR_BUCKET, ownerRoute, weakenedE2eDecisions, guessedUvEnv, envProvisioningCommand, assertionFailure, projectDirPathMiss, rewriteProjectDirCommand, convertDelivered, mockedDeliverable, proofEchoDetail, contractRuleCounts, onlyTestPlanProblems } from "./conformance.mjs";
|
|
8
8
|
|
|
9
9
|
const ISSUE = "## Requirements\n1. The scrape route must release the spend reservation on 429.\n2. The search route must release the spend reservation on 429.\n\n- [ ] Billing pricing is unchanged.";
|
|
10
10
|
const Q1 = "The scrape route must release the spend reservation on 429.";
|
|
@@ -79,11 +79,6 @@ describe("amendment kind aliases (#4856)", () => {
|
|
|
79
79
|
assert.deepEqual(a.toTrack.map((r) => r.id), ["R1"], kind);
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
it("unlisted kinds stay unknown and list the valid kinds (scope-note is informational since #5036)", () => {
|
|
83
|
-
for (const kind of ["scope-creep", "Scope_Creep", "flaky-note"]) {
|
|
84
|
-
assert.match(applyAmendments(C, [{ kind, requirement: "R1", why: "w" }]).problems[0], new RegExp(`unknown kind '${kind}'; valid kinds are add-deliverable`));
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
82
|
});
|
|
88
83
|
|
|
89
84
|
describe("#4655 multi-requirement amendment references", () => {
|
|
@@ -95,40 +90,12 @@ describe("#4655 multi-requirement amendment references", () => {
|
|
|
95
90
|
assert.deepEqual(a.applied.map((x) => x.target), ["R1", "R2"], requirement);
|
|
96
91
|
}
|
|
97
92
|
});
|
|
98
|
-
it("an unknown id inside a list is still a problem; an unknown kind with a requirement is still unknown", () => {
|
|
99
|
-
assert.match(applyAmendments(C, [{ kind: "defer", requirement: "R1/R9", why: "w" }]).problems[0], /unknown requirement R9/);
|
|
100
|
-
assert.match(applyAmendments(C, [{ kind: "scope-creep", requirement: "R1", why: "w" }]).problems[0], /unknown kind 'scope-creep'; valid kinds are/);
|
|
101
|
-
});
|
|
102
|
-
it("an unrelated-ci-failure amendment (kind or type) is an informational no-op; other unknown kinds still fail", () => {
|
|
103
|
-
for (const a of [{ kind: "unrelated-ci-failure", target: "core rate-limit test", why: "diff touches no core file" }, { type: "unrelated-ci-failure", target: "t", why: "w" }]) {
|
|
104
|
-
const r = applyAmendments(C, [a]);
|
|
105
|
-
assert.deepEqual(r.problems, []);
|
|
106
|
-
assert.deepEqual(r.contract, C);
|
|
107
|
-
assert.equal(r.applied[0].kind, "unrelated-ci-failure");
|
|
108
|
-
}
|
|
109
|
-
assert.match(applyAmendments(C, [{ kind: "flaky-note", why: "w" }]).problems[0], /unknown kind 'flaky-note'; valid kinds are/);
|
|
110
|
-
});
|
|
111
93
|
it("supersede-guard guards[] expands to per-guard supersedes", () => {
|
|
112
94
|
const a = applyAmendments(C, [{ kind: "supersede-guard", guards: ["#4879", "#4838"], why: "x" }]);
|
|
113
95
|
assert.deepEqual(a.problems, []);
|
|
114
96
|
assert.deepEqual(a.contract.supersedes, [{ guard: "#4879", why: "x" }, { guard: "#4838", why: "x" }]);
|
|
115
97
|
assert.equal(a.applied.length, 2);
|
|
116
98
|
});
|
|
117
|
-
it("synonym kinds and a supersedes amendment with guards[] expand alike; an invalid guard id is reported", () => {
|
|
118
|
-
for (const kind of ["supersede", "supersedes-guard", "supersedes"]) {
|
|
119
|
-
const a = applyAmendments(C, [{ kind, guards: ["4879", "#4838"], why: "x" }]);
|
|
120
|
-
assert.deepEqual(a.problems, [], kind);
|
|
121
|
-
assert.deepEqual(a.contract.supersedes.map((s) => s.guard), ["#4879", "#4838"], kind);
|
|
122
|
-
}
|
|
123
|
-
const bad = applyAmendments(C, [{ kind: "supersedes", guards: ["#4879", "abc"], why: "x" }]);
|
|
124
|
-
assert.equal(bad.problems.length, 1);
|
|
125
|
-
assert.match(bad.problems[0], /needs guard/);
|
|
126
|
-
assert.deepEqual(bad.contract.supersedes.map((s) => s.guard), ["#4879"]);
|
|
127
|
-
assert.match(applyAmendments(C, [{ kind: "supersede-guard", guards: [], why: "x" }]).problems[0], /needs guard/);
|
|
128
|
-
});
|
|
129
|
-
it("an unrelated unknown kind is still rejected with the valid-kinds message", () => {
|
|
130
|
-
assert.match(applyAmendments(C, [{ kind: "supersede-everything", guards: ["#1"], why: "w" }]).problems[0], /unknown kind 'supersede-everything'; valid kinds are/);
|
|
131
|
-
});
|
|
132
99
|
});
|
|
133
100
|
|
|
134
101
|
describe("#4574 amendment slips", () => {
|
|
@@ -138,28 +105,10 @@ describe("#4574 amendment slips", () => {
|
|
|
138
105
|
assert.deepEqual(a.toTrack.map((r) => r.id).sort(), ["R1", "R2"]);
|
|
139
106
|
assert.ok(a.contract.requirements.every((r) => r.disposition === "defer"));
|
|
140
107
|
});
|
|
141
|
-
it("an unknown kind names the valid kinds and shows the full amendment", () => {
|
|
142
|
-
const why = "x".repeat(300);
|
|
143
|
-
const a = applyAmendments(C, [{ kind: "rewrite", why }]);
|
|
144
|
-
assert.match(a.problems[0], /unknown kind 'rewrite'; valid kinds are add-deliverable, add-requirement, defer, post-deploy/);
|
|
145
|
-
assert.ok(a.problems[0].includes(why));
|
|
146
|
-
});
|
|
147
|
-
it("an Object.prototype key as kind is an unknown kind, not a slip", () => {
|
|
148
|
-
assert.match(applyAmendments(C, [{ kind: "constructor", why: "w" }]).problems[0], /unknown kind 'constructor'; valid kinds are add-deliverable/);
|
|
149
|
-
});
|
|
150
|
-
it("an incomplete known kind names the missing field", () => {
|
|
151
|
-
assert.match(applyAmendments(C, [{ kind: "defer", why: "w" }]).problems[0], /'defer' needs requirement/);
|
|
152
|
-
});
|
|
153
108
|
});
|
|
154
109
|
|
|
155
110
|
describe("precheck (deterministic, no reviewer)", () => {
|
|
156
111
|
const res = { requirements: [{ id: "R1", status: "implemented" }, { id: "R2", status: "implemented" }], validation: [{ id: "V1", exit: 0 }] };
|
|
157
|
-
it("#5760 ciBudgetFailures surface as precheck failures", () => {
|
|
158
|
-
const f = { code: "conformance.unimplemented", kind: "ci_budget_unannotated", detail: "x" };
|
|
159
|
-
const r = precheck({ contract: C, result: res, changedFiles: files, ciBudgetFailures: [f] });
|
|
160
|
-
assert.equal(r.ok, false);
|
|
161
|
-
assert.deepEqual(r.failures, [f]);
|
|
162
|
-
});
|
|
163
112
|
it("passes a complete, validated, in-scope change", () => assert.deepEqual(precheck({ contract: C, result: res, changedFiles: files }), { ok: true, failures: [], superseded: [], ciCovered: [], equivalent: [] }));
|
|
164
113
|
it("unauthorized file -> scope_creep; tests and ignored paths are always allowed", () => {
|
|
165
114
|
assert.deepEqual(codes(precheck({ contract: C, result: res, changedFiles: [...files, "src/billing.js", ".forge-lean/x", "tests/test_x.py", "pkg/foo_test.go"], ignore: [".forge-lean/"] })), ["conformance.scope_creep"]);
|
|
@@ -177,45 +126,6 @@ describe("precheck (deterministic, no reviewer)", () => {
|
|
|
177
126
|
assert.equal(shellSyntaxError("echo ok && true"), null);
|
|
178
127
|
assert.ok(shellSyntaxError("echo (oops"));
|
|
179
128
|
});
|
|
180
|
-
it("#4857 a command that died before any test ran is contract.invalid_command; substitute-validate swaps a runnable one", () => {
|
|
181
|
-
assert.ok(unrunnableValidate({ rc: 5, output: "collected 0 items / 1 deselected\nno tests ran" }));
|
|
182
|
-
assert.ok(unrunnableValidate({ rc: 1, output: "Poetry could not find a pyproject.toml file in /repo" }));
|
|
183
|
-
assert.ok(!unrunnableValidate({ rc: 1, output: "AssertionError: 1 !== 2" }));
|
|
184
|
-
assert.ok(!unrunnableValidate({ rc: 0, output: "no tests ran" }));
|
|
185
|
-
const r = applyAmendments({ requirements: [], validate: [{ id: "V2", command: "poetry run pytest -k 404_probe" }] }, [{ kind: "substitute-validate", validate: "V2", command: "poetry -C services/worker run pytest tests/test_probe.py", why: "no pyproject at root" }]);
|
|
186
|
-
assert.deepEqual(r.problems, []);
|
|
187
|
-
assert.equal(r.contract.validate[0].command, "poetry -C services/worker run pytest tests/test_probe.py");
|
|
188
|
-
assert.equal(r.contract.validate[0].substituted.from, "poetry run pytest -k 404_probe");
|
|
189
|
-
const bad = applyAmendments({ requirements: [], validate: [{ id: "V2", command: "x" }] }, [{ kind: "substitute-validate", validate: "V2", command: "echo (oops", why: "w" }]);
|
|
190
|
-
assert.ok(bad.problems.some((p) => /not valid shell/.test(p)));
|
|
191
|
-
assert.ok(applyAmendments({ requirements: [], validate: [] }, [{ kind: "substitute-validate", validate: "V9", command: "true", why: "w" }]).problems.length);
|
|
192
|
-
});
|
|
193
|
-
it("#4995 noopCommand bare keywords and constant-false guards", () => {
|
|
194
|
-
for (const cmd of ["if true\nthen\n :\nfi", "while true\ndo\n :\ndone", "if false; then pytest; fi", "if [ 0 = 1 ]; then pytest; fi", "if test -n \"\"; then node --test a.test.mjs; fi", "while false; do pytest; done", "if false\nthen\n pytest\nfi"]) assert.ok(noopCommand(cmd), JSON.stringify(cmd));
|
|
195
|
-
for (const cmd of ["if [ -f x ]; then pytest; fi", "for f in a b; do node --test $f; done", "if false; then :; else pytest; fi", "if true\nthen\n pytest\nfi", "if false; then :; elif [ -f x ]; then pytest; fi"]) assert.ok(!noopCommand(cmd), JSON.stringify(cmd));
|
|
196
|
-
});
|
|
197
|
-
it("#4979 SPEC-2 a substitute that runs no check is rejected at amendment time", () => {
|
|
198
|
-
for (const cmd of ["true", ":", "exit 0", "echo ok", "true && echo done", "printf x | true"]) {
|
|
199
|
-
assert.ok(noopCommand(cmd), cmd);
|
|
200
|
-
const r = applyAmendments({ requirements: [], validate: [{ id: "V2", command: "poetry run pytest -k probe" }] }, [{ kind: "substitute-validate", validate: "V2", command: cmd, why: "w" }]);
|
|
201
|
-
assert.ok(r.problems.some((p) => /runs no check/.test(p)), cmd);
|
|
202
|
-
}
|
|
203
|
-
for (const cmd of ["node --test a.test.mjs", "echo start && pytest tests/x.py", "test -f out.json", "[ -f a ] && npm test", "bash scripts/check.sh", "if [ -f x ]; then pytest; fi", "if true; then node --test a.test.mjs; fi", "for f in a b; do node --test $f; done"]) assert.ok(!noopCommand(cmd), cmd); // SEC-22: keywords around a real check
|
|
204
|
-
for (const cmd of ["test 1", "[ 1 ]", "sleep 0", "node -e 0", "true\ntrue", "if true; then :; fi", "python -c pass", "exit 1"]) assert.ok(noopCommand(cmd), JSON.stringify(cmd)); // SEC-12
|
|
205
|
-
});
|
|
206
|
-
it("#5653 a substitute running the same passing test ids is satisfied and recorded; a failing check never is", () => {
|
|
207
|
-
const sub = applyAmendments({ ...C, validate: [{ id: "V1", command: "poetry run pytest -k leak" }] }, [{ kind: "substitute-validate", validate: "V1", command: "uv run pytest -k leak", why: "no poetry" }]).contract;
|
|
208
|
-
const res = { requirements: [{ id: "R1", status: "implemented" }, { id: "R2", status: "implemented" }], validation: [{ id: "V1", exit: 0 }] };
|
|
209
|
-
const pass = "t.py::a PASSED\nt.py::b PASSED\n";
|
|
210
|
-
const run = (frozen, s) => precheck({ contract: sub, result: res, changedFiles: files, substitutedRuns: { V1: { ...frozen, sub: s } } });
|
|
211
|
-
const ok = run({ rc: 1, output: pass }, { rc: 0, output: pass }); // frozen exited non-zero from the runner (coverage plugin), every test passed
|
|
212
|
-
assert.deepEqual(ok.failures, []);
|
|
213
|
-
assert.deepEqual(ok.equivalent.map((e) => e.id), ["V1"]);
|
|
214
|
-
const failing = "t.py::a PASSED\nt.py::b FAILED\n";
|
|
215
|
-
for (const [f, s] of [[{ rc: 1, output: failing }, { rc: 1, output: failing }], [{ rc: 1, output: failing }, { rc: 0, output: pass }], [{ rc: 1, output: pass }, { rc: 1, output: pass }], [{ rc: 1, output: pass }, { rc: 0, output: "t.py::a PASSED\n" }], [{ rc: 1, output: "boom" }, { rc: 0, output: "boom" }]]) {
|
|
216
|
-
assert.deepEqual(run(f, s).failures.map((x) => x.kind), ["validate_failed"], "both failing, a failing test, a failing substitute, other ids or no ids still fails");
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
129
|
it("#5653 a validate failing on a stale generated artifact is a base-sync recovery, not unimplemented work", () => {
|
|
220
130
|
const res = { requirements: [{ id: "R1", status: "implemented" }, { id: "R2", status: "implemented" }], validation: [{ id: "V1", exit: 1 }] };
|
|
221
131
|
const c = { ...C, validate: [{ id: "V1", command: "node scripts/check-gen.mjs" }] };
|
|
@@ -231,62 +141,6 @@ describe("precheck (deterministic, no reviewer)", () => {
|
|
|
231
141
|
assert.equal(mk({ verify: "out_of_band", evidence: "nightly job" }).length, 0);
|
|
232
142
|
assert.equal(mk({ disposition: "defer", why: "w", bucket: "date:2026-12-01" }).length, 0);
|
|
233
143
|
});
|
|
234
|
-
it("#4979 SPEC-2 a substitute stands only when the frozen command cannot run", () => {
|
|
235
|
-
const sub = applyAmendments({ ...C, validate: [{ id: "V1", command: "poetry run pytest -k leak" }] }, [{ kind: "substitute-validate", validate: "V1", command: "node --test test/leak.test.js", why: "no pyproject at root" }]).contract;
|
|
236
|
-
const res = { requirements: [{ id: "R1", status: "implemented" }, { id: "R2", status: "implemented" }], validation: [{ id: "V1", exit: 0 }] };
|
|
237
|
-
const run = (substitutedRuns) => precheck({ contract: sub, result: res, changedFiles: files, substitutedRuns });
|
|
238
|
-
assert.deepEqual(run({ V1: { rc: 1, output: "Poetry could not find a pyproject.toml file in /repo" } }).failures, [], "unrunnable original: substitute stands");
|
|
239
|
-
assert.deepEqual(run({ V1: { rc: 127, output: "poetry: command not found" } }).failures, [], "missing runner");
|
|
240
|
-
assert.deepEqual(run({ V1: { rc: 0, output: "1 passed" } }).failures, [], "original passes anyway");
|
|
241
|
-
const runs = run({ V1: { rc: 1, output: "FAILED tests/test_leak.py::test_release - AssertionError" } });
|
|
242
|
-
assert.deepEqual(runs.failures.map((f) => f.kind), ["validate_failed"], "a failing original may not be hidden");
|
|
243
|
-
assert.match(runs.failures[0].detail, /frozen command runs and fails \(exit 1\)/);
|
|
244
|
-
assert.deepEqual(run(null).failures.map((f) => f.kind), ["substitute_unverified"], "no rerun: fail closed");
|
|
245
|
-
assert.deepEqual(run({ V1: { rc: 124, output: "" } }).failures.map((f) => f.kind), ["validate_timeout"]);
|
|
246
|
-
assert.deepEqual(precheck({ contract: sub, result: res, changedFiles: files, ciVerified: true, substitutedRuns: { V1: { rc: 1, output: "AssertionError" } } }).failures.map((f) => f.kind), ["validate_failed"], "CI never covers a hidden failure");
|
|
247
|
-
assert.equal(substituteVerdict(undefined), "unverified");
|
|
248
|
-
// SEC-11: a second substitute of the same id never replaces the frozen command the engine reruns
|
|
249
|
-
const twice = applyAmendments({ ...C, validate: [{ id: "V1", command: "poetry run pytest -k leak" }] }, [
|
|
250
|
-
{ kind: "substitute-validate", validate: "V1", command: "nonexistent-xyz", why: "a" },
|
|
251
|
-
{ kind: "substitute-validate", validate: "V1", command: "node --test test/leak.test.js", why: "b" },
|
|
252
|
-
]).contract;
|
|
253
|
-
assert.equal(twice.validate[0].substituted.from, "poetry run pytest -k leak");
|
|
254
|
-
assert.equal(twice.validate[0].command, "node --test test/leak.test.js");
|
|
255
|
-
// SEC-21: a planner-set substituted field on the frozen contract is dropped; only an amendment sets it
|
|
256
|
-
const planted = applyAmendments({ ...C, validate: [{ id: "V1", command: "poetry run pytest -k leak", substituted: { from: "true", why: "x" } }] }, []).contract;
|
|
257
|
-
assert.equal(planted.validate[0].substituted, undefined);
|
|
258
|
-
const plantedSub = applyAmendments({ ...C, validate: [{ id: "V1", command: "poetry run pytest -k leak", substituted: { from: "true", why: "x" } }] }, [{ kind: "substitute-validate", validate: "V1", command: "node --test test/leak.test.js", why: "b" }]).contract;
|
|
259
|
-
assert.equal(plantedSub.validate[0].substituted.from, "poetry run pytest -k leak");
|
|
260
|
-
});
|
|
261
|
-
it("#4990 a substitute whose frozen command names a removed path is rejected", async () => {
|
|
262
|
-
const sub = applyAmendments({ ...C, validate: [{ id: "V1", command: "node --test test/leak.test.js" }] }, [{ kind: "substitute-validate", validate: "V1", command: "node --test test/weak.test.js", why: "w" }]).contract;
|
|
263
|
-
const res = { requirements: [{ id: "R1", status: "implemented" }, { id: "R2", status: "implemented" }], validation: [{ id: "V1", exit: 0 }] };
|
|
264
|
-
const gone = precheck({ contract: sub, result: res, changedFiles: files, substitutedRuns: { V1: { rc: 1, output: "no tests found" } }, removedPaths: ["test/leak.test.js"] });
|
|
265
|
-
assert.deepEqual(gone.failures.map((f) => f.kind), ["substitute_removed_path"]);
|
|
266
|
-
assert.equal(gone.failures[0].code, "conformance.unimplemented");
|
|
267
|
-
assert.match(gone.failures[0].detail, /test\/leak\.test\.js/);
|
|
268
|
-
const env = precheck({ contract: sub, result: res, changedFiles: files, substitutedRuns: { V1: { rc: 1, output: "Unknown option `-q`" } }, removedPaths: ["docs/other.md"] });
|
|
269
|
-
assert.deepEqual(env.failures, [], "intact named files: env-unrunnable substitute stands");
|
|
270
|
-
assert.deepEqual(removedNamedPaths("node --test ./test/a.js 'b/c.js' z.js", ["test/a.js", "b/c.js", "tests/x.js", "z.js"]), ["test/a.js", "b/c.js", "z.js"]);
|
|
271
|
-
assert.deepEqual(removedNamedPaths("pytest -k leak", ["leak.py"]), []);
|
|
272
|
-
assert.deepEqual(await removedPathsOf(async () => "D\0a.js\0R100\0old.js\0new.js\0M\0m.js\0A\0n.js\0", "b"), ["a.js", "old.js"]);
|
|
273
|
-
});
|
|
274
|
-
it("#5003 removed-path matching: node ids, globs, flag paths, directory tokens, -z, fail closed", async () => {
|
|
275
|
-
assert.deepEqual(removedNamedPaths("pytest tests/a.py::test_x", ["tests/a.py"]), ["tests/a.py"]);
|
|
276
|
-
assert.deepEqual(removedNamedPaths("pytest --junit=tests/a.py", ["tests/a.py"]), ["tests/a.py"]);
|
|
277
|
-
assert.deepEqual(removedNamedPaths('pytest "tests/a.py::T::t"', ["tests/a.py"]), ["tests/a.py"]);
|
|
278
|
-
const base = ["tests/test_a.py", "tests/test_b.py", "tests/fixtures/d.json", "src/x.py"];
|
|
279
|
-
assert.deepEqual(removedNamedPaths("pytest tests/test_*.py", ["tests/test_a.py", "tests/fixtures/d.json", "src/x.py"], base), ["tests/test_a.py"]);
|
|
280
|
-
assert.deepEqual(removedNamedPaths("pytest tests/", ["tests/fixtures/d.json"]), []);
|
|
281
|
-
assert.deepEqual(removedNamedPaths("pytest tests/", ["tests/test_a.py"]), ["tests/test_a.py"]);
|
|
282
|
-
assert.deepEqual(removedNamedPaths("npm test", ["test/fixtures/d.json"]), []);
|
|
283
|
-
assert.deepEqual(removedNamedPaths("npm test", ["test/a.test.js"]), ["test/a.test.js"]);
|
|
284
|
-
assert.deepEqual(await removedPathsOf(async (a) => (a.includes("-z") ? "D\0tests/é.py\0" : '"tests/\\303\\251.py"'), "b"), ["tests/é.py"]);
|
|
285
|
-
assert.equal(await removedPathsOf(async () => { throw new Error("git"); }, "b"), null);
|
|
286
|
-
const sub = applyAmendments({ ...C, validate: [{ id: "V1", command: "node --test test/leak.test.js" }] }, [{ kind: "substitute-validate", validate: "V1", command: "node --test test/weak.test.js", why: "w" }]).contract;
|
|
287
|
-
const res = { requirements: [{ id: "R1", status: "implemented" }, { id: "R2", status: "implemented" }], validation: [{ id: "V1", exit: 0 }] };
|
|
288
|
-
assert.deepEqual(precheck({ contract: sub, result: res, changedFiles: files, substitutedRuns: { V1: { rc: 1, output: "no tests found" } }, removedPaths: null }).failures.map((f) => f.kind), ["substitute_unverified"]);
|
|
289
|
-
});
|
|
290
144
|
it("#4857 describesUnrunnableCommand reads a blocked summary", () => {
|
|
291
145
|
assert.ok(describesUnrunnableCommand("V2 is unrunnable: poetry found no pyproject at the repo root"));
|
|
292
146
|
assert.ok(!describesUnrunnableCommand("needs a pricing decision from the product owner"));
|
|
@@ -381,20 +235,6 @@ describe("precheck (deterministic, no reviewer)", () => {
|
|
|
381
235
|
assert.equal(missingTool({ rc: 1, output: "ModuleNotFoundError: No module named 'app'" }, { repoHas: repoTracks(["app.py"]) }), null);
|
|
382
236
|
assert.equal(missingTool({ rc: 1, output: "1 test failed: expected not found" }), null, "rc != 127 needs command not found");
|
|
383
237
|
});
|
|
384
|
-
it("#5371 substituteVerdict treats docker daemon, playwright browser and npm network failures as not runs", () => {
|
|
385
|
-
const sigs = [
|
|
386
|
-
"docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?",
|
|
387
|
-
"docker: Error response from daemon: invalid mount config for type \"bind\": bind source path does not exist: /x/infra",
|
|
388
|
-
"browserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium-1/chrome\nRun npx playwright install",
|
|
389
|
-
"npm ERR! code EAI_AGAIN\nnpm ERR! network request to https://registry.npmjs.org/x failed",
|
|
390
|
-
"npm error code ENOTFOUND",
|
|
391
|
-
];
|
|
392
|
-
for (const output of sigs) {
|
|
393
|
-
assert.equal(substituteVerdict({ rc: 1, output }, { command: "x" }), "ok", output);
|
|
394
|
-
assert.equal(missingTool({ rc: 1, output })?.kind, "environment", output);
|
|
395
|
-
}
|
|
396
|
-
assert.equal(substituteVerdict({ rc: 1, output: "AssertionError: expected 1 to equal 2" }, { command: "x" }), "runs");
|
|
397
|
-
});
|
|
398
238
|
it("#5371 a failed validate detail carries a redacted last-40-line output tail; an env signature is env.tool_missing", () => {
|
|
399
239
|
const C = { requirements: [], validate: [{ id: "V1", command: "bash t.sh" }], deliverables: [{ id: "D1", path: "a.mjs", change: "x" }] };
|
|
400
240
|
const failed = { validation: [{ id: "V1", exit: 1 }], requirements: [] };
|
|
@@ -593,43 +433,6 @@ describe("conformance review: the engine computes the verdict from complete rows
|
|
|
593
433
|
assert.equal(validateContract({ ...C, validate: [{ id: "V4", command: ok }] }, ISSUE).ok, true, ok);
|
|
594
434
|
}
|
|
595
435
|
});
|
|
596
|
-
it("#5234 project-dir paths and pytest exit 4", () => {
|
|
597
|
-
const poetry = "poetry -C services/api run pytest -q services/api/tests/test_x.py services/api/tests/test_y.py";
|
|
598
|
-
assert.deepEqual(projectDirPathMiss(poetry), { dir: "services/api", paths: ["services/api/tests/test_x.py", "services/api/tests/test_y.py"] });
|
|
599
|
-
assert.equal(rewriteProjectDirCommand(poetry), "cd services/api && poetry run pytest -q tests/test_x.py tests/test_y.py");
|
|
600
|
-
const uv = "uv run --project services/api pytest services/api/tests/x.py -k foo";
|
|
601
|
-
assert.equal(rewriteProjectDirCommand(uv), "cd services/api && uv run pytest tests/x.py -k foo");
|
|
602
|
-
assert.equal(rewriteProjectDirCommand("poetry --directory=./services/api run pytest services/api/tests/x.py"), "cd services/api && poetry run pytest tests/x.py");
|
|
603
|
-
const mixed = "poetry -C services/api run pytest services/api/tests/x.py tests/hands_conformance";
|
|
604
|
-
assert.equal(rewriteProjectDirCommand(mixed), mixed);
|
|
605
|
-
const chained = "poetry -C services/api run pytest services/api/tests/x.py && echo ok";
|
|
606
|
-
assert.equal(rewriteProjectDirCommand(chained), chained);
|
|
607
|
-
for (const fine of ["cd services/api && poetry run pytest ../../services/api/tests/x.py", "poetry -C services/api run pytest tests/x.py", "poetry run pytest services/api/tests/x.py"]) {
|
|
608
|
-
assert.equal(projectDirPathMiss(fine), null, fine);
|
|
609
|
-
assert.equal(rewriteProjectDirCommand(fine), fine);
|
|
610
|
-
}
|
|
611
|
-
for (const cmd of [poetry, uv, mixed]) {
|
|
612
|
-
const v = validateContract({ ...C, validate: [{ id: "V1", command: cmd }] }, ISSUE);
|
|
613
|
-
assert.ok(v.problems.some((x) => x.startsWith("V1: the command moves its cwd to `services/api`")), v.problems.join("; "));
|
|
614
|
-
}
|
|
615
|
-
const rt = validateContract({ ...C, repro_test: { path: "t/x.py", command: uv } }, ISSUE, { repro: true });
|
|
616
|
-
assert.ok(rt.problems.some((x) => x.startsWith("repro_test: the command moves its cwd")), rt.problems.join("; "));
|
|
617
|
-
// pytest exit 4 is a defect of the frozen command: contract.invalid_command, and a substitute is judged ok
|
|
618
|
-
const exit4 = { rc: 4, output: "ERROR: file or directory not found: services/api/tests/x.py\n\nno tests ran in 0.01s" };
|
|
619
|
-
assert.ok(unrunnableValidate({ rc: 4, output: "ERROR: file or directory not found: services/api/tests/x.py" }));
|
|
620
|
-
assert.ok(unrunnableValidate({ rc: 4, output: "ERROR: not found: /repo/tests/x.py::t" }));
|
|
621
|
-
assert.ok(!unrunnableValidate({ rc: 1, output: "1 failed, 2 passed" }));
|
|
622
|
-
// exit 4 or 5 of a pytest command is unrunnable whatever the output says; other runners and test failures are not
|
|
623
|
-
for (const rc of [4, 5]) assert.ok(unrunnableValidate({ rc, output: "" }, "poetry run pytest -q tests/x.py"), `rc ${rc}`);
|
|
624
|
-
assert.ok(!unrunnableValidate({ rc: 4, output: "" }, "node --test x.mjs"));
|
|
625
|
-
assert.ok(!unrunnableValidate({ rc: 1, output: "1 failed" }, "pytest tests/x.py"));
|
|
626
|
-
assert.equal(substituteVerdict({ rc: 4, output: "" }, { command: poetry }), "ok");
|
|
627
|
-
assert.equal(substituteVerdict({ rc: 1, output: "1 failed" }, { command: poetry }), "runs");
|
|
628
|
-
assert.equal(substituteVerdict(exit4), "ok");
|
|
629
|
-
const contract = { requirements: [], deliverables: [], validate: [{ id: "V1", command: poetry }] };
|
|
630
|
-
const p = precheck({ contract, result: { validation: [{ id: "V1", exit: 4 }] }, changedFiles: [], validateRuns: { V1: exit4 } });
|
|
631
|
-
assert.deepEqual(p.failures.map((f) => [f.code, f.kind]), [["contract.invalid_command", "validate_command_invalid"]]);
|
|
632
|
-
});
|
|
633
436
|
it("#5232 a guessed offline uv --with environment is rejected for repro_test and validate; a requirements export passes", () => {
|
|
634
437
|
const bad = "cd w && uv run --offline --no-project --with pytest --with structlog python -m pytest -q t.py";
|
|
635
438
|
assert.equal(guessedUvEnv(bad), true);
|
|
@@ -862,51 +665,12 @@ describe("hotspot growth precheck (forge#4195)", () => {
|
|
|
862
665
|
const result = { validation: [{ id: "V1", exit: 0 }], requirements: [{ id: "R1", status: "implemented" }, { id: "R2", status: "implemented" }] };
|
|
863
666
|
const run = (hotspots, contract = C, r = result) => precheck({ contract, result: r, changedFiles: files, hotspots });
|
|
864
667
|
|
|
865
|
-
it("an over-threshold file grown past growth_lines fails with maintenance.hotspot_growth", () => {
|
|
866
|
-
const pc = run(hs([H()]));
|
|
867
|
-
assert.equal(pc.ok, false);
|
|
868
|
-
assert.deepEqual(pc.failures.map((f) => [f.code, f.kind]), [["maintenance.hotspot_growth", "hotspot_growth"]]);
|
|
869
|
-
assert.match(pc.failures[0].detail, /^src\/scrape\.js grew by 200 lines \(now 2600, limit \+150 over 2000\) without hotspot-exempt$/);
|
|
870
|
-
});
|
|
871
|
-
|
|
872
|
-
it("#4519 generated paths: applyAmendments refuses add-deliverable on maintenance.generated_paths, hotspotGrowth skips generated rows", () => {
|
|
873
|
-
const gen = ["web/public/openapi*.json", "web/public/openapi-versions/*"];
|
|
874
|
-
const amends = [{ kind: "add-deliverable", path: "web/public/openapi-versions/3.29.2.json", why: "sync the spec archive" },
|
|
875
|
-
{ kind: "add-deliverable", path: "./web/public/openapi.json", why: "sync the spec" }, { kind: "add-deliverable", path: "src/shared.js", why: "helper" }];
|
|
876
|
-
const a = applyAmendments(C, amends, null, { generatedPaths: gen });
|
|
877
|
-
assert.deepEqual(a.applied.map((x) => x.target), ["src/shared.js"]);
|
|
878
|
-
assert.equal(a.problems.length, 2);
|
|
879
|
-
assert.match(a.problems[0], /^add-deliverable web\/public\/openapi-versions\/3\.29\.2\.json: generated path \(forge\.yaml maintenance\.generated_paths\)/);
|
|
880
|
-
assert.ok(!a.contract.deliverables.some((d) => d.path.includes("openapi")), "a refused path never becomes a deliverable");
|
|
881
|
-
assert.equal(applyAmendments(C, amends).applied.length, 3, "without generatedPaths every add-deliverable applies as before");
|
|
882
|
-
assert.equal(applyAmendments(C, amends, null, { generatedPaths: ["web/public/openapi.json"] }).applied.length, 2, "a literal glob matches only that path");
|
|
883
|
-
// linguist-generated / generated_paths / header rows (hotspots.sh `generated`) never trigger hotspot_growth
|
|
884
|
-
const big = H({ path: "src/scrape.js", lines: 83974, growth: 83974 });
|
|
885
|
-
assert.equal(run(hs([big])).ok, false);
|
|
886
|
-
assert.equal(run(hs([{ ...big, generated: true }])).ok, true);
|
|
887
|
-
assert.equal(run(hs([{ ...big, generated: true, excluded: true }])).ok, true);
|
|
888
|
-
// #5470: a generated/ segment row (generated:true from hotspots.sh) grown by 6k lines passes; hand-written still flags
|
|
889
|
-
const seg = H({ path: "src/scrape.js", lines: 6607, base_lines: 0, growth: 6607 });
|
|
890
|
-
assert.equal(run(hs([{ ...seg, generated: true, excluded: true }])).ok, true);
|
|
891
|
-
assert.equal(run(hs([{ ...seg, generated: false }])).ok, false);
|
|
892
|
-
});
|
|
893
|
-
|
|
894
668
|
it("within the limit, under the threshold, excluded, unchanged, disabled or no facts: no failure", () => {
|
|
895
669
|
for (const h of [hs([H({ growth: 150 })]), hs([H({ over: false, lines: 1900 })]), hs([H({ excluded: true })]), hs([H({ path: "src/other.js" })]),
|
|
896
670
|
hs([H()], { enabled: false }), hs([H({ growth: null })]), null, undefined, {}]) assert.equal(run(h).ok, true, JSON.stringify(h));
|
|
897
671
|
assert.deepEqual(precheck({ contract: C, result, changedFiles: files }), run(null), "callers without hotspots are unchanged");
|
|
898
672
|
});
|
|
899
673
|
|
|
900
|
-
it("hotspot-exempt: <reason> in a covering deliverable's change or an add-deliverable amendment's why exempts the file", () => {
|
|
901
|
-
const withChange = (change) => ({ ...C, deliverables: [{ id: "D1", path: "src/scrape.js", change }, C.deliverables[1]] });
|
|
902
|
-
assert.equal(run(hs([H()]), withChange("route fix; Hotspot-Exempt: the handler table must stay in one file")).ok, true);
|
|
903
|
-
assert.equal(run(hs([H()]), withChange("hotspot-exempt: ")).ok, false, "an empty reason does not exempt");
|
|
904
|
-
assert.equal(run(hs([H()]), { ...C, deliverables: [{ id: "D1", path: "src/", change: "hotspot-exempt: generated routes" }, C.deliverables[1]] }).ok, true, "a covering directory deliverable");
|
|
905
|
-
const amended = { ...result, amendments: [{ kind: "add-deliverable", path: "src/scrape.js", why: "hotspot-exempt: one-off migration table" }] };
|
|
906
|
-
assert.equal(run(hs([H()]), C, amended).ok, true);
|
|
907
|
-
assert.equal(run(hs([H(), H({ path: "src/search.js" })]), withChange("hotspot-exempt: ok")).failures.length, 1, "the exemption covers only its own file");
|
|
908
|
-
assert.equal(hotspotGrowth({ contract: C, hotspots: hs([H()]), changedFiles: ["./src/scrape.js"] }).length, 1);
|
|
909
|
-
});
|
|
910
674
|
});
|
|
911
675
|
|
|
912
676
|
describe("repro_test on bug lanes (#4271)", () => {
|
|
@@ -1246,13 +1010,6 @@ describe("post-deploy check ids (#4626)", () => {
|
|
|
1246
1010
|
const ok = applyAmendments(C, [{ kind: "post-deploy", requirement: "R1", why: "w", check: "login-smoke" }], ISSUE);
|
|
1247
1011
|
assert.equal(ok.contract.requirements[0].check, "login-smoke");
|
|
1248
1012
|
});
|
|
1249
|
-
it("precheck: a check id on neither branch is unimplemented; null checkIds skips the rule", () => {
|
|
1250
|
-
const res = { requirements: [{ id: "R1", status: "post-deploy" }, { id: "R2", status: "implemented" }], validation: [{ id: "V1", exit: 0 }] };
|
|
1251
|
-
const c = pd({ check: "login-smoke" });
|
|
1252
|
-
assert.ok(precheck({ contract: c, result: res, changedFiles: files, checkIds: new Set() }).failures.some((f) => f.kind === "check_unknown"));
|
|
1253
|
-
assert.ok(!precheck({ contract: c, result: res, changedFiles: files, checkIds: new Set(["login-smoke"]) }).failures.some((f) => f.kind === "check_unknown"));
|
|
1254
|
-
assert.ok(!precheck({ contract: c, result: res, changedFiles: files }).failures.some((f) => f.kind === "check_unknown"));
|
|
1255
|
-
});
|
|
1256
1013
|
it("#4664 followupItems carries the follow-up class; validateContract rejects an unknown class", () => {
|
|
1257
1014
|
const cls = (r) => followupItems([{ id: "R1", quote: Q1, why: "w", ...r }])[0].class;
|
|
1258
1015
|
assert.equal(cls({ disposition: "defer" }), "engineering");
|
|
@@ -1401,35 +1158,10 @@ describe("decision amendments (#4695)", () => {
|
|
|
1401
1158
|
assert.ok(!amend({ supersedes: "d9-1" }).contract.preserve.some((p) => p.id === "H1"));
|
|
1402
1159
|
assert.ok(amend({}).contract.preserve.some((p) => p.id === "H1"));
|
|
1403
1160
|
});
|
|
1404
|
-
it("a decision without choice or anchors is an incomplete amendment", () => {
|
|
1405
|
-
assert.match(amend({ choice: "" }).problems[0], /needs decision/);
|
|
1406
|
-
});
|
|
1407
1161
|
});
|
|
1408
1162
|
|
|
1409
1163
|
describe("implied docs-freshness deliverable", () => {
|
|
1410
1164
|
const base = ["src/scrape.js"], after = [...base, "src/search.js", "docs/guide.md", "src/extra.js"];
|
|
1411
|
-
it("a doc path newly added by a freshness fix round becomes an add-deliverable amendment, a code file does not", () => {
|
|
1412
|
-
const am = impliedDocDeliverables({ before: base, after, contract: C, wasFailing: true, nowOk: true });
|
|
1413
|
-
assert.deepEqual(am, [{ kind: "add-deliverable", path: "docs/guide.md", why: "docs freshness rule" }]);
|
|
1414
|
-
});
|
|
1415
|
-
it("applied, the doc passes conformance and an unrelated out-of-contract file in the same round is still scope_creep", () => {
|
|
1416
|
-
const am = impliedDocDeliverables({ before: base, after, contract: C, wasFailing: true, nowOk: true });
|
|
1417
|
-
const { contract } = applyAmendments(C, am, ISSUE);
|
|
1418
|
-
const pc = precheck({ contract, changedFiles: ["src/scrape.js", "src/search.js", "docs/guide.md", "src/extra.js"], result: null });
|
|
1419
|
-
const creep = pc.failures.filter((f) => f.kind === "scope_creep").map((f) => f.detail).join();
|
|
1420
|
-
assert.match(creep, /src\/extra\.js/); assert.doesNotMatch(creep, /docs\/guide\.md/);
|
|
1421
|
-
});
|
|
1422
|
-
it("only prose files under a docs directory are implied: build, dependency, agent-instruction and spec files stay scope_creep", () => {
|
|
1423
|
-
const bad = ["requirements.txt", "CMakeLists.txt", "CLAUDE.md", "AGENTS.md", "commands/work-on.md", ".claude/agents/x.md", "notes.txt", "docs/run.sh"];
|
|
1424
|
-
const good = ["devdocs/modules/lean.md", "doc/api.rst", "packages/web/docs/setup.mdx"];
|
|
1425
|
-
const am = impliedDocDeliverables({ before: base, after: [...base, ...bad, ...good], contract: C, wasFailing: true, nowOk: true });
|
|
1426
|
-
assert.deepEqual(am.map((a) => a.path), good);
|
|
1427
|
-
});
|
|
1428
|
-
it("nothing is implied unless the rule failed before the round and passes after, or when the doc was already changed or covered", () => {
|
|
1429
|
-
assert.deepEqual(impliedDocDeliverables({ before: base, after, contract: C, wasFailing: false, nowOk: true }), []);
|
|
1430
|
-
assert.deepEqual(impliedDocDeliverables({ before: base, after, contract: C, wasFailing: true, nowOk: false }), []);
|
|
1431
|
-
assert.deepEqual(impliedDocDeliverables({ before: [...base, "docs/guide.md"], after, contract: C, wasFailing: true, nowOk: true }), []);
|
|
1432
|
-
});
|
|
1433
1165
|
});
|
|
1434
1166
|
|
|
1435
1167
|
import { normalizeKindModes, blockingFailures, unverifiedRequirements, KIND_MODES } from "./conformance.mjs";
|
|
@@ -1536,26 +1268,6 @@ describe("mutation check (#4913)", () => {
|
|
|
1536
1268
|
});
|
|
1537
1269
|
|
|
1538
1270
|
describe("builder amendment slips (#5036)", () => {
|
|
1539
|
-
it("deferral-shaped kinds naming a requirement apply as a tracked defer", () => {
|
|
1540
|
-
for (const kind of ["scope_narrowing", "scope_reduction", "defer-verification", "deferred_measurement", "Scope-Narrowing"]) {
|
|
1541
|
-
const a = applyAmendments(C, [{ kind, requirement: "R1", why: "w" }]);
|
|
1542
|
-
assert.deepEqual(a.problems, [], kind);
|
|
1543
|
-
assert.equal(a.contract.requirements.find((r) => r.id === "R1").disposition, "defer", kind);
|
|
1544
|
-
assert.deepEqual(a.toTrack.map((r) => r.id), ["R1"], kind);
|
|
1545
|
-
}
|
|
1546
|
-
assert.match(applyAmendments(C, [{ kind: "scope_narrowing", why: "w" }]).problems[0], /unknown kind 'scope_narrowing'; valid kinds are/);
|
|
1547
|
-
});
|
|
1548
|
-
it("verification_substitution applies as substitute-validate with the same checks", () => {
|
|
1549
|
-
const base = { requirements: [], validate: [{ id: "V2", command: "poetry run pytest" }] };
|
|
1550
|
-
const ok = applyAmendments(base, [{ kind: "verification_substitution", validate: "V2", command: "node --test t.mjs", why: "no poetry" }]);
|
|
1551
|
-
assert.deepEqual(ok.problems, []);
|
|
1552
|
-
assert.equal(ok.contract.validate[0].command, "node --test t.mjs");
|
|
1553
|
-
assert.equal(ok.contract.validate[0].substituted.from, "poetry run pytest");
|
|
1554
|
-
for (const command of ["echo (oops", "true", "git diff origin/main"]) {
|
|
1555
|
-
assert.equal(applyAmendments(base, [{ kind: "verification_substitution", validate: "V2", command, why: "w" }]).problems.length, 1, command);
|
|
1556
|
-
}
|
|
1557
|
-
assert.match(applyAmendments(base, [{ kind: "verification_substitution", why: "w" }]).problems[0], /needs validate/);
|
|
1558
|
-
});
|
|
1559
1271
|
it("out_of_band_verification marks a deliver requirement out_of_band with its evidence", () => {
|
|
1560
1272
|
const ok = applyAmendments(C, [{ kind: "out_of_band_verification", requirement: "R1", evidence: ".github/workflows/perf.yml", why: "field metric" }]);
|
|
1561
1273
|
assert.deepEqual(ok.problems, []);
|
|
@@ -1571,9 +1283,6 @@ describe("builder amendment slips (#5036)", () => {
|
|
|
1571
1283
|
assert.equal(a.applied.length, 2, kind);
|
|
1572
1284
|
}
|
|
1573
1285
|
});
|
|
1574
|
-
it("a truly unknown kind is still rejected with the valid kinds", () => {
|
|
1575
|
-
assert.match(applyAmendments(C, [{ kind: "flaky-note", why: "w" }]).problems[0], /unknown kind 'flaky-note'; valid kinds are .*substitute-validate/);
|
|
1576
|
-
});
|
|
1577
1286
|
});
|
|
1578
1287
|
|
|
1579
1288
|
describe("#5020 freeze-time environment defects", () => {
|
|
@@ -1639,14 +1348,6 @@ describe("#5020 freeze-time environment defects", () => {
|
|
|
1639
1348
|
assert.equal(r.contract.requirements[0].disposition, "defer");
|
|
1640
1349
|
assert.equal(r.contract.requirements[0].bucket, ORCHESTRATOR_BUCKET);
|
|
1641
1350
|
});
|
|
1642
|
-
it("a substitute-validate that is not valid shell is rejected", () => {
|
|
1643
|
-
assert.match(substituteShellProblem("pytest tests/ && ("), /./);
|
|
1644
|
-
assert.equal(substituteShellProblem("pytest tests/"), null);
|
|
1645
|
-
const c = { requirements: [{ id: "R1", quote: "q", disposition: "deliver" }], deliverables: [], validate: [{ id: "V1", command: "poetry run pytest" }] };
|
|
1646
|
-
const r = applyAmendments(c, [{ kind: "substitute-validate", validate: "V1", command: "uv run pytest tests/ && (", why: "poetry env missing" }], "q");
|
|
1647
|
-
assert.ok(r.problems.some((p) => /not valid shell/.test(p)));
|
|
1648
|
-
assert.equal(r.contract.validate[0].command, "poetry run pytest");
|
|
1649
|
-
});
|
|
1650
1351
|
});
|
|
1651
1352
|
|
|
1652
1353
|
describe("#5087 a plan decision may not weaken an e2e/integration criterion to mocked tests", () => {
|
|
@@ -1721,17 +1422,6 @@ describe("#5087 a plan decision may not weaken an e2e/integration criterion to m
|
|
|
1721
1422
|
|
|
1722
1423
|
describe("supersedes naming a validate row (#5979)", () => {
|
|
1723
1424
|
const frozen = { requirements: [], deliverables: [], validate: [{ id: "V1", command: "true" }, { id: "G2", command: "node --test a.test.mjs" }] };
|
|
1724
|
-
it("rejects guard G2 with a substitute-validate hint and records no supersedes", () => {
|
|
1725
|
-
const r = applyAmendments(frozen, [{ kind: "supersedes", guard: "G2", why: "w" }]);
|
|
1726
|
-
assert.equal(r.problems.length, 1);
|
|
1727
|
-
assert.match(r.problems[0], /substitute-validate/);
|
|
1728
|
-
assert.deepEqual(r.contract.supersedes ?? [], []);
|
|
1729
|
-
});
|
|
1730
|
-
it("amendmentKindProblems reports it only when given the validate ids", () => {
|
|
1731
|
-
const a = [{ kind: "supersedes", guard: "G2", why: "w" }];
|
|
1732
|
-
assert.match(amendmentKindProblems(a, ["G2"])[0], /substitute-validate/);
|
|
1733
|
-
assert.deepEqual(amendmentKindProblems(a), []);
|
|
1734
|
-
});
|
|
1735
1425
|
it("a #N guard and a mechanism still apply", () => {
|
|
1736
1426
|
const r = applyAmendments(frozen, [{ kind: "supersedes", guard: "#123", why: "w" }, { kind: "supersedes", mechanism: "m", why: "w" }]);
|
|
1737
1427
|
assert.deepEqual(r.problems, []);
|
|
@@ -1741,18 +1431,6 @@ describe("supersedes naming a validate row (#5979)", () => {
|
|
|
1741
1431
|
});
|
|
1742
1432
|
|
|
1743
1433
|
describe("amendmentKindProblems (#5089)", () => {
|
|
1744
|
-
it("flags the invented deliverable_change kind and names the valid kinds", () => {
|
|
1745
|
-
const p = amendmentKindProblems([{ kind: "deliverable_change", requirement: "R1", why: "no Linux build" }]);
|
|
1746
|
-
assert.equal(p.length, 1);
|
|
1747
|
-
assert.match(p[0], /unknown kind 'deliverable_change'; valid kinds are .*defer/);
|
|
1748
|
-
});
|
|
1749
|
-
it("accepts valid kinds, normalised slips and informational kinds", () => {
|
|
1750
|
-
assert.deepEqual(amendmentKindProblems([{ kind: "defer", requirement: "R1", why: "w" }, { type: "limitation", requirement: "R2", why: "w" }, { kind: "scope-note", why: "w" }, { kind: "add-deliverable", path: "a.js", why: "w" }]), []);
|
|
1751
|
-
assert.deepEqual(amendmentKindProblems(undefined), []);
|
|
1752
|
-
});
|
|
1753
|
-
it("flags a missing path or requirement", () => {
|
|
1754
|
-
assert.equal(amendmentKindProblems([{ kind: "add-deliverable", why: "w" }, { kind: "defer", why: "w" }]).length, 2);
|
|
1755
|
-
});
|
|
1756
1434
|
});
|
|
1757
1435
|
|
|
1758
1436
|
// Release review of #5103: MAT-1/REG-1 (non-code fixes are never "already fixed") and the read-only-prod routing theme
|
|
@@ -2205,13 +1883,6 @@ describe("#5547 live-infra, paid and host-load e2e rows", () => {
|
|
|
2205
1883
|
});
|
|
2206
1884
|
|
|
2207
1885
|
describe("#5623: builder-correctable contract problems", () => {
|
|
2208
|
-
it("contractSelfCorrectable: shape problems are builder-correctable; a quote-only mismatch is not", async () => {
|
|
2209
|
-
const { contractSelfCorrectable } = await import("./lean.mjs");
|
|
2210
|
-
assert.equal(contractSelfCorrectable(["R7: test_plan no-repro needs a reason the reviewer can reject"]), true);
|
|
2211
|
-
assert.equal(contractSelfCorrectable(["R1: quote is not verbatim", "R7: test_plan no-repro needs a reason the reviewer can reject"]), true);
|
|
2212
|
-
assert.equal(contractSelfCorrectable(["R1: quote is not verbatim"]), false);
|
|
2213
|
-
assert.equal(contractSelfCorrectable([]), false);
|
|
2214
|
-
});
|
|
2215
1886
|
it("classifyNeedsHuman: contract.invalid is recoverable (one fresh-plan requeue), with or without an issue edit", async () => {
|
|
2216
1887
|
const { classifyNeedsHuman, OUTCOME_CODES } = await import("../engine/outcome-codes.mjs");
|
|
2217
1888
|
assert.equal(classifyNeedsHuman({ outcome: "needs-human", code: OUTCOME_CODES.CONTRACT_INVALID }), "recoverable");
|
|
@@ -2223,10 +1894,6 @@ describe("first-pass: an unregistered post-deploy check id fails at freeze, not
|
|
|
2223
1894
|
const issue = "The schedd answers status in under 1 s under load.";
|
|
2224
1895
|
const row = (extra = {}) => ({ requirements: [{ id: "R1", quote: "The schedd answers status in under 1 s under load.", disposition: "post-deploy", why: "needs a loaded host", bucket: "post-deploy", check: "schedd-status-under-load", local_infeasible_why: "needs real host load" }], deliverables: [{ id: "D1", path: "bin/x.mjs", change: "x", requirements: ["R1"] }], ...extra });
|
|
2225
1896
|
const files = (json) => new Set(Object.keys(JSON.parse(json)));
|
|
2226
|
-
it("an id absent from the checks file and not delivered is a freeze problem naming the fix", () => {
|
|
2227
|
-
const v = validateContract(row(), issue, { checkIds: files('{"login-smoke":{"run":"true"}}') });
|
|
2228
|
-
assert.ok(v.problems.some((p) => /R1: post-deploy check 'schedd-status-under-load' is not registered[\s\S]*login-smoke/.test(p)), v.problems.join("\n"));
|
|
2229
|
-
});
|
|
2230
1897
|
it("a registered id, or a deliverable that adds the checks file, passes this rule", () => {
|
|
2231
1898
|
const reg = validateContract(row(), issue, { checkIds: files('{"schedd-status-under-load":{"run":"true"}}') });
|
|
2232
1899
|
assert.ok(!reg.problems.some((p) => /is not registered/.test(p)));
|
|
@@ -2366,15 +2033,6 @@ describe("#5750 outcome rows bind, proposed-change rows are guidance", () => {
|
|
|
2366
2033
|
describe("#5752 mechanism supersedes", () => {
|
|
2367
2034
|
const K = { requirements: [], deliverables: [{ id: "D1", path: "src/triage.mjs" }], validate: [] };
|
|
2368
2035
|
const broken = (guard, test) => ({ code: "conformance.guard_broken", kind: "guard_broken", guard, test, detail: `guard ${guard} broken` });
|
|
2369
|
-
it("validates {mechanism, why} and stores it as contract.mechanisms; per-guard supersedes keeps working", () => {
|
|
2370
|
-
const a = applyAmendments(K, [{ kind: "supersedes", mechanism: "keyword triage", why: "replaced by the scorer" }, { kind: "supersedes", guard: "#12", why: "own" }]);
|
|
2371
|
-
assert.deepEqual(a.problems, []);
|
|
2372
|
-
assert.deepEqual(a.contract.mechanisms, [{ mechanism: "keyword triage", why: "replaced by the scorer" }]);
|
|
2373
|
-
assert.deepEqual(a.contract.supersedes, [{ guard: "#12", why: "own" }]);
|
|
2374
|
-
assert.deepEqual(a.applied.map((x) => x.target), ["mechanism keyword triage", "#12"]);
|
|
2375
|
-
assert.match(applyAmendments(K, [{ kind: "supersedes", mechanism: " ", why: "x" }]).problems[0], /needs guard: "#N".*or mechanism/);
|
|
2376
|
-
assert.match(applyAmendments(K, [{ kind: "supersedes", mechanism: "m" }]).problems[0], /without why/);
|
|
2377
|
-
});
|
|
2378
2036
|
it("one amendment retires every guard_broken whose test the lane deleted; a strong guard with a surviving test still fails", () => {
|
|
2379
2037
|
const contract = applyAmendments(K, [{ kind: "supersedes", mechanism: "keyword triage", why: "removed" }]).contract;
|
|
2380
2038
|
const guardFailures = [broken("#7", "src/kw.test.mjs"), broken("#8", "src/kw2.test.mjs"), broken("#9", "src/score.test.mjs")];
|
|
@@ -2398,11 +2056,6 @@ describe("recurrence counters and design lane precheck (#5751)", () => {
|
|
|
2398
2056
|
const rec = { recurs: true, count: 2, threshold: 2, evidence: [], reason: "r" };
|
|
2399
2057
|
const design = { why_failed: "#1 and #2 patched the symptom", disposition: "replace", outcome: { metric: "retries per day", target: "0" } };
|
|
2400
2058
|
|
|
2401
|
-
it("a counter that grew without a counter-ok decision fails with maintenance.counter_growth", () => {
|
|
2402
|
-
const pc = run({ counters: { before: { exports: 3 }, after: { exports: 4 } } });
|
|
2403
|
-
assert.deepEqual(pc.failures.map((f) => [f.code, f.kind]), [["maintenance.counter_growth", "counter_growth"]]);
|
|
2404
|
-
assert.match(pc.failures[0].detail, /counter exports grew from 3 to 4/);
|
|
2405
|
-
});
|
|
2406
2059
|
it("a counter-ok decision, an unchanged or shrinking counter, and no counters all pass", () => {
|
|
2407
2060
|
const ok = { ...C, decisions: [{ id: "K1", choice: "counter-ok: exports the new parser needs one entry point", justification: "" }] };
|
|
2408
2061
|
assert.equal(run({ counters: { before: { exports: 3 }, after: { exports: 4 } } }, ok).ok, true);
|
|
@@ -2410,14 +2063,6 @@ describe("recurrence counters and design lane precheck (#5751)", () => {
|
|
|
2410
2063
|
assert.equal(run({ counters: { before: { exports: 3 }, after: { exports: 1 } } }).ok, true);
|
|
2411
2064
|
assert.equal(run({}).ok, true);
|
|
2412
2065
|
});
|
|
2413
|
-
it("a recurring issue's contract without a complete design block fails with recurrence.design_missing", () => {
|
|
2414
|
-
const pc = run({ recurrence: rec });
|
|
2415
|
-
assert.deepEqual(pc.failures.map((f) => [f.code, f.kind]), [["recurrence.design_missing", "design_missing"]]);
|
|
2416
|
-
const partial = run({ recurrence: rec }, { ...C, design: { ...design, disposition: "patch", outcome: { metric: "x" } } });
|
|
2417
|
-
assert.match(partial.failures[0].detail, /disposition.*; design\.outcome needs a metric and a target/);
|
|
2418
|
-
assert.equal(run({ recurrence: rec }, { ...C, design }).ok, true);
|
|
2419
|
-
assert.equal(run({ recurrence: { ...rec, recurs: false } }).ok, true, "no recurrence: no design check");
|
|
2420
|
-
});
|
|
2421
2066
|
});
|
|
2422
2067
|
|
|
2423
2068
|
describe("#5754 live-stack e2e rows convert to post-deploy at freeze", () => {
|
|
@@ -2455,7 +2100,7 @@ describe("#5754 precheck fails fast on a deliver row the placement cannot produc
|
|
|
2455
2100
|
});
|
|
2456
2101
|
|
|
2457
2102
|
import { AMENDMENT_EXAMPLES, AMEND_KINDS as SCHEMA_KINDS } from "./amendment-schema.mjs";
|
|
2458
|
-
import { builderImplementPrompt
|
|
2103
|
+
import { builderImplementPrompt } from "./prompts.mjs";
|
|
2459
2104
|
|
|
2460
2105
|
describe("builder prompt amendments agree with the validator (#5979)", () => {
|
|
2461
2106
|
const frozen = {
|
|
@@ -2463,24 +2108,43 @@ describe("builder prompt amendments agree with the validator (#5979)", () => {
|
|
|
2463
2108
|
deliverables: [{ id: "D1", path: "a.mjs", change: "c", requirements: ["R1"] }],
|
|
2464
2109
|
validate: [{ id: "V1", command: "true" }, { id: "G2", command: "node --test a.test.mjs" }],
|
|
2465
2110
|
};
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
assert.
|
|
2111
|
+
});
|
|
2112
|
+
|
|
2113
|
+
describe("#6051 frozen defer/post-deploy rows are follow-ups, not omissions", () => {
|
|
2114
|
+
const Q3 = "Metric: the failure rate stays under 5% over a real batch.";
|
|
2115
|
+
const k = { ...C, requirements: [...C.requirements, { id: "R3", quote: Q3, disposition: "post-deploy", bucket: "post-deploy", check: "c1", why: "needs production traffic" }], decisions: [{ id: "K1", choice: "gate on frozen disposition" }] };
|
|
2116
|
+
const kctx = { ...ctx, contract: k, issueText: `${ISSUE}\n${Q3}` };
|
|
2117
|
+
const rows = { ...good, requirements: [...good.requirements, { id: "R3", status: "post-deploy", evidence: "", validated_by: "", deferral_ok: true }] };
|
|
2118
|
+
it("6051 deferred row narrowed in coverage is not an omission", () => {
|
|
2119
|
+
const d = decide({ ...rows, issue_coverage: [...good.issue_coverage, { quote: Q3, contract_ids: ["R3"], status: "narrowed" }, ] }, kctx);
|
|
2120
|
+
assert.equal(d.state, "conforms", JSON.stringify(d.failures));
|
|
2121
|
+
assert.deepEqual(d.followUps.map((x) => x.ids), [["R3"]]);
|
|
2122
|
+
});
|
|
2123
|
+
it("a deliver row narrowed is still an omission", () => {
|
|
2124
|
+
const d = decide({ ...good, issue_coverage: [{ quote: Q1, contract_ids: ["R1"], status: "narrowed" }, ...good.issue_coverage.slice(1)] }, ctx);
|
|
2125
|
+
assert.ok(codes(d).includes("conformance.omission"));
|
|
2126
|
+
});
|
|
2127
|
+
it("a Metric-over-real-batch requirement is post-deploy at freeze; plain rows are not", () => {
|
|
2128
|
+
const out = autoPostDeployE2e({ requirements: [{ id: "R1", quote: Q3, disposition: "deliver" }, { id: "R2", quote: "The scrape route must release the reservation.", disposition: "deliver" }] });
|
|
2129
|
+
assert.deepEqual(out.contract.requirements.map((r) => r.disposition), ["post-deploy", "deliver"]);
|
|
2130
|
+
assert.deepEqual(out.converted.map((c) => c.id), ["R1"]);
|
|
2131
|
+
});
|
|
2132
|
+
it("an amendment citing a frozen decision is weighed against it: a backed narrowing is no omission, an unbacked or missing one is", () => {
|
|
2133
|
+
const am = (text) => ({ ...k, requirements: k.requirements.map((r) => (r.id === "R1" ? { ...r, amendment: { text, why: "w" } } : r)) });
|
|
2134
|
+
const cov = (status) => ({ ...rows, issue_coverage: [{ quote: Q1, contract_ids: ["R1"], status }, ...good.issue_coverage.slice(1)] });
|
|
2135
|
+
const backed = decide(cov("narrowed"), { ...kctx, contract: am("narrowed per K1") });
|
|
2136
|
+
assert.equal(backed.state, "conforms");
|
|
2137
|
+
assert.deepEqual(backed.decisionBacked.map((x) => x.decision), ["K1"]);
|
|
2138
|
+
assert.ok(codes(decide(cov("narrowed"), { ...kctx, contract: am("narrowed per K9") })).includes("conformance.omission"));
|
|
2139
|
+
assert.ok(codes(decide(cov("missing"), { ...kctx, contract: am("narrowed per K1") })).includes("conformance.omission"));
|
|
2140
|
+
});
|
|
2141
|
+
it("6051 replay of the 5749 shape (R4 delivered, R12 deferred, R5 amended citing K1) yields no omission rows", () => {
|
|
2142
|
+
const Q4 = "Fixture: a defer row stays tracked.", Q5 = "Metric: the rate stays under 5% over a real batch.";
|
|
2143
|
+
const kk = { ...C, decisions: [{ id: "K1", choice: "x" }], requirements: [C.requirements[0], { id: "R4", quote: Q4, disposition: "deliver", amendment: { text: "narrowed per K1", why: "w" } }, { id: "R12", quote: Q5, disposition: "post-deploy", bucket: "post-deploy", check: "c1", why: "prod" }] };
|
|
2144
|
+
const rv = { ...good, issue_coverage: [{ quote: Q1, contract_ids: ["R1"], status: "covered" }, { quote: Q4, contract_ids: ["R4"], status: "narrowed" }, { quote: Q5, contract_ids: ["R12"], status: "missing" }, good.issue_coverage[2]],
|
|
2145
|
+
requirements: [good.requirements[0], { id: "R4", status: "implemented", evidence: "src/search.js:7", validated_by: "V1" }, { id: "R12", status: "post-deploy", evidence: "", validated_by: "", deferral_ok: true }] };
|
|
2146
|
+
const d = decide(rv, { ...ctx, contract: kk, issueText: `${ISSUE}\n${Q4}\n${Q5}` });
|
|
2147
|
+
assert.equal(d.state, "conforms", JSON.stringify(d.failures));
|
|
2148
|
+
assert.ok(!codes(d).includes("conformance.omission"));
|
|
2485
2149
|
});
|
|
2486
2150
|
});
|