forgedock 1.52.0 → 1.54.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/.claude-plugin/marketplace.json +51 -0
- package/README.md +8 -2
- package/bin/auth/app-manifest.mjs +89 -0
- package/bin/auth/app-manifest.test.mjs +75 -0
- package/bin/auth/app-token.mjs +256 -0
- package/bin/auth/app-token.test.mjs +232 -0
- package/bin/brand.mjs +7 -0
- package/bin/config-history.mjs +151 -0
- package/bin/config-schema.mjs +115 -0
- package/bin/demo.mjs +65 -11
- package/bin/engine/outcome-codes.mjs +9 -3
- package/bin/engine/telemetry-seam.mjs +11 -3
- package/bin/engine/telemetry-seam.test.mjs +17 -0
- package/bin/engine-cli.mjs +110 -36
- package/bin/experiment.mjs +58 -6
- package/bin/first-run.mjs +122 -0
- package/bin/forge-utils.mjs +6 -2
- package/bin/forgedock.mjs +138 -142
- package/bin/help-text.mjs +144 -0
- package/bin/hooks/pre-tool-use.mjs +7 -0
- package/bin/journey.mjs +82 -83
- package/bin/lean/acceptance.mjs +313 -0
- package/bin/lean/acceptance.test.mjs +215 -0
- package/bin/lean/account-watch.mjs +28 -0
- package/bin/lean/account-watch.test.mjs +30 -0
- package/bin/lean/activation.mjs +38 -0
- package/bin/lean/activation.test.mjs +36 -1
- package/bin/lean/basered.mjs +115 -0
- package/bin/lean/basered.test.mjs +66 -0
- package/bin/lean/batch-health.mjs +114 -7
- package/bin/lean/batch-health.test.mjs +87 -1
- package/bin/lean/batch.mjs +41 -2
- package/bin/lean/batch.test.mjs +115 -11
- package/bin/lean/branchlock.mjs +54 -0
- package/bin/lean/branchlock.test.mjs +49 -0
- package/bin/lean/ceiling.mjs +72 -0
- package/bin/lean/ceiling.test.mjs +54 -0
- package/bin/lean/checkpoint-reconcile.mjs +43 -0
- package/bin/lean/checkpoint-reconcile.test.mjs +95 -0
- package/bin/lean/ci-budget.mjs +366 -0
- package/bin/lean/ci-budget.test.mjs +167 -0
- package/bin/lean/conformance.e2e.test.mjs +8 -1
- package/bin/lean/conformance.mjs +269 -38
- package/bin/lean/conformance.test.mjs +280 -7
- package/bin/lean/context.mjs +35 -6
- package/bin/lean/context.test.mjs +27 -1
- package/bin/lean/depcache.mjs +25 -1
- package/bin/lean/depcache.test.mjs +26 -0
- package/bin/lean/e2e.mjs +18 -2
- package/bin/lean/e2e.test.mjs +26 -1
- package/bin/lean/effects.mjs +47 -14
- package/bin/lean/execution.mjs +19 -3
- package/bin/lean/execution.test.mjs +63 -0
- package/bin/lean/facts.mjs +3 -3
- package/bin/lean/facts.test.mjs +5 -0
- package/bin/lean/findinglabel.mjs +16 -0
- package/bin/lean/findinglabel.test.mjs +39 -0
- package/bin/lean/fixround.mjs +14 -0
- package/bin/lean/fixround.test.mjs +25 -2
- package/bin/lean/gh-assoc.test.mjs +2 -1
- package/bin/lean/integration.mjs +100 -9
- package/bin/lean/integration.test.mjs +98 -0
- package/bin/lean/issuewatch-parity.mjs +64 -0
- package/bin/lean/issuewatch-parity.test.mjs +127 -0
- package/bin/lean/issuewatch-release.mjs +6 -2
- package/bin/lean/issuewatch-release.test.mjs +17 -1
- package/bin/lean/issuewatch.mjs +45 -6
- package/bin/lean/issuewatch.test.mjs +3 -2
- package/bin/lean/lanelock.mjs +14 -0
- package/bin/lean/lean.mjs +473 -100
- package/bin/lean/lean.test.mjs +686 -33
- package/bin/lean/light.mjs +48 -7
- package/bin/lean/light.test.mjs +37 -3
- package/bin/lean/limits.test.mjs +142 -9
- package/bin/lean/mechfix.mjs +124 -0
- package/bin/lean/mechfix.test.mjs +75 -0
- package/bin/lean/orchestrate-cancel.test.mjs +143 -0
- package/bin/lean/orchestrate.mjs +116 -28
- package/bin/lean/phaseledger.mjs +47 -5
- package/bin/lean/phaseledger.test.mjs +30 -1
- package/bin/lean/postdeploy-check.test.mjs +39 -0
- package/bin/lean/precheck.mjs +23 -4
- package/bin/lean/precheck.test.mjs +14 -1
- package/bin/lean/prereq.mjs +28 -0
- package/bin/lean/prereq.test.mjs +20 -0
- package/bin/lean/probe.mjs +4 -2
- package/bin/lean/prodparity.mjs +52 -0
- package/bin/lean/prodparity.test.mjs +67 -0
- package/bin/lean/prompts.mjs +77 -19
- package/bin/lean/quota.mjs +39 -0
- package/bin/lean/recovery.test.mjs +11 -1
- package/bin/lean/relaxation.mjs +73 -0
- package/bin/lean/relaxation.test.mjs +54 -0
- package/bin/lean/release-io.test.mjs +42 -0
- package/bin/lean/release-postmerge.mjs +125 -0
- package/bin/lean/release-preflight.mjs +58 -0
- package/bin/lean/release-preflight.test.mjs +114 -0
- package/bin/lean/release-rehearsal.mjs +64 -0
- package/bin/lean/release-rehearsal.test.mjs +93 -0
- package/bin/lean/release-review.e2e.test.mjs +77 -0
- package/bin/lean/release-review.mjs +254 -0
- package/bin/lean/release-review.test.mjs +307 -0
- package/bin/lean/release-snapshot.mjs +188 -0
- package/bin/lean/release-snapshot.test.mjs +190 -0
- package/bin/lean/release.mjs +296 -0
- package/bin/lean/release.test.mjs +387 -0
- package/bin/lean/render.mjs +1 -1
- package/bin/lean/replan.mjs +184 -0
- package/bin/lean/replan.test.mjs +110 -0
- package/bin/lean/resume.mjs +9 -7
- package/bin/lean/resume.test.mjs +16 -0
- package/bin/lean/rotator.mjs +150 -31
- package/bin/lean/rotator.test.mjs +105 -2
- package/bin/lean/sandbox-remote.mjs +9 -2
- package/bin/lean/schedd.mjs +83 -5
- package/bin/lean/schedd.test.mjs +108 -7
- package/bin/lean/selfreview.mjs +94 -0
- package/bin/lean/selfreview.test.mjs +58 -1
- package/bin/lean/selftest-gate.mjs +22 -0
- package/bin/lean/selftest-gate.test.mjs +18 -1
- package/bin/lean/selftest-journey.mjs +234 -0
- package/bin/lean/selftest-journey.test.mjs +130 -0
- package/bin/lean/selftest-live.mjs +2 -1
- package/bin/lean/seqlease.mjs +35 -1
- package/bin/lean/seqlease.test.mjs +15 -0
- package/bin/lean/seqreserve.e2e.test.mjs +135 -0
- package/bin/lean/seqreserve.mjs +73 -0
- package/bin/lean/seqreserve.test.mjs +134 -0
- package/bin/lean/sequence.mjs +35 -6
- package/bin/lean/seqversioned.mjs +147 -0
- package/bin/lean/stagestamp.mjs +28 -0
- package/bin/lean/stagestamp.test.mjs +32 -0
- package/bin/lean/surfaces.mjs +75 -0
- package/bin/lean/surfaces.test.mjs +59 -0
- package/bin/lean/toolplace.mjs +28 -0
- package/bin/lean/toolplace.test.mjs +24 -0
- package/bin/lean/toolstats.mjs +3 -1
- package/bin/lean/toolstats.test.mjs +11 -0
- package/bin/lean/validatebest.mjs +28 -0
- package/bin/lean/validatebest.test.mjs +27 -0
- package/bin/lean/verifier.mjs +3 -2
- package/bin/lean/verify.mjs +2 -1
- package/bin/lean/verify.test.mjs +6 -0
- package/bin/pool/agent.mjs +27 -4
- package/bin/pool/docker.mjs +5 -0
- package/bin/pool/router.mjs +74 -28
- package/bin/prereqs.mjs +111 -0
- package/bin/replay-timelapse.mjs +149 -0
- package/bin/review-staging.mjs +123 -16
- package/bin/review-staging.test.mjs +18 -0
- package/bin/runner.mjs +43 -6
- package/bin/splash-install.mjs +157 -0
- package/bin/stats/aggregate.mjs +8 -1
- package/bin/stats/conformance-outcomes.mjs +289 -0
- package/bin/stats/conformance-outcomes.test.mjs +274 -0
- package/bin/stats/depth.mjs +275 -0
- package/bin/stats/depth.test.mjs +158 -0
- package/bin/stats/efficiency.mjs +26 -5
- package/bin/stats/efficiency.test.mjs +45 -1
- package/bin/stats/experiment.mjs +7 -5
- package/bin/stats/first-review.mjs +77 -0
- package/bin/stats/first-review.test.mjs +36 -0
- package/bin/stats/firstmerge.mjs +40 -0
- package/bin/stats/firstmerge.test.mjs +41 -0
- package/bin/stats/github-source.mjs +53 -15
- package/bin/stats/index.mjs +147 -9
- package/bin/stats/local-source.mjs +12 -0
- package/bin/stats/origin.mjs +80 -0
- package/bin/stats/origin.test.mjs +58 -0
- package/bin/stats/query.mjs +69 -0
- package/bin/stats/render.mjs +3 -1
- package/bin/stats/scoreboard.mjs +137 -0
- package/bin/stats/scoreboard.test.mjs +87 -0
- package/bin/stats/selffiled.mjs +52 -0
- package/bin/stats/selffiled.test.mjs +71 -0
- package/bin/stats/stats.test.mjs +80 -0
- package/bin/tui.mjs +3 -2
- package/commands/bootstrap.md +15 -14
- package/commands/deploy-pr.md +18 -3
- package/commands/forge-stats.md +1 -1
- package/commands/forgedock-ci-setup.md +28 -0
- package/commands/forgedock-init.md +4 -5
- package/commands/issue.md +2 -0
- package/commands/milestone.md +9 -1
- package/commands/orchestrate.md +1 -1
- package/commands/replay.md +2 -0
- package/commands/review-pr-agents/security.md +4 -0
- package/commands/review-pr-staging.md +6 -1
- package/commands/work-on/build.md +4 -6
- package/commands/work-on/close.md +8 -0
- package/docs/CONFIG.md +170 -18
- package/docs/ISSUE-WATCH.md +25 -0
- package/docs/OUTCOME-CODES.md +4 -0
- package/docs/REPLAY.md +9 -0
- package/docs/SELFTEST.md +11 -0
- package/docs/STATS.md +61 -0
- package/docs/TELEMETRY.md +1 -1
- package/docs/eval/README.md +6 -0
- package/docs/eval/adversarial-bench.md +68 -0
- package/docs/eval/corpus/adversarial-v1.json +285 -0
- package/docs/eval/feature-bench.md +42 -0
- package/docs/eval/feature-specs/crud-auth/journeys/notes-crud-isolated.mjs +21 -0
- package/docs/eval/feature-specs/crud-auth/journeys/register-login.mjs +12 -0
- package/docs/eval/feature-specs/crud-auth/spec.md +15 -0
- package/docs/site/start-a-new-project.md +2 -1
- package/package.json +5 -2
- package/plugins/forgedock-splash/.claude-plugin/plugin.json +10 -0
- package/plugins/forgedock-splash/README.md +27 -0
- package/plugins/forgedock-splash/hooks/hooks.json +1 -0
- package/plugins/forgedock-splash/hooks/register.tsx +74 -0
- package/plugins/forgedock-splash/hooks/scene.ts +222 -0
- package/plugins/forgedock-splash/types/index.d.ts +10 -0
- package/pool/README.md +1 -1
- package/pool/image/cs-cred +14 -1
- package/scripts/backfill-finding-labels.mjs +50 -0
- package/scripts/backfill-finding-labels.test.mjs +36 -0
- package/scripts/bench-adversarial.mjs +216 -0
- package/scripts/bench-feature.mjs +170 -0
- package/scripts/bench-lightlane.mjs +2 -2
- package/scripts/bootstrap-create.mjs +2 -2
- package/scripts/bootstrap-validate.mjs +35 -2
- package/scripts/check-spec-size.sh +4 -3
- package/scripts/check-spec-size.test.sh +3 -0
- package/scripts/doctor-pipeline-state.sh +21 -6
- package/scripts/file-deferred-followups.sh +59 -251
- package/scripts/file-deferred-followups.test.sh +85 -206
- package/scripts/followup-route.mjs +12 -0
- package/scripts/owner-route-parity.test.sh +17 -1
- package/scripts/plan-validate-live.mjs +40 -6
- package/scripts/review-pr-side-effects.test.sh +40 -0
- package/scripts/review-pr-staging-scope.test.sh +1 -1
- package/scripts/review-staging-post.sh +23 -0
- package/scripts/review-staging-post.test.sh +8 -0
package/bin/lean/conformance.mjs
CHANGED
|
@@ -69,10 +69,62 @@ const ITEM_PREFIX_RE = /^\s*(?:[-*+]\s+)?(?:\[[ xX]\]\s+)?(?:\d+[.)]\s+)?/;
|
|
|
69
69
|
*/
|
|
70
70
|
export function inIssue(quote, issueText) {
|
|
71
71
|
const q = norm(quote);
|
|
72
|
-
if (q.length >= MIN_QUOTE_CHARS) return norm(issueText).includes(q);
|
|
72
|
+
if (q.length >= MIN_QUOTE_CHARS) return norm(issueText).includes(q) || elidedIn(q, norm(issueText)) || compact(issueText).includes(compact(q));
|
|
73
73
|
if (q.length < 3) return false;
|
|
74
74
|
return String(issueText ?? "").split("\n").some((l) => norm(l.replace(ITEM_PREFIX_RE, "")) === q);
|
|
75
75
|
}
|
|
76
|
+
/** #5244: alphanumerics only, so `SLI_X` retyped as "SLI X" or a dropped punctuation mark still compares equal. */
|
|
77
|
+
const compact = (s) => norm(s).replace(/[^a-z0-9]/g, "");
|
|
78
|
+
/** #5244: a quote shortened with "..." (norm folds the ellipsis char): every segment is in the issue, in order, and one is a full-length quote. */
|
|
79
|
+
function elidedIn(q, issue) {
|
|
80
|
+
if (!q.includes("...")) return false;
|
|
81
|
+
const segs = q.split("...").map((x) => x.trim()).filter(Boolean);
|
|
82
|
+
if (!segs.some((x) => x.length >= MIN_QUOTE_CHARS)) return false;
|
|
83
|
+
let at = 0;
|
|
84
|
+
for (const seg of segs) { const i = issue.indexOf(seg, at); if (i < 0) return false; at = i + seg.length; }
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
const SNAP_MIN = 0.9;
|
|
88
|
+
const tokens = (s) => norm(String(s ?? "").replace(/_/g, " ")).match(/[a-z0-9]+/g) ?? [];
|
|
89
|
+
/**
|
|
90
|
+
* #5244: the issue's exact line or sentence a near-verbatim quote stands for, or null. At least SNAP_MIN of the quote's tokens must be
|
|
91
|
+
* in exactly one line or sentence (the shortest of the best scorers; a rival that is not nested in it makes the match ambiguous).
|
|
92
|
+
*/
|
|
93
|
+
export function snapQuote(quote, issueText) {
|
|
94
|
+
const qt = [...new Set(tokens(quote))];
|
|
95
|
+
if (qt.length < 4) return null;
|
|
96
|
+
const seen = new Set(), cands = [];
|
|
97
|
+
for (const line of String(noComments(String(issueText ?? ""))).split("\n")) {
|
|
98
|
+
const l = line.replace(ITEM_PREFIX_RE, "").trim();
|
|
99
|
+
for (const raw of [l, ...l.split(/(?<=[.!?])\s+/)]) {
|
|
100
|
+
const n = norm(raw);
|
|
101
|
+
if (n.length < MIN_QUOTE_CHARS || seen.has(n)) continue;
|
|
102
|
+
seen.add(n);
|
|
103
|
+
const ct = new Set(tokens(raw));
|
|
104
|
+
cands.push({ raw, n, score: qt.filter((w) => ct.has(w)).length / qt.length });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const ok = cands.filter((c) => c.score >= SNAP_MIN);
|
|
108
|
+
if (!ok.length) return null;
|
|
109
|
+
const top = Math.max(...ok.map((c) => c.score));
|
|
110
|
+
const best = ok.filter((c) => c.score === top).sort((a, b) => a.n.length - b.n.length)[0];
|
|
111
|
+
const rival = ok.some((c) => c !== best && !c.n.includes(best.n) && !best.n.includes(c.n));
|
|
112
|
+
return rival ? null : best.raw;
|
|
113
|
+
}
|
|
114
|
+
/** #5244: replaces each failing requirement quote with the issue line it snaps to (original kept as `requoted`). */
|
|
115
|
+
export function snapQuotes(contract, issueText) {
|
|
116
|
+
const reqs = contract?.requirements;
|
|
117
|
+
if (!Array.isArray(reqs) || issueText == null) return { contract, snapped: [] };
|
|
118
|
+
const snapped = [];
|
|
119
|
+
const requirements = reqs.map((r) => {
|
|
120
|
+
if (!r || typeof r.quote !== "string" || inIssue(r.quote, issueText)) return r;
|
|
121
|
+
const to = snapQuote(r.quote, issueText);
|
|
122
|
+
if (!to || !inIssue(to, issueText)) return r;
|
|
123
|
+
snapped.push({ id: r.id, from: r.quote, to });
|
|
124
|
+
return { ...r, quote: to, requoted: r.quote };
|
|
125
|
+
});
|
|
126
|
+
return { contract: snapped.length ? { ...contract, requirements } : contract, snapped };
|
|
127
|
+
}
|
|
76
128
|
/** #5164: the issue's list or checklist item lines (item marker stripped), or every non-empty line when it has none. */
|
|
77
129
|
export function criterionLines(issueText) {
|
|
78
130
|
const lines = String(noComments(String(issueText ?? ""))).split("\n");
|
|
@@ -136,12 +188,16 @@ export function pathCovers(d, f) {
|
|
|
136
188
|
if (/[*?]/.test(p)) return globRe(p).test(file);
|
|
137
189
|
return p === file;
|
|
138
190
|
}
|
|
191
|
+
/** #5365: explicit coupling map: editing `when` (a deliverable) also puts `also` in scope (a test asserts parity between them). */
|
|
192
|
+
const COUPLED_PATHS = [{ when: "bin/engine/outcome-codes.mjs", also: ["docs/OUTCOME-CODES.md"] }];
|
|
139
193
|
/** The deliverable id that authorizes `f`, "test", "incidental", or null. */
|
|
140
194
|
export function authorizationOf(contract, f) {
|
|
141
195
|
const d = (contract.deliverables ?? []).find((x) => pathCovers(x.path, f));
|
|
142
196
|
if (d) return d.id;
|
|
143
197
|
if (isTestPath(f)) return "test";
|
|
144
198
|
if (isIncidentalPath(f)) return "incidental";
|
|
199
|
+
// #5365: a file a parity test reads alongside a changed deliverable is in scope with it
|
|
200
|
+
if (COUPLED_PATHS.some((c) => c.also.some((g) => pathCovers(g, f)) && (contract.deliverables ?? []).some((x) => pathCovers(x.path, c.when) || pathCovers(c.when, x.path)))) return "coupled";
|
|
145
201
|
return null;
|
|
146
202
|
}
|
|
147
203
|
// A doc a freshness rule can demand: a prose file under a docs directory. Build and dependency files (`requirements.txt`,
|
|
@@ -263,8 +319,8 @@ const TMP_PATH = /\$(?:\{TMPDIR(?::-[^}]*)?\}|TMPDIR)\/([^\s"'`;|&<>()=]+)/g;
|
|
|
263
319
|
* #4325: the `$TMPDIR/<name>` paths a frozen command reads without creating them itself. The run TMPDIR is per run, so such
|
|
264
320
|
* a file (written by the builder before) is gone for the engine's red-green check and for any rerun. A path counts as
|
|
265
321
|
* created when it, or a directory above it, was earlier the target of `>`/`>>`, `tee`, `touch|mkdir|mktemp`, the last
|
|
266
|
-
* argument of `cp|mv|ln|install`, an output-like option (`-o`, `--output`, `--basetemp`, `--junitxml`, `--cache-dir`…)
|
|
267
|
-
* env assignment (`X=$TMPDIR/y`). Returns the read paths in first-use order (deduped), e.g. ["$TMPDIR/req.txt"].
|
|
322
|
+
* argument of `cp|mv|ln|install`, an output-like option (`-o`, `--output`, `--basetemp`, `--junitxml`, `--cache-dir`…), the dir argument of
|
|
323
|
+
* `uv venv`, `virtualenv`, `python[3] -m venv`, `git worktree add` (first) or `git clone` (last), or an env assignment (`X=$TMPDIR/y`). Returns the read paths in first-use order (deduped), e.g. ["$TMPDIR/req.txt"].
|
|
268
324
|
*/
|
|
269
325
|
export function tmpdirInputs(command) {
|
|
270
326
|
const made = [], reads = [];
|
|
@@ -273,6 +329,12 @@ export function tmpdirInputs(command) {
|
|
|
273
329
|
const toks = seg.trim().split(/\s+/).filter(Boolean).map((t) => t.replace(/^["']+|["']+$/g, ""));
|
|
274
330
|
const words = toks.filter((t) => !/^[A-Za-z_]\w*=/.test(t));
|
|
275
331
|
const cmd = (words[0] ?? "").replace(/^.*\//, "");
|
|
332
|
+
// #5230: tools whose positional dir argument they create: the first $TMPDIR token (clone: the last token) is made.
|
|
333
|
+
const makesDir = (cmd === "uv" && words[1] === "venv") || cmd === "virtualenv"
|
|
334
|
+
|| (/^python[\d.]*$/.test(cmd) && words.includes("-m") && words[words.indexOf("-m") + 1] === "venv")
|
|
335
|
+
|| (cmd === "git" && words[1] === "worktree" && words[2] === "add");
|
|
336
|
+
const cloneDir = cmd === "git" && words[1] === "clone";
|
|
337
|
+
const firstTmp = toks.findIndex((t) => /\$(?:\{TMPDIR|TMPDIR)/.test(t));
|
|
276
338
|
toks.forEach((tok, i) => {
|
|
277
339
|
for (const m of tok.matchAll(TMP_PATH)) {
|
|
278
340
|
const path = m[1].replace(/\/+$/, "");
|
|
@@ -281,7 +343,8 @@ export function tmpdirInputs(command) {
|
|
|
281
343
|
const write = /\d*>>?$|&>$/.test(before) || (before === "" && /^(?:\d*>>?|&>)$/.test(prev))
|
|
282
344
|
|| /^[A-Za-z_]\w*=["']?$/.test(before) || (opt !== null && WRITE_OPT.test(opt))
|
|
283
345
|
|| cmd === "tee" || ["touch", "mkdir", "mktemp"].includes(cmd)
|
|
284
|
-
|| (["cp", "mv", "ln", "install"].includes(cmd) && i === toks.length - 1)
|
|
346
|
+
|| (["cp", "mv", "ln", "install"].includes(cmd) && i === toks.length - 1)
|
|
347
|
+
|| (makesDir && i === firstTmp) || (cloneDir && i === toks.length - 1);
|
|
285
348
|
if (write) made.push(path);
|
|
286
349
|
else if (!createdAbove(path) && !reads.includes(`$TMPDIR/${path}`)) reads.push(`$TMPDIR/${path}`);
|
|
287
350
|
}
|
|
@@ -314,6 +377,63 @@ const DROP_AFTER_RE = new RegExp(String.raw`\b${E2E_TERM}${GAP}(?:replaced|dropp
|
|
|
314
377
|
const INSTEAD_OF_RE = new RegExp(String.raw`\b${MOCKED_TERM}[^.;]{0,60}?\b(?:instead of|rather than|in lieu of)\b${GAP}${E2E_TERM}\b`, "i");
|
|
315
378
|
const PROBE_RE = /forge-probe|acceptance[- ]probe/i;
|
|
316
379
|
const NEG_PROBE_RE = /\b(?:no|not|without|never)\b[^.;]{0,30}(?:forge-probe|acceptance[- ]probe)/i;
|
|
380
|
+
/**
|
|
381
|
+
* #5232: a `uv run --no-project --offline` command whose dependencies are a hand-picked `--with` list (no
|
|
382
|
+
* `--with-requirements`) cannot import a project's full dependency set; true for such a command. The environment must come
|
|
383
|
+
* from the repo's lockfile or toolchain (`uv run --with-requirements <export>`, the project runner, forge.yaml validate.recipes).
|
|
384
|
+
*/
|
|
385
|
+
export function guessedUvEnv(command) {
|
|
386
|
+
const c = String(command ?? "");
|
|
387
|
+
return /\buv\s+run\b/.test(c) && /--no-project\b/.test(c) && /--offline\b/.test(c) && /--with(?:\s|=)/.test(c) && !/--with-requirements\b/.test(c);
|
|
388
|
+
}
|
|
389
|
+
const guessedUvProblem = (id) => `${id}: the command builds its environment from a hand-picked \`uv run --offline --no-project --with ...\` list, which cannot import the project's full dependency set (env.repro_unrunnable); derive it from the repo's lockfile or toolchain (\`--with-requirements\` of an export, the project runner, or a forge.yaml validate.recipes entry)`;
|
|
390
|
+
const PROJECT_DIR_RE = /^(?:\.\/)?(.+?)\/?$/;
|
|
391
|
+
const ARG_PATH_LIKE_RE = /\/|\.py(?:::|$)|::/;
|
|
392
|
+
const stripDot = (t) => String(t).replace(PROJECT_DIR_RE, "$1");
|
|
393
|
+
/**
|
|
394
|
+
* #5234: the project dir a segment moves into (`poetry -C D run ...`, `poetry --directory D`, `uv run --project D`, `uv --directory D`)
|
|
395
|
+
* with its token indexes, or null.
|
|
396
|
+
*/
|
|
397
|
+
function projectDirOf(tokens) {
|
|
398
|
+
const runner = tokens.findIndex((t) => t === "poetry" || t === "uv");
|
|
399
|
+
if (runner < 0) return null;
|
|
400
|
+
const flags = tokens[runner] === "poetry" ? ["-C", "--directory"] : ["--project", "--directory"];
|
|
401
|
+
for (let i = runner + 1; i < tokens.length; i++) {
|
|
402
|
+
const t = tokens[i], eq = flags.find((f) => t.startsWith(`${f}=`));
|
|
403
|
+
if (eq) return { dir: stripDot(t.slice(eq.length + 1)), at: [i] };
|
|
404
|
+
if (flags.includes(t) && tokens[i + 1]) return { dir: stripDot(tokens[i + 1]), at: [i, i + 1] };
|
|
405
|
+
}
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* #5234: a frozen command that moves its cwd with `poetry -C D` / `uv run --project D` but names pytest paths relative to the
|
|
410
|
+
* repo root (`D/tests/x.py`), which do not exist from D: pytest exits 4. Returns {dir, paths} (the D-prefixed path args) or null.
|
|
411
|
+
* Pure string check, one runner segment at a time.
|
|
412
|
+
*/
|
|
413
|
+
export function projectDirPathMiss(command) {
|
|
414
|
+
for (const seg of String(command ?? "").split(/&&|\|\||;|\|/)) {
|
|
415
|
+
const tokens = seg.trim().split(/\s+/), pd = projectDirOf(tokens);
|
|
416
|
+
const py = tokens.findIndex((t) => t === "pytest" || t === "py.test");
|
|
417
|
+
if (!pd || py < 0) continue;
|
|
418
|
+
const paths = tokens.slice(py + 1).filter((t) => !t.startsWith("-") && ARG_PATH_LIKE_RE.test(t) && stripDot(t).startsWith(`${pd.dir}/`));
|
|
419
|
+
if (paths.length) return { dir: pd.dir, paths };
|
|
420
|
+
}
|
|
421
|
+
return null;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* #5234: `poetry -C D run pytest D/x.py` -> `cd D && poetry run pytest x.py` (uv: `cd D && uv run pytest x.py`) when the command is
|
|
425
|
+
* one segment and every path-like pytest arg is D-prefixed; any other command comes back unchanged (validateContract rejects it).
|
|
426
|
+
*/
|
|
427
|
+
export function rewriteProjectDirCommand(command) {
|
|
428
|
+
const cmd = String(command ?? "");
|
|
429
|
+
if (/&&|\|\||;|\||[\n'"]/.test(cmd) || !projectDirPathMiss(cmd)) return cmd;
|
|
430
|
+
const tokens = cmd.trim().split(/\s+/), pd = projectDirOf(tokens), py = tokens.findIndex((t) => t === "pytest" || t === "py.test");
|
|
431
|
+
const like = (t) => !t.startsWith("-") && ARG_PATH_LIKE_RE.test(t);
|
|
432
|
+
if (tokens.slice(py + 1).some((t) => like(t) && !stripDot(t).startsWith(`${pd.dir}/`))) return cmd;
|
|
433
|
+
const out = tokens.map((t, i) => (i > py && like(t) ? stripDot(t).slice(pd.dir.length + 1) : t)).filter((_, i) => !pd.at.includes(i));
|
|
434
|
+
return `cd ${pd.dir} && ${out.join(" ")}`;
|
|
435
|
+
}
|
|
436
|
+
const projectDirProblem = (id, m) => `${id}: the command moves its cwd to \`${m.dir}\` (poetry -C / uv --project) but names repo-root-relative paths (${m.paths.map((x) => `\`${x}\``).join(", ")}) that do not exist from there, so pytest exits 4 before any test runs; use \`cd ${m.dir} && poetry run pytest <${m.dir}-relative paths>\` instead`;
|
|
317
437
|
/**
|
|
318
438
|
* #5087: a plan decision whose effect is to drop an e2e/integration check for mocked tests ("no Playwright e2e; integration
|
|
319
439
|
* coverage via route and component tests"). The #4726 rule keys on the `[type:e2e]` tag, which a reworded criterion
|
|
@@ -371,6 +491,9 @@ export function validateContract(c, issueText, { repro = false } = {}) {
|
|
|
371
491
|
const ref = movingBaseDiff(v.command);
|
|
372
492
|
if (ref) problems.push(`${v.id}: \`git diff\` against the moving ${ref} tip fails as soon as the base moves on, even when the change is fine; compare against the merge base instead (\`${ref}...HEAD\` or \`$(git merge-base HEAD ${ref})\`)`);
|
|
373
493
|
for (const p of tmpdirInputs(v.command)) problems.push(tmpInputProblem(v.id, p));
|
|
494
|
+
if (guessedUvEnv(v.command)) problems.push(guessedUvProblem(v.id));
|
|
495
|
+
const pdm = projectDirPathMiss(v.command);
|
|
496
|
+
if (pdm) problems.push(projectDirProblem(v.id, pdm));
|
|
374
497
|
if (vitestQuietFlag(v.command)) problems.push(`${v.id}: vitest 3 rejects -q/--quiet (usage error before any test runs); use --reporter=dot`);
|
|
375
498
|
const syn = shellSyntaxError(v.command);
|
|
376
499
|
if (syn) problems.push(`${v.id}: the command is not valid shell (bash -n: ${syn}); keep notes out of the command`);
|
|
@@ -381,6 +504,9 @@ export function validateContract(c, issueText, { repro = false } = {}) {
|
|
|
381
504
|
else if (!t || typeof t !== "object" || Array.isArray(t) || blank(t.path) || blank(t.command)) problems.push(`this is a bug: repro_test must be {"path","id","command"} (a test that fails on the base and passes after the fix) or "none" with a repro_test_reason`);
|
|
382
505
|
else {
|
|
383
506
|
for (const p of tmpdirInputs(t.command)) problems.push(tmpInputProblem("repro_test", p));
|
|
507
|
+
if (guessedUvEnv(t.command)) problems.push(guessedUvProblem("repro_test"));
|
|
508
|
+
const pdr = projectDirPathMiss(t.command);
|
|
509
|
+
if (pdr) problems.push(projectDirProblem("repro_test", pdr));
|
|
384
510
|
if (vitestQuietFlag(t.command)) problems.push("repro_test: vitest 3 rejects -q/--quiet; use --reporter=dot");
|
|
385
511
|
const syn = shellSyntaxError(t.command);
|
|
386
512
|
if (syn) problems.push(`repro_test: the command is not valid shell (bash -n: ${syn})`);
|
|
@@ -529,9 +655,18 @@ export function applyAmendments(frozen, amendments, issueText = null, { generate
|
|
|
529
655
|
applied.push({ kind: a.kind, target: r.id, why: String(a.why).trim() });
|
|
530
656
|
continue;
|
|
531
657
|
} else if (a.kind === "add-requirement" && a.requirement?.id && !blank(a.requirement?.quote)) {
|
|
532
|
-
if (c.requirements.some((r) => r.id === a.requirement.id)) {
|
|
533
|
-
|
|
534
|
-
|
|
658
|
+
if (c.requirements.some((r) => r.id === a.requirement.id)) {
|
|
659
|
+
// #5365: a taken id is renumbered to the next free R<n>, never a failure; the remap is recorded in `applied`
|
|
660
|
+
const was = a.requirement.id, free = `R${Math.max(0, ...c.requirements.map((r) => Number(/^R(\d+)$/.exec(String(r.id))?.[1] ?? 0))) + 1}`;
|
|
661
|
+
a = { ...a, requirement: { ...a.requirement, id: free } };
|
|
662
|
+
applied.push({ kind: "add-requirement", target: `${was} -> ${free}`, why: `id ${was} already in the contract; renumbered to ${free}` });
|
|
663
|
+
}
|
|
664
|
+
let snapTo = null;
|
|
665
|
+
if (issueText != null && !inIssue(a.requirement.quote, issueText)) {
|
|
666
|
+
snapTo = snapQuote(a.requirement.quote, issueText);
|
|
667
|
+
if (!snapTo) { problems.push(`add-requirement ${a.requirement.id}: quote is not verbatim from the issue`); continue; }
|
|
668
|
+
}
|
|
669
|
+
const r = { disposition: "deliver", ...a.requirement, ...(snapTo ? { quote: snapTo, requoted: a.requirement.quote } : {}), amended: true };
|
|
535
670
|
if (!DISPOSITIONS.includes(r.disposition)) { problems.push(`add-requirement ${r.id}: bad disposition ${r.disposition}`); continue; }
|
|
536
671
|
if (TRACKED.includes(r.disposition) && blank(r.why)) r.why = a.why;
|
|
537
672
|
if (tagsOutOfBand(r)) r.verify = "out_of_band"; // #4404: same freeze-time tag as the planned requirements
|
|
@@ -595,6 +730,24 @@ const PY_MISSING_RE = /ModuleNotFoundError: No module named '([^']+)'|ImportErro
|
|
|
595
730
|
const NODE_MISSING_RE = /Cannot find (?:module|package) '([^']+)'/;
|
|
596
731
|
const POETRY_NOT_FOUND_RE = /^\s*Command not found: (\S+)/m;
|
|
597
732
|
const CMD_NOT_FOUND_RE = /([^\s:'"`]+): command not found/, SH_NOT_FOUND_RE = /([^\s:'"`]+): not found\b/;
|
|
733
|
+
// #5371: exit-1 failures that are the executor's environment (no Docker daemon, a bind-mount source that is absent where the step runs,
|
|
734
|
+
// no Playwright browser, no network for npm), never a failing assertion of the change
|
|
735
|
+
const ENV_SIGNATURES = [
|
|
736
|
+
[/Cannot connect to the Docker daemon|docker\.sock|error during connect|Is the docker daemon running/i, "Docker daemon"],
|
|
737
|
+
[/invalid mount config for type "bind"|bind source path does not exist|error while creating mount source path|mounts denied/i, "Docker bind-mount source"],
|
|
738
|
+
[/Executable doesn't exist at|npx playwright install|browserType\.launch: Executable/i, "Playwright browser"],
|
|
739
|
+
[/\bENOTFOUND\b|\bEAI_AGAIN\b|npm (?:ERR!|error) network|getaddrinfo (?:ENOTFOUND|EAI_AGAIN)/i, "network access for npm"],
|
|
740
|
+
];
|
|
741
|
+
const envSignature = (out) => { const hit = ENV_SIGNATURES.find(([re]) => re.test(out)); return hit ? { tool: hit[1], kind: "environment" } : null; };
|
|
742
|
+
const SECRET_PAIR_RE = /\b([A-Za-z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASSWD|API_?KEY|CREDENTIAL)[A-Za-z0-9_]*\s*[=:]\s*)\S+/gi;
|
|
743
|
+
const SECRET_SHAPE_RE = /\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|sk-[A-Za-z0-9_-]{20,}|xox[baprs]-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16})\b|Bearer\s+[A-Za-z0-9._~+/=-]{12,}/g;
|
|
744
|
+
/** #5371: the last `lines` lines of a command's output with secret-looking values redacted, as an indented block for a failure detail ("" when empty). */
|
|
745
|
+
export function outputTail(output, lines = 40) {
|
|
746
|
+
const t = String(output ?? "").replace(/\x1b\[[0-9;]*[A-Za-z]/g, "").split("\n").map((l) => l.trimEnd());
|
|
747
|
+
while (t.length && !t[t.length - 1]) t.pop();
|
|
748
|
+
const tail = t.slice(-lines).join("\n").replace(SECRET_PAIR_RE, "$1[redacted]").replace(SECRET_SHAPE_RE, "[redacted]").slice(-4000);
|
|
749
|
+
return tail ? `\n output tail (last ${Math.min(lines, t.length)} lines):\n${tail.split("\n").map((l) => ` ${l}`).join("\n")}` : "";
|
|
750
|
+
}
|
|
598
751
|
/** #4857: why a command is not valid bash (`bash -n`), or null when it parses (or bash is unavailable). Catches prose left on a command. */
|
|
599
752
|
export function shellSyntaxError(command) {
|
|
600
753
|
const r = spawnSync("bash", ["-n", "-c", String(command ?? "")], { encoding: "utf8", timeout: 5000 });
|
|
@@ -677,7 +830,7 @@ export function noopCommand(command) {
|
|
|
677
830
|
*/
|
|
678
831
|
export function substituteVerdict(run, { repoHas = () => false, command = "" } = {}) {
|
|
679
832
|
if (!run) return "unverified";
|
|
680
|
-
if (run.rc === 0 || run.rc === 127 || unrunnableValidate(run) || cliUsageError(run) || missingTool(run, { repoHas, command })) return "ok";
|
|
833
|
+
if (run.rc === 0 || run.rc === 127 || unrunnableValidate(run, command) || cliUsageError(run) || missingTool(run, { repoHas, command })) return "ok";
|
|
681
834
|
return run.rc === 124 ? "timeout" : "runs";
|
|
682
835
|
}
|
|
683
836
|
/**
|
|
@@ -715,9 +868,11 @@ export async function removedPathsOf(git, base) {
|
|
|
715
868
|
}
|
|
716
869
|
return gone;
|
|
717
870
|
}
|
|
718
|
-
const UNRUNNABLE_RE = /no tests ran|collected 0 items|no tests found|could not find (?:the )?pyproject|poetry could not find|syntax error near|unexpected EOF while looking/i;
|
|
871
|
+
const UNRUNNABLE_RE = /ERROR: file or directory not found|ERROR: not found:|no tests ran|collected 0 items|no tests found|could not find (?:the )?pyproject|poetry could not find|syntax error near|unexpected EOF while looking/i;
|
|
719
872
|
/** #4857: a failed rerun that died before any test ran (no tests selected, no project at the cwd, invalid shell): a defect of the frozen command. */
|
|
720
|
-
export function unrunnableValidate({ rc, output } = {}) {
|
|
873
|
+
export function unrunnableValidate({ rc, output } = {}, command = "") {
|
|
874
|
+
// #5234: pytest's own exit 4 (usage error, path not found) and 5 (no tests collected) are never a test failure
|
|
875
|
+
if ((rc === 4 || rc === 5) && /\b(?:py\.?test|pytest)\b/.test(String(command ?? ""))) return true;
|
|
721
876
|
return rc !== 0 && rc !== 124 && UNRUNNABLE_RE.test(String(output ?? ""));
|
|
722
877
|
}
|
|
723
878
|
const BLOCK_VALIDATE_RE = /\b(?:V\d+|validate|repro)\b/i;
|
|
@@ -754,7 +909,7 @@ export function resolveForgedockPaths(command, { exists = () => true, checksCli,
|
|
|
754
909
|
return here && !exists(tok) ? here : tok;
|
|
755
910
|
});
|
|
756
911
|
}
|
|
757
|
-
const KIND_NAME = { command: "command", "python-module": "Python module", "node-module": "Node package" };
|
|
912
|
+
const KIND_NAME = { command: "command", "python-module": "Python module", "node-module": "Node package", environment: "environment service" };
|
|
758
913
|
/**
|
|
759
914
|
* forge#4323: the host tool or module a failed command could not find, from its {rc, output}: bash/sh "X: command not found"
|
|
760
915
|
* (or rc 127), python "No module named x" (top-level package), node "Cannot find module|package 'x'" (bare specifiers only).
|
|
@@ -777,7 +932,7 @@ export function missingTool({ rc, output } = {}, { repoHas = () => false, comman
|
|
|
777
932
|
const po = POETRY_NOT_FOUND_RE.exec(out)?.[1]; // #5020: `poetry run pytest` in an env that was never installed
|
|
778
933
|
if (po) return local(po) ? null : { tool: po, kind: "command" };
|
|
779
934
|
const cmd = CMD_NOT_FOUND_RE.exec(out)?.[1] ?? (rc === 127 ? SH_NOT_FOUND_RE.exec(out)?.[1] ?? String(command).trim().split(/\s+/)[0] : null);
|
|
780
|
-
if (!cmd || cmd.includes("/") || local(cmd)) return
|
|
935
|
+
if (!cmd || cmd.includes("/") || local(cmd)) return envSignature(out); // #5371
|
|
781
936
|
return { tool: cmd, kind: "command" };
|
|
782
937
|
}
|
|
783
938
|
|
|
@@ -803,7 +958,7 @@ export function repoTracks(paths) {
|
|
|
803
958
|
* `ciCovered` (#4527): the validate ids accepted only because the head is CI-verified (no local result, or a missing host
|
|
804
959
|
* tool), for the trajectory; always an array.
|
|
805
960
|
*/
|
|
806
|
-
export function precheck({ contract, result, changedFiles, ignore = [], ciVerified = false, hotspots = null, repro = null, validateRuns = null, repoHas = () => false, frozen = null, checkIds = null, guardFailures = null, coupledFailures = null, routeFailures = null, newOffKeys = null, substitutedRuns = null, removedPaths = [], baseFiles = [] }) {
|
|
961
|
+
export function precheck({ contract, result, changedFiles, ignore = [], ciVerified = false, hotspots = null, repro = null, validateRuns = null, repoHas = () => false, frozen = null, checkIds = null, guardFailures = null, coupledFailures = null, relaxationFailures = null, routeFailures = null, prodParityFailures = null, newOffKeys = null, substitutedRuns = null, removedPaths = [], baseFiles = [], uiBrowser = null }) {
|
|
807
962
|
const failures = [], superseded = [], ciCovered = [];
|
|
808
963
|
// #4626: a post-deploy check id must be on the default branch or added by this PR (`checkIds`: ids of both checks files; null = not resolved)
|
|
809
964
|
if (checkIds) for (const r of contract.requirements ?? []) {
|
|
@@ -811,6 +966,8 @@ export function precheck({ contract, result, changedFiles, ignore = [], ciVerifi
|
|
|
811
966
|
}
|
|
812
967
|
// #4769: a default-off rollout entry added by the diff needs an activation row
|
|
813
968
|
if (newOffKeys?.length) for (const f of activationFailures(contract, newOffKeys)) failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, ...f });
|
|
969
|
+
// #5285: interactive UI changed on a high-risk surface with no real-browser check configured: a recorded skip that blocks
|
|
970
|
+
if (uiBrowser?.files?.length && uiBrowser.highRisk && !uiBrowser.ran) failures.push({ code: C.CONFORMANCE_E2E_UNVERIFIED, kind: "ui_browser_unverified", detail: `interactive UI changed (${uiBrowser.files.slice(0, 5).join(", ")}) on a high-risk surface but no real-browser check runs (${uiBrowser.reason}); configure verify.e2e_label/e2e_workflow or add a Playwright spec` });
|
|
814
971
|
const outside = (k) => changedFiles.filter((f) => !ignore.some((p) => f.startsWith(p)) && !authorizationOf(k, f));
|
|
815
972
|
const creep = outside(contract);
|
|
816
973
|
const amendedOnly = frozenAmendedFiles(frozen, contract, outside, creep);
|
|
@@ -827,7 +984,7 @@ export function precheck({ contract, result, changedFiles, ignore = [], ciVerifi
|
|
|
827
984
|
const verdict = substituteVerdict(substitutedRuns?.[v.id], { repoHas, command: v.substituted.from });
|
|
828
985
|
const from = `validate ${v.id} substituted \`${v.command}\` for the frozen \`${v.substituted.from}\``;
|
|
829
986
|
if (verdict === "unverified") { failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "substitute_unverified", detail: `${from}, but the engine has no rerun of the frozen command to show it cannot run` }); continue; }
|
|
830
|
-
if (verdict === "runs") { failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "validate_failed", detail: `${from}, but the frozen command runs and fails (exit ${substitutedRuns[v.id].rc}): a substitute-validate replaces only a command that cannot run, never a failing check` }); continue; }
|
|
987
|
+
if (verdict === "runs") { failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "validate_failed", detail: `${from}, but the frozen command runs and fails (exit ${substitutedRuns[v.id].rc}): a substitute-validate replaces only a command that cannot run, never a failing check${outputTail(substitutedRuns[v.id].output)}` }); continue; }
|
|
831
988
|
if (verdict === "timeout" && !ciVerified) { failures.push({ code: ENV_VALIDATE_TIMEOUT, kind: "validate_timeout", detail: `${from}, and the frozen command timed out (exit 124) on the engine's rerun, so its substitution cannot be judged: infrastructure (host load)` }); continue; }
|
|
832
989
|
}
|
|
833
990
|
const r = runs.find((x) => x?.id === v.id);
|
|
@@ -839,7 +996,7 @@ export function precheck({ contract, result, changedFiles, ignore = [], ciVerifi
|
|
|
839
996
|
const rerun = validateRuns?.[v.id];
|
|
840
997
|
if (rerun?.rc === 0) continue;
|
|
841
998
|
if (rerun && cliUsageError(rerun)) { failures.push({ code: C.CONTRACT_INVALID_COMMAND, kind: "validate_command_invalid", detail: `validate ${v.id} (\`${v.command}\`) is a CLI usage error of the runner, a defect of the frozen command rather than of the change` }); continue; }
|
|
842
|
-
if (rerun && unrunnableValidate(rerun)) { failures.push({ code: C.CONTRACT_INVALID_COMMAND, kind: "validate_command_invalid", detail: `validate ${v.id} (\`${v.command}\`) died before any test ran (no tests selected, no project at its cwd or invalid shell), a defect of the frozen command rather than of the change; substitute a runnable equivalent with a substitute-validate amendment` }); continue; }
|
|
999
|
+
if (rerun && unrunnableValidate(rerun, v.command)) { failures.push({ code: C.CONTRACT_INVALID_COMMAND, kind: "validate_command_invalid", detail: `validate ${v.id} (\`${v.command}\`) died before any test ran (no tests selected, no project at its cwd or invalid shell), a defect of the frozen command rather than of the change; substitute a runnable equivalent with a substitute-validate amendment` }); continue; }
|
|
843
1000
|
// #4906: the rerun timed out (even after the longer retry): host load, not a verdict on the change. A CI-verified head covers it; else an environment error.
|
|
844
1001
|
if (rerun?.rc === 124) {
|
|
845
1002
|
if (ciVerified) { ciCovered.push(v.id); continue; }
|
|
@@ -848,9 +1005,9 @@ export function precheck({ contract, result, changedFiles, ignore = [], ciVerifi
|
|
|
848
1005
|
}
|
|
849
1006
|
const miss = rerun ? missingTool(rerun, { repoHas, command: v.command }) : null;
|
|
850
1007
|
if (miss && ciVerified) { ciCovered.push(v.id); continue; }
|
|
851
|
-
if (miss) failures.push({ code: C.ENV_TOOL_MISSING, kind: "validate_env", tool: miss.tool, detail: `validate ${v.id} (\`${v.command}\`) could not run: the host is missing ${KIND_NAME[miss.kind]} '${miss.tool}' (environment, not the change)` });
|
|
1008
|
+
if (miss) failures.push({ code: C.ENV_TOOL_MISSING, kind: "validate_env", tool: miss.tool, detail: `validate ${v.id} (\`${v.command}\`) could not run: the host is missing ${KIND_NAME[miss.kind]} '${miss.tool}' (environment, not the change)${outputTail(rerun.output)}` });
|
|
852
1009
|
else if (amendedOnly && isScopeCheck(v.command)) superseded.push({ id: v.id, files: amendedOnly });
|
|
853
|
-
else failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "validate_failed", detail: `validate ${v.id} (\`${v.command}\`) failed (exit ${r.exit})` });
|
|
1010
|
+
else failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "validate_failed", detail: `validate ${v.id} (\`${v.command}\`) failed (exit ${r.exit})${outputTail(rerun?.output)}` });
|
|
854
1011
|
}
|
|
855
1012
|
}
|
|
856
1013
|
const st = Array.isArray(result?.requirements) ? result.requirements : [];
|
|
@@ -873,7 +1030,9 @@ export function precheck({ contract, result, changedFiles, ignore = [], ciVerifi
|
|
|
873
1030
|
const retired = new Set((contract.supersedes ?? []).map((s) => s.guard));
|
|
874
1031
|
for (const f of guardFailures ?? []) if (!retired.has(f.guard)) failures.push(f);
|
|
875
1032
|
for (const f of coupledFailures ?? []) failures.push(f); // #5079
|
|
1033
|
+
for (const f of relaxationFailures ?? []) failures.push(f); // #5237
|
|
876
1034
|
failures.push(...(routeFailures ?? [])); // #5087: topology.route_reachability, blocking when declared
|
|
1035
|
+
failures.push(...(prodParityFailures ?? [])); // #5284: topology.prod_parity
|
|
877
1036
|
return { ok: failures.length === 0, failures, superseded, ciCovered };
|
|
878
1037
|
}
|
|
879
1038
|
|
|
@@ -1034,10 +1193,13 @@ export function evidencePathOnly(problems = []) {
|
|
|
1034
1193
|
}
|
|
1035
1194
|
/**
|
|
1036
1195
|
* #5164: true when every problem of an incomplete review is a reviewer slip a targeted re-ask can fix: an evidence path that
|
|
1037
|
-
* did not resolve (#4327) or an issue_coverage misquote.
|
|
1196
|
+
* did not resolve (#4327) or an issue_coverage misquote. #5345: so is any single missing or invalid row (requirement, preserve,
|
|
1197
|
+
* scope, issue_coverage, verdict): the reply is repaired in place for those ids, never a new review round. A whole absent
|
|
1198
|
+
* `requirements` section is not a slip: it keeps the two-run limit. A real coverage gap is a failure, not an incompleteness.
|
|
1038
1199
|
*/
|
|
1200
|
+
const ROW_GAP_RE = /needs exactly one row|status invalid|needs deferral_ok|needs instrumented|needs path:line evidence|needs validated_by|has no scope row|needs a row with status|issue_coverage is missing or empty|verdict must be|regressions must be/;
|
|
1039
1201
|
export function reaskable(problems = []) {
|
|
1040
|
-
return problems.length > 0 && problems.every((p) => MISSING_PATH_RE.test(String(p)) || String(p).startsWith(MISQUOTE_PREFIX));
|
|
1202
|
+
return problems.length > 0 && problems.every((p) => MISSING_PATH_RE.test(String(p)) || String(p).startsWith(MISQUOTE_PREFIX) || ROW_GAP_RE.test(String(p)));
|
|
1041
1203
|
}
|
|
1042
1204
|
const reviewedFiles = (changedFiles, ignore) => changedFiles.filter((x) => !ignore.some((pre) => x.startsWith(pre)));
|
|
1043
1205
|
|
|
@@ -1120,8 +1282,10 @@ export function checkCompleteness(rv, { contract, changedFiles, issueText, pathE
|
|
|
1120
1282
|
}
|
|
1121
1283
|
|
|
1122
1284
|
|
|
1123
|
-
/** #4726: a requirement quote that carries a `[type:e2e]` criterion. */
|
|
1124
|
-
const wantsE2e = (r) => /\[type:e2e\]/i.test(String(r?.quote ?? ""));
|
|
1285
|
+
/** #4726, #5339: a requirement quote that carries a `[type:e2e]` or `[type:manual]` criterion. */
|
|
1286
|
+
const wantsE2e = (r) => /\[type:(?:e2e|manual)\]/i.test(String(r?.quote ?? ""));
|
|
1287
|
+
/** #5339: failure kinds enforced without an `engine.conformance_kinds` entry (the entry still overrides). */
|
|
1288
|
+
const DEFAULT_ENFORCED_KINDS = ["e2e_row"];
|
|
1125
1289
|
const E2E_CMD_RE = /\b(?:playwright|cypress|e2e|live[- ]stack|wdio)\b/i;
|
|
1126
1290
|
/**
|
|
1127
1291
|
* #4726: whether a validate command runs a real end-to-end check: an entry of `verify.e2e_checks`, a file of the e2e spec set
|
|
@@ -1130,6 +1294,7 @@ const E2E_CMD_RE = /\b(?:playwright|cypress|e2e|live[- ]stack|wdio)\b/i;
|
|
|
1130
1294
|
export function isE2eCommand(command, e2e = null) {
|
|
1131
1295
|
const cmd = String(command ?? "");
|
|
1132
1296
|
if ((e2e?.checks ?? []).some((c) => c && cmd.includes(c))) return true;
|
|
1297
|
+
if ((e2e?.faked ?? []).some((f) => f && cmd.includes(f))) return false; // #5339: names a test that fakes the real path
|
|
1133
1298
|
if (typeof e2e?.isSpec === "function" && cmd.split(/\s+/).some((t) => t && e2e.isSpec(t.replace(/^["']+|["']+$/g, "")))) return true;
|
|
1134
1299
|
return E2E_CMD_RE.test(cmd);
|
|
1135
1300
|
}
|
|
@@ -1149,7 +1314,7 @@ export function decide(raw, ctx) {
|
|
|
1149
1314
|
const rv = fillEngineRows(raw, ctx);
|
|
1150
1315
|
const comp = checkCompleteness(rv, ctx);
|
|
1151
1316
|
if (!comp.complete) return { state: "review.incomplete", failures: comp.problems.map((d) => ({ code: C.REVIEW_INCOMPLETE, detail: d })), missing: comp.missing, review: rv };
|
|
1152
|
-
const f = [];
|
|
1317
|
+
const f = [], converted = [];
|
|
1153
1318
|
const amendedOf = (ids) => (ctx.contract.requirements ?? []).find((r) => r.amendment?.text && (ids ?? []).includes(r.id));
|
|
1154
1319
|
const notAccepted = (r) => (r ? `amendment not accepted (${r.id} amended to "${String(r.amendment.text).slice(0, 200)}"): ` : "");
|
|
1155
1320
|
for (const c of rv.issue_coverage) if (c.status !== "covered") f.push({ code: C.CONFORMANCE_OMISSION, detail: `${notAccepted(amendedOf(c.contract_ids))}issue requirement ${c.status}: "${c.quote}"${c.note ? ` (${c.note})` : ""}` });
|
|
@@ -1161,22 +1326,29 @@ export function decide(raw, ctx) {
|
|
|
1161
1326
|
} else if (r.disposition === "deliver" && row.status !== "implemented") {
|
|
1162
1327
|
f.push({ code: ["deferred", "post-deploy"].includes(row.status) ? C.CONFORMANCE_UNTRACKED_DEFERRAL : C.CONFORMANCE_UNIMPLEMENTED, detail: `${r.amendment?.text ? `${r.id} amendment not accepted (amended to "${String(r.amendment.text).slice(0, 200)}"): ` : `${r.id} `}${row.status}${row.note ? `: ${row.note}` : ""}${row.evidence ? ` (${row.evidence})` : ""}` });
|
|
1163
1328
|
} else if (r.disposition === "deliver" && wantsE2e(r) && !e2eVerified(row, ctx.contract, ctx.e2e)) {
|
|
1164
|
-
|
|
1329
|
+
const faked = (ctx.e2e?.faked ?? []).length ? `; faked or mocked components in ${ctx.e2e.faked.slice(0, 3).join(", ")}` : "";
|
|
1330
|
+
f.push({ code: C.CONFORMANCE_E2E_UNVERIFIED, kind: "e2e_row", detail: `${r.id} is a [type:e2e]/[type:manual] criterion but ${row.validated_by || "its validated_by"} is not a real end-to-end check (the repo's e2e set, Playwright/browser/live stack${faked}); run one, or mark ${r.id} post-deploy so it is transferred to the epic's acceptance` });
|
|
1331
|
+
} else if (r.disposition === "defer" && wantsE2e(r)) {
|
|
1332
|
+
// #5339: a deferred e2e/manual requirement is not met; only a post-deploy one is transferred to the epic (the lane closes partial)
|
|
1333
|
+
f.push({ code: C.CONFORMANCE_E2E_UNVERIFIED, kind: "e2e_row", detail: `${r.id} is a [type:e2e]/[type:manual] criterion deferred without a run; run the real path, or mark ${r.id} post-deploy so it is transferred to the epic's acceptance` });
|
|
1165
1334
|
}
|
|
1166
|
-
|
|
1335
|
+
// #5207: in-lane engineering work is never deferrable, whatever the reviewer says; one failure per row.
|
|
1336
|
+
if (TRACKED.includes(r.disposition) && row.status === "implemented" && (inLaneDeferral(r) || row.deferral_ok === false)) converted.push({ id: r.id, evidence: String(row.evidence ?? "") }); // #5365: delivered in the diff
|
|
1337
|
+
else if (inLaneDeferral(r)) f.push({ code: C.CONFORMANCE_UNJUSTIFIED_DEFERRAL, detail: `${r.id} is in-lane engineering work (bucket ${r.bucket ?? "none"}): deliver it (amend-requirement to deliver); only post-deploy, owner and external items may be deferred (#5207)` });
|
|
1338
|
+
else if (TRACKED.includes(r.disposition) && row.deferral_ok === false) f.push({ code: C.CONFORMANCE_UNJUSTIFIED_DEFERRAL, detail: `${r.id} ${r.disposition} is not justified${row.note ? `: ${row.note}` : ""}; implement it` });
|
|
1167
1339
|
}
|
|
1168
1340
|
for (const s of rv.scope) {
|
|
1169
1341
|
if (!blank(s.authorized_by)) continue;
|
|
1170
1342
|
const engine = authorizationOf(ctx.contract, s.file);
|
|
1171
|
-
if (engine === "test" || engine === "incidental") continue; // always allowed; a reviewer "none" here is a misreading, not creep
|
|
1343
|
+
if (engine === "test" || engine === "incidental" || engine === "coupled") continue; // always allowed; a reviewer "none" here is a misreading, not creep
|
|
1172
1344
|
f.push({ code: C.CONFORMANCE_SCOPE_CREEP, detail: `${s.file}: ${s.note || "not authorized by the contract"}` });
|
|
1173
1345
|
}
|
|
1174
1346
|
for (const p of rv.preserve ?? []) if (p.status !== "intact") f.push({ code: C.CONFORMANCE_PRESERVE_VIOLATED, detail: `${p.id} ${p.status}${p.evidence ? ` (${p.evidence})` : ""}${p.note ? `: ${p.note}` : ""}` });
|
|
1175
1347
|
for (const r of rv.regressions ?? []) f.push({ code: C.CONFORMANCE_REGRESSION, detail: `${r?.at ?? "?"}: ${r?.failure ?? ""}` });
|
|
1176
|
-
if (f.length) return { state: "nonconforming", failures: f, inconsistent: rv.verdict === "CONFORMS", review: rv };
|
|
1348
|
+
if (f.length) return { state: "nonconforming", failures: f, inconsistent: rv.verdict === "CONFORMS", review: rv, converted };
|
|
1177
1349
|
// A NONCONFORMING verdict with every row passing gives the builder nothing to fix: re-ask the reviewer.
|
|
1178
1350
|
if (rv.verdict !== "CONFORMS") return { state: "review.inconsistent", failures: [{ code: C.REVIEW_INCONSISTENT, detail: "verdict NONCONFORMING with no failing row" }], missing: ["verdict"], review: rv };
|
|
1179
|
-
return { state: "conforms", failures: [], review: rv };
|
|
1351
|
+
return { state: "conforms", failures: [], review: rv, converted };
|
|
1180
1352
|
}
|
|
1181
1353
|
|
|
1182
1354
|
/** The ids (or sections) a targeted re-ask must fill: requirement ids without a valid row, issue_coverage problems, ...; [] when complete. */
|
|
@@ -1224,7 +1396,17 @@ export function reviewSkeleton(contract, changedFiles = [], ignore = []) {
|
|
|
1224
1396
|
}
|
|
1225
1397
|
|
|
1226
1398
|
/** Requirements the reviewer accepted as deferred or post-deploy that still need a tracking issue. */
|
|
1227
|
-
|
|
1399
|
+
/** #5365: flips the requirements `converted` names (decide) to deliver, keeping the original row in amended_from; returns a new contract. */
|
|
1400
|
+
export function convertDelivered(contract, converted) {
|
|
1401
|
+
const by = new Map((converted ?? []).map((x) => [x.id, x.evidence]));
|
|
1402
|
+
return { ...contract, requirements: (contract.requirements ?? []).map((r) => {
|
|
1403
|
+
if (!by.has(r.id) || !TRACKED.includes(r.disposition)) return r;
|
|
1404
|
+
const { bucket, why, check, tracked, class: cls, ...rest } = r;
|
|
1405
|
+
return { ...rest, disposition: "deliver", amended: true, amended_from: r.amended_from ?? Object.fromEntries(["quote", "disposition", "why", "bucket", "check", "tracked", "class"].filter((k) => r[k] != null).map((k) => [k, r[k]])), amendment: { text: `delivered in the diff (${by.get(r.id) || "reviewer evidence"})`, why: "reviewer found the deferred requirement delivered" } };
|
|
1406
|
+
}) };
|
|
1407
|
+
}
|
|
1408
|
+
/** #5207: in-lane engineering deferrals are never filed (decide() sends them back to the builder). */
|
|
1409
|
+
export const pendingTracking = (contract) => (contract.requirements ?? []).filter((r) => TRACKED.includes(r.disposition) && !r.tracked && !inLaneDeferral(r));
|
|
1228
1410
|
|
|
1229
1411
|
/** #4398: an `investigate(` (or `investigate:`) issue, whose stated question must be answered before it closes as completed. */
|
|
1230
1412
|
export const isInvestigation = (title) => /^\s*investigate[(:]/i.test(String(title ?? ""));
|
|
@@ -1234,16 +1416,48 @@ export const isInvestigation = (title) => /^\s*investigate[(:]/i.test(String(tit
|
|
|
1234
1416
|
* post-deploy requirement, or a deliver requirement whose review row is not implemented, closes "partial" instead; `open`
|
|
1235
1417
|
* holds those requirements (the open question, carried forward). A null review (reviewer skipped) judges dispositions only.
|
|
1236
1418
|
*/
|
|
1237
|
-
export function closePlan(contract, { title = null, review = null } = {}) {
|
|
1419
|
+
export function closePlan(contract, { title = null, review = null, issueText = null, liveBlocks = [] } = {}) {
|
|
1238
1420
|
const reqs = contract.requirements ?? [];
|
|
1239
1421
|
const tracked = [...new Set(reqs.filter((r) => TRACKED.includes(r.disposition)).map((r) => r.tracked).filter(Boolean))];
|
|
1240
|
-
|
|
1422
|
+
// #5339: an e2e/manual requirement that was not run in the lane is transferred to the epic, not met: the issue stays partial
|
|
1423
|
+
const transferred = reqs.filter((r) => r.disposition === "post-deploy" && wantsE2e(r));
|
|
1424
|
+
// #5285: a default-on change whose live acceptance is deferred is not closed as completed; #5382: it still transfers its e2e/manual rows
|
|
1425
|
+
if (liveBlocks.length) {
|
|
1426
|
+
const live = reqs.filter((r) => liveBlocks.some((b) => b.id === r.id));
|
|
1427
|
+
return { reason: "partial", tracked, liveBlocked: true, blocks: liveBlocks, open: live, ...(transferred.length ? { transferred: true, transfer: transferred } : {}) };
|
|
1428
|
+
}
|
|
1429
|
+
if (transferred.length) return { reason: "partial", tracked, transferred: true, open: transferred };
|
|
1241
1430
|
const rows = Array.isArray(review?.requirements) ? review.requirements : null;
|
|
1431
|
+
if (!isInvestigation(title)) {
|
|
1432
|
+
const unticked = unmetChecklist(reqs, rows, issueText);
|
|
1433
|
+
return unticked.length ? { reason: "partial", tracked, checklist: true, open: unticked.map((u) => u.req), unticked: unticked.map((u) => u.item) } : { reason: "completed", tracked };
|
|
1434
|
+
}
|
|
1242
1435
|
const open = reqs.filter((r) => TRACKED.includes(r.disposition)
|
|
1243
1436
|
|| (r.disposition === "deliver" && rows && rows.find((x) => x?.id === r.id)?.status !== "implemented"));
|
|
1244
1437
|
return open.length ? { reason: "partial", tracked, open } : { reason: "completed", tracked };
|
|
1245
1438
|
}
|
|
1246
1439
|
|
|
1440
|
+
const UNTICKED_RE = /^\s*[-*+]\s+\[ \]\s+(.+?)\s*$/;
|
|
1441
|
+
/**
|
|
1442
|
+
* #5240: the issue's unticked `- [ ]` acceptance items whose requirement is not settled: a deliver row the review did not mark
|
|
1443
|
+
* implemented, or a defer/post-deploy row with no tracking issue. An item no contract quote matches is not judged here (the
|
|
1444
|
+
* reviewer's issue_coverage gate owns coverage), and a skipped review (null rows) judges dispositions only.
|
|
1445
|
+
*/
|
|
1446
|
+
function unmetChecklist(reqs, rows, issueText) {
|
|
1447
|
+
if (!issueText) return [];
|
|
1448
|
+
const out = [];
|
|
1449
|
+
for (const line of String(noComments(String(issueText))).split("\n")) {
|
|
1450
|
+
const item = UNTICKED_RE.exec(line)?.[1];
|
|
1451
|
+
if (!item) continue;
|
|
1452
|
+
const req = reqs.find((r) => r?.quote && matchCriterion(String(r.quote).replace(ITEM_PREFIX_RE, ""), item) !== null);
|
|
1453
|
+
if (!req) continue;
|
|
1454
|
+
const unmet = TRACKED.includes(req.disposition) ? !req.tracked
|
|
1455
|
+
: req.disposition === "deliver" && rows && rows.find((x) => x?.id === req.id)?.status !== "implemented";
|
|
1456
|
+
if (unmet) out.push({ item, req });
|
|
1457
|
+
}
|
|
1458
|
+
return out;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1247
1461
|
const UNUSABLE_REVIEW = ["review.incomplete", "review.inconsistent", "review.unparseable"];
|
|
1248
1462
|
/**
|
|
1249
1463
|
* #4398 batch-report line from the lane rows' `conformance` ({mode, would, risk}): shadow lanes, how many the enforced
|
|
@@ -1264,8 +1478,8 @@ export function formatShadowSummary(rows) {
|
|
|
1264
1478
|
return `conformance: ${sh.length} shadow lane${sh.length === 1 ? "" : "s"}, would block ${would} (${pct(would)}), false-block ${falseB} (${pct(falseB)}: would-block on an incomplete/inconsistent/unparseable review); risk-path enforced: ${risk}${kinds.length ? `; per kind: ${kinds.join(", ")}` : ""}`;
|
|
1265
1479
|
}
|
|
1266
1480
|
|
|
1267
|
-
/** #4664: follow-up classes
|
|
1268
|
-
export const FOLLOWUP_CLASSES = ["engineering", "post-deploy", "external", "ops", "host"
|
|
1481
|
+
/** #4664/#5207: follow-up classes (scripts/file-deferred-followups.sh files aggregates only, never a per-parent issue): post-deploy is one rollup per release lane (#4724), external and ops one aggregate per batch, host one host-task aggregate per batch (#5078); engineering is never filed, it is built in-lane. */
|
|
1482
|
+
export const FOLLOWUP_CLASSES = ["engineering", "post-deploy", "external", "ops", "host"];
|
|
1269
1483
|
/** #4724: the bucket every deferred row gets at contract time. `date:<YYYY-MM-DD>` and `owner:<action>` carry a value. */
|
|
1270
1484
|
export const BUCKETS = Object.freeze(["post-deploy", "verify-now", "date", "owner", "new-issue", "host"]);
|
|
1271
1485
|
const DATE_BUCKET_RE = /^date:(\d{4})-(\d{2})-(\d{2})$/;
|
|
@@ -1287,7 +1501,7 @@ export function bucketProblems(r) {
|
|
|
1287
1501
|
if (k === "owner" && r.class != null && r.class !== "external" && r.class !== "ops") out.push("an owner bucket belongs in class external or ops, never post-deploy");
|
|
1288
1502
|
return out;
|
|
1289
1503
|
}
|
|
1290
|
-
/** #5078: post-promotion / production-verify / rollout text (the rollup) and read-only production data or capture (the host: the prod_monitor signals of execution.mjs plus a read-only prod query).
|
|
1504
|
+
/** #5078: post-promotion / production-verify / rollout text (the rollup) and read-only production data or capture (the host: the prod_monitor signals of execution.mjs plus a read-only prod query). Single source: scripts/file-deferred-followups.sh routes through scripts/followup-route.mjs (#5197). */
|
|
1291
1505
|
const POST_PROMOTION_RE = /(?:after|post)[- ]?(?:promotion|release|deploy)|in production after|production[- ]verif|promot(?:e|ion)|rollout|purge|deploy[- ]time/i;
|
|
1292
1506
|
export const READONLY_PROD_RE = /\bssh\s+[\w.-]*-monitor\b|\bobs-psql\b|\bprod(?:uction)?[ _-]monitor\b|\bread[- ]only\b[^.]{0,40}\bprod(?:uction)?\b|\bprod(?:uction)?\b[^.]{0,30}\b(?:query|queries|capture|telemetry|logs?)\b/i;
|
|
1293
1507
|
/** An item that truly needs the outside world (or a write to production) stays external even when it also reads production. */
|
|
@@ -1304,21 +1518,38 @@ export function ownerRoute(r) {
|
|
|
1304
1518
|
if (POST_PROMOTION_RE.test(text) && !EXTERNAL_NEED_RE.test(text)) return "post-deploy";
|
|
1305
1519
|
return READONLY_PROD_RE.test(text) && !EXTERNAL_NEED_RE.test(text) ? "host" : "external";
|
|
1306
1520
|
}
|
|
1521
|
+
/** #5250: an acceptance criterion that can only be met by measuring live production or capturing in a real browser. */
|
|
1522
|
+
const LIVE_EVIDENCE_RE = /\b(?:measur\w*|capture\w*)\b[^.\n]{0,60}\b(?:production|prod|live)\b|\b(?:production|prod|live)\b[^.\n]{0,40}\b(?:measur\w*|capture\w*|clear rate|success rate|latency|traffic)\b|\breal[- ](?:browser|chrome|device)s?\b|\b(?:real|headless)[- ]browser\b[^.\n]{0,40}\bcaptures?\b/i;
|
|
1523
|
+
/**
|
|
1524
|
+
* #5250: intake triage. `{host:true, items}` when the issue's acceptance checklist is non-empty and EVERY item needs live
|
|
1525
|
+
* production measurement or a real-browser capture (and none needs a credential, spend or write: EXTERNAL_NEED_RE). One
|
|
1526
|
+
* code-shaped item keeps it a code lane. Backlog aggregates (FORGE:DEFERRED_FROM / BACKLOG_BATCH) only quote such text and are never host work.
|
|
1527
|
+
*/
|
|
1528
|
+
export function intakeHostWork(body) {
|
|
1529
|
+
const text = String(body ?? "");
|
|
1530
|
+
if (/FORGE:(?:DEFERRED_FROM|BACKLOG_BATCH)/.test(text)) return { host: false, items: [] };
|
|
1531
|
+
const section = noComments(text).split(/^#{1,2}\s+(?=\S)/m).find((s) => /^acceptance\b/i.test(s)) ?? "";
|
|
1532
|
+
const items = [...section.matchAll(/^\s*[-*]\s+\[[ xX]\]\s+(.+)$/gm)].map((m) => m[1].trim());
|
|
1533
|
+
const host = items.length > 0 && items.every((t) => (LIVE_EVIDENCE_RE.test(t) || READONLY_PROD_RE.test(t)) && !EXTERNAL_NEED_RE.test(t));
|
|
1534
|
+
return { host, items: host ? items : [] };
|
|
1535
|
+
}
|
|
1307
1536
|
const PRE_PROMOTION_RE = /(?:before|pre)[- ]?(?:promotion|release|deploy)/i;
|
|
1308
|
-
/** #5186: an explicit host deferral that is post-promotion text (and needs nothing external) joins the release rollup; work needed before promotion stays host.
|
|
1309
|
-
function hostRoute(r) {
|
|
1537
|
+
/** #5186: an explicit host deferral that is post-promotion text (and needs nothing external) joins the release rollup; work needed before promotion stays host. Single source for scripts/file-deferred-followups.sh host_route (#5197). */
|
|
1538
|
+
export function hostRoute(r) {
|
|
1310
1539
|
const text = `${r?.bucket ?? ""} ${r?.why ?? ""}`;
|
|
1311
1540
|
return POST_PROMOTION_RE.test(text) && !PRE_PROMOTION_RE.test(text) && !EXTERNAL_NEED_RE.test(text) ? "post-deploy" : "host";
|
|
1312
1541
|
}
|
|
1313
|
-
/** The follow-up class of a requirement: owner -> ownerRoute (ops kept), host ->
|
|
1542
|
+
/** The follow-up class of a requirement: owner -> ownerRoute (ops kept), host -> hostRoute, new-issue -> engineering (#5207: built in-lane, never filed), other buckets post-deploy; else its `class`, else post-deploy for that disposition, else engineering. */
|
|
1314
1543
|
export function followupClass(r) {
|
|
1315
1544
|
const k = bucketKind(r?.bucket);
|
|
1316
1545
|
if (k === "owner") return r?.class === "ops" ? "ops" : ownerRoute(r);
|
|
1317
1546
|
if (k === "host") return hostRoute(r);
|
|
1318
|
-
if (k === "new-issue") return
|
|
1547
|
+
if (k === "new-issue") return "engineering"; // #5207: anything this lane can build in this repo is delivered, not deferred
|
|
1319
1548
|
if (k) return "post-deploy";
|
|
1320
1549
|
return FOLLOWUP_CLASSES.includes(r?.class) ? r.class : r?.disposition === "post-deploy" ? "post-deploy" : "engineering";
|
|
1321
1550
|
}
|
|
1551
|
+
/** #5207: a defer/post-deploy row that is in-lane engineering work (bucket new-issue, or no bucket and no out-of-lane class): not deliverable as a deferral. */
|
|
1552
|
+
export const inLaneDeferral = (r) => TRACKED.includes(r?.disposition) && followupClass(r) === "engineering";
|
|
1322
1553
|
/** #4724: deferred items per bucket kind (`none` = no bucket), for the batch telemetry line. */
|
|
1323
1554
|
export const bucketTally = (reqs) => (reqs ?? []).reduce((t, r) => { const k = bucketKind(r?.bucket) ?? "none"; t[k] = (t[k] ?? 0) + 1; return t; }, {});
|
|
1324
1555
|
|
|
@@ -1422,7 +1653,7 @@ export function normalizeKindModes(raw) {
|
|
|
1422
1653
|
export function blockingFailures(failures, { shadow = false, kinds = null, allow = [] } = {}) {
|
|
1423
1654
|
const block = [], record = [];
|
|
1424
1655
|
for (const f of failures ?? []) {
|
|
1425
|
-
const own = kinds?.[f?.code];
|
|
1656
|
+
const own = kinds?.[f?.code] ?? (DEFAULT_ENFORCED_KINDS.includes(f?.kind) ? "enforce" : undefined);
|
|
1426
1657
|
(own ? own === "enforce" : !shadow || allow.includes(f?.code)) ? block.push(f) : record.push(f);
|
|
1427
1658
|
}
|
|
1428
1659
|
return { block, record };
|