forgedock 1.66.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 +3 -0
- package/bin/engine/outcome-codes.mjs +2 -0
- package/bin/engine-cli.mjs +193 -27
- package/bin/engine.mjs +10 -0
- package/bin/forgedock.mjs +24 -1
- package/bin/help-text.mjs +4 -3
- package/bin/introspect-schedule.mjs +98 -0
- package/bin/introspect-schedule.test.mjs +67 -0
- package/bin/lean/admission.mjs +21 -0
- package/bin/lean/admission.test.mjs +30 -0
- package/bin/lean/advisory.test.mjs +64 -0
- package/bin/lean/amendment-schema.mjs +30 -0
- package/bin/lean/attempts.mjs +162 -0
- package/bin/lean/attempts.test.mjs +141 -0
- package/bin/lean/basered.mjs +81 -0
- package/bin/lean/basered.test.mjs +68 -1
- package/bin/lean/batch-health.mjs +20 -12
- package/bin/lean/batch-health.test.mjs +55 -11
- package/bin/lean/batch.mjs +45 -0
- package/bin/lean/batch.test.mjs +105 -5
- package/bin/lean/capwait.mjs +14 -3
- package/bin/lean/capwait.test.mjs +20 -0
- 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.mjs +14 -0
- package/bin/lean/clear-breaker.test.mjs +4 -3
- package/bin/lean/commentstate.mjs +46 -0
- package/bin/lean/commentstate.test.mjs +43 -0
- package/bin/lean/concurrency.mjs +89 -0
- package/bin/lean/concurrency.test.mjs +113 -0
- package/bin/lean/conformance.e2e.test.mjs +13 -8
- package/bin/lean/conformance.mjs +73 -181
- package/bin/lean/conformance.test.mjs +61 -345
- 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/efficiency.mjs +162 -0
- package/bin/lean/efficiency.test.mjs +79 -0
- 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 +41 -17
- package/bin/lean/execution.test.mjs +58 -0
- package/bin/lean/failure-census.mjs +170 -0
- package/bin/lean/failure-census.test.mjs +59 -0
- package/bin/lean/failure-stop.mjs +46 -0
- package/bin/lean/failure-stop.test.mjs +45 -0
- package/bin/lean/fixtures/capacity-storm.json +609 -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 +311 -154
- package/bin/lean/lean.test.mjs +530 -223
- 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/liveness.mjs +37 -0
- package/bin/lean/liveness.test.mjs +33 -0
- package/bin/lean/orchestrate-attempts.test.mjs +82 -0
- 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 +76 -1
- package/bin/lean/orchestrate-reconcile.test.mjs +164 -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 +344 -45
- package/bin/lean/phaseledger.mjs +6 -0
- package/bin/lean/phaseledger.test.mjs +13 -1
- 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 +13 -28
- package/bin/lean/reconcile.mjs +90 -0
- package/bin/lean/recurrence.mjs +6 -112
- package/bin/lean/recurrence.test.mjs +11 -92
- 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 +49 -11
- package/bin/lean/sched.mjs +19 -0
- package/bin/lean/sched.test.mjs +11 -1
- package/bin/lean/schedd-health.mjs +4 -4
- package/bin/lean/schedd-health.test.mjs +8 -4
- package/bin/lean/schedd.mjs +45 -8
- package/bin/lean/schedd.test.mjs +120 -7
- package/bin/lean/selfreview.mjs +1 -1
- package/bin/lean/slo.mjs +126 -0
- package/bin/lean/slo.test.mjs +112 -0
- package/bin/lean/statuscomment.mjs +40 -0
- package/bin/lean/statuscomment.test.mjs +48 -1
- package/bin/lean/validate-catalog.mjs +108 -0
- package/bin/lean/validate-catalog.test.mjs +46 -1
- package/bin/lean/verify.mjs +3 -2
- package/bin/pool/affinity.test.mjs +91 -0
- package/bin/pool/agent.mjs +144 -10
- package/bin/pool/cache-sweep.mjs +31 -10
- package/bin/pool/ci-autoscale.mjs +160 -0
- package/bin/pool/cli.mjs +53 -9
- 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 +26 -0
- 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/attempts.mjs +54 -0
- package/bin/stats/attempts.test.mjs +30 -0
- package/bin/stats/churn.mjs +49 -0
- package/bin/stats/churn.test.mjs +31 -0
- package/bin/stats/index.mjs +11 -3
- 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/commands/orchestrate.md +21 -18
- package/docs/CONFIG.md +41 -0
- package/docs/OUTCOME-CODES.md +2 -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/check-devdocs-freshness.sh +1 -1
- 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
package/bin/lean/conformance.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { spawnSync } from "node:child_process";
|
|
11
11
|
import { OUTCOME_CODES, ENV_VALIDATE_TIMEOUT } from "../engine/outcome-codes.mjs";
|
|
12
12
|
import { noComments } from "./context.mjs";
|
|
13
|
-
import {
|
|
13
|
+
import { isDriftFailure } from "./validate-catalog.mjs";
|
|
14
14
|
import { seqNumber } from "./sequence.mjs";
|
|
15
15
|
import { activationFailures } from "./activation.mjs";
|
|
16
16
|
import * as nodeFs from "node:fs";
|
|
@@ -48,8 +48,7 @@ import { CHECK_ID_RE, e2eCheckFor } from "./postdeploy-check.mjs";
|
|
|
48
48
|
import { normaliseDecision, deadAnchors, anchorMatches, parseRequirementDecision } from "./decisions.mjs";
|
|
49
49
|
import { globToRegex } from "../../scripts/ci-local/lib.mjs";
|
|
50
50
|
import { contractBriefProblems } from "./pagegate.mjs"; // #5428
|
|
51
|
-
import {
|
|
52
|
-
import { designContractFailures } from "./recurrence.mjs"; // #5751
|
|
51
|
+
import { AMEND_KINDS } from "./amendment-schema.mjs"; // #5979
|
|
53
52
|
const C = OUTCOME_CODES;
|
|
54
53
|
|
|
55
54
|
/** #4789: folds what a builder retyping a quote changes: unicode punctuation, markdown links/markup, escapes, invisible chars. */
|
|
@@ -232,22 +231,6 @@ export function authorizationOf(contract, f) {
|
|
|
232
231
|
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";
|
|
233
232
|
return null;
|
|
234
233
|
}
|
|
235
|
-
// A doc a freshness rule can demand: a prose file under a docs directory. Build and dependency files (`requirements.txt`,
|
|
236
|
-
// `CMakeLists.txt`) and agent-instruction or workflow-spec files outside a docs directory (`CLAUDE.md`, `commands/*.md`) never
|
|
237
|
-
// match, so the exemption cannot carry them past scope_creep.
|
|
238
|
-
const DOC_FILE_RE = /(?:^|\/)(?:docs?|devdocs|documentation)\/(?:[^/]+\/)*[^/]+\.(?:md|mdx|rst|adoc)$/i;
|
|
239
|
-
/**
|
|
240
|
-
* The docs-freshness rule demands a doc edit the frozen contract cannot name: add-deliverable amendments (why "docs freshness
|
|
241
|
-
* rule") for doc files (`DOC_FILE_RE`) that `after` has and `before` lacked and no deliverable, test or incidental rule authorizes.
|
|
242
|
-
* Only when the freshness check failed before the round (`wasFailing`) and passes after it (`nowOk`); code files stay scope creep.
|
|
243
|
-
*/
|
|
244
|
-
export function impliedDocDeliverables({ before = [], after = [], contract, wasFailing = false, nowOk = false }) {
|
|
245
|
-
if (!wasFailing || !nowOk) return [];
|
|
246
|
-
const had = new Set(before.map(cleanPath));
|
|
247
|
-
return [...new Set(after.map(cleanPath))]
|
|
248
|
-
.filter((f) => !had.has(f) && DOC_FILE_RE.test(f) && !authorizationOf(contract ?? {}, f))
|
|
249
|
-
.map((path) => ({ kind: "add-deliverable", path, why: "docs freshness rule" }));
|
|
250
|
-
}
|
|
251
234
|
const blank = (s) => !String(s ?? "").trim() || /^none$/i.test(String(s).trim());
|
|
252
235
|
|
|
253
236
|
/** forge.yaml lean.repro_test (#4271): "prefer" (default) asks a bug lane for a red-green repro test; "off" is today's contract. */
|
|
@@ -574,7 +557,7 @@ export function testPlanProblems(c, { required = false } = {}) {
|
|
|
574
557
|
|
|
575
558
|
/** #5448: a requirement that starts as an imperative build verb is development work, not a prod-only measurement. */
|
|
576
559
|
const DEV_WORK_RE = /^\W*(?:\w+\s+){0,2}?(?:find|fix|implement|develop|build|write|patch|add|change)\b/i;
|
|
577
|
-
export function validateContract(c, issueText, { repro = false, pages = null, testPlan = false, readFile = null,
|
|
560
|
+
export function validateContract(c, issueText, { repro = false, pages = null, testPlan = false, readFile = null, baseFiles = null, reproRecipe = false } = {}) {
|
|
578
561
|
const problems = [];
|
|
579
562
|
if (!c || typeof c !== "object" || Array.isArray(c)) return { ok: false, problems: ["contract.json is missing or not a JSON object"] };
|
|
580
563
|
const reqs = Array.isArray(c.requirements) ? c.requirements : [];
|
|
@@ -588,11 +571,6 @@ export function validateContract(c, issueText, { repro = false, pages = null, te
|
|
|
588
571
|
if (!inIssue(r?.quote, issueText)) problems.push(quoteMiss(id, r?.quote, issueText));
|
|
589
572
|
if (TRACKED.includes(r?.disposition) && blank(r?.why)) problems.push(`${id}: ${r.disposition} needs a why`);
|
|
590
573
|
if (r?.disposition === "post-deploy" && !CHECK_ID_RE.test(String(r?.check ?? ""))) problems.push(`${id}: post-deploy needs a check id (\`check\`, e.g. "login-smoke") naming an entry of .forge/post-deploy-checks.json on the default branch`);
|
|
591
|
-
if (r?.disposition === "post-deploy" && !r?.e2e_tracked && !r?.engine_check && CHECK_ID_RE.test(String(r?.check ?? "")) && checkIds) { // first-pass: an unregistered check id fails at freeze, not after the build (precheck check_unknown); checkIds = the base's check ids, as precheck reads them
|
|
592
|
-
const known = [...checkIds];
|
|
593
|
-
const delivers = (Array.isArray(c.deliverables) ? c.deliverables : []).some((d) => String(d?.path ?? "").replace(/^\.\//, "") === ".forge/post-deploy-checks.json");
|
|
594
|
-
if (!known.includes(r.check) && !delivers) problems.push(`${id}: post-deploy check '${r.check}' is not registered in .forge/post-deploy-checks.json; either add a deliverable {"path":".forge/post-deploy-checks.json","change":"register check ${r.check} (run, pass, timeout)"} or use an existing id${known.length ? ` (${known.slice(0, 8).join(", ")}${known.length > 8 ? ", ..." : ""})` : ""}`);
|
|
595
|
-
}
|
|
596
574
|
if (r?.disposition === "post-deploy" && blank(r?.local_infeasible_why)) problems.push(`${id}: post-deploy needs local_infeasible_why: why a fixture or recorded response cannot check this locally (#5448)`);
|
|
597
575
|
if (r?.disposition === "post-deploy" && (inLaneDeferral(r) || (bucketKind(r?.bucket) !== "owner" && bucketKind(r?.bucket) !== "host" && DEV_WORK_RE.test(String(r?.quote ?? ""))))) problems.push(`${id}: development work (finding or fixing the signal) is delivered in-lane, never deferred as prod-only; deliver it and keep only the measurement post-deploy (#5448)`);
|
|
598
576
|
if (r?.disposition === "not-applicable" && blank(r?.evidence)) problems.push(`${id}: not-applicable needs file:line evidence`);
|
|
@@ -662,10 +640,9 @@ export function validateContract(c, issueText, { repro = false, pages = null, te
|
|
|
662
640
|
/** forge#4519: a shell pattern as in scripts/hotspots.sh `case` (`*` crosses `/`, `?` one character), anchored. */
|
|
663
641
|
const shellGlobRe = (g) => new RegExp(`^${String(g).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".")}$`);
|
|
664
642
|
|
|
665
|
-
const AMEND_KINDS = ["add-deliverable", "add-requirement", ...TRACKED, "amend-requirement", "supersedes", "decision", "substitute-validate", "out-of-band"];
|
|
666
643
|
const UNRELATED_CI_KIND = "unrelated-ci-failure";
|
|
667
644
|
const GUARD_ID_RE = /^#?\d+$/;
|
|
668
|
-
const AMEND_SLIPS = { "amend-requirement": "defer", limitation: "defer", deferred: "defer", deferral: "defer", "scope-deferral": "defer", "
|
|
645
|
+
const AMEND_SLIPS = { "amend-requirement": "defer", limitation: "defer", deferred: "defer", deferral: "defer", "scope-deferral": "defer", "out-of-band-verification": "out-of-band" };
|
|
669
646
|
// #5036: annotation-only kinds change no requirement: recorded for the reviewer, never a problem (like UNRELATED_CI_KIND)
|
|
670
647
|
const INFO_KINDS = ["scope-note", "scope", "scope-clarification", "interpretation", "environment", "validation-unavailable"];
|
|
671
648
|
// #5036: deferral-shaped kinds (scope narrowing/reduction, defer-*, deferred-*) are `defer` once they name a requirement
|
|
@@ -705,31 +682,10 @@ function splitRequirementRefs(ref) {
|
|
|
705
682
|
return ids.length > 1 ? ids : [ref];
|
|
706
683
|
}
|
|
707
684
|
|
|
708
|
-
/**
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
: kind === "supersedes" ? "needs guard: \"#N\" (the guarded issue) or mechanism: \"<name>\" (#5752: retires the guards whose tests the lane deletes)" : TRACKED.includes(kind) ? "needs requirement: \"R#\"" : kind === "amend-requirement" ? "needs requirement: \"R#\" and text (the revised wording)"
|
|
713
|
-
: kind === "substitute-validate" ? "needs validate: \"V#\" and command" : kind === "out-of-band" ? "needs requirement: \"R#\" and evidence (the job or workflow that measures it)"
|
|
714
|
-
: kind === "decision" ? "needs decision {choice, anchors: [paths or globs], symbols?, supersedes?: decision id}" : null;
|
|
715
|
-
const why = need ? `amendment kind '${kind}' ${need}` : `unknown kind '${kind ?? ""}'; valid kinds are ${AMEND_KINDS.join(", ")}`;
|
|
716
|
-
return `unknown or incomplete amendment: ${why}: ${tag}`;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
/** #5089: shape-only check of the builder's amendments (unknown kind, missing path or requirement), run before the gate so one in-lane correction can fix them. Returns the rejection strings; [] when valid. */
|
|
720
|
-
export function amendmentKindProblems(amendments) {
|
|
721
|
-
const out = [];
|
|
722
|
-
for (const raw of Array.isArray(amendments) ? amendments : []) {
|
|
723
|
-
const a = normalizeAmendment(raw);
|
|
724
|
-
if (a?.kind === UNRELATED_CI_KIND || INFO_KINDS.includes(a?.kind)) continue;
|
|
725
|
-
const tag = JSON.stringify(raw ?? null).slice(0, 400);
|
|
726
|
-
const known = AMEND_KINDS.includes(a?.kind);
|
|
727
|
-
const missing = a?.kind === "add-deliverable" ? blank(a.path)
|
|
728
|
-
: TRACKED.includes(a?.kind) || a?.kind === "amend-requirement" ? blank(a.requirement) : false;
|
|
729
|
-
if (!known || missing) out.push(amendmentProblem(a, tag));
|
|
730
|
-
}
|
|
731
|
-
return out;
|
|
732
|
-
}
|
|
685
|
+
/** A short reason an amendment was not applied (#6083: the engine only skips it; the reason is never a gate). */
|
|
686
|
+
const amendmentProblem = (a, tag) => `amendment not applied (${a?.kind ? `kind '${a.kind}'` : "no kind"}): ${tag}`;
|
|
687
|
+
/** #5979: a supersedes whose guard is a frozen validate-row id (G2, V1), not a #N guard issue. */
|
|
688
|
+
const isValidateRowGuard = (a, ids) => !blank(a.guard) && !GUARD_ID_RE.test(String(a.guard).trim()) && (ids ?? []).includes(String(a.guard).trim());
|
|
733
689
|
|
|
734
690
|
/**
|
|
735
691
|
* Apply result.json amendments to the frozen contract. Kinds: add-deliverable {path}, add-requirement {requirement},
|
|
@@ -743,7 +699,7 @@ export function amendmentKindProblems(amendments) {
|
|
|
743
699
|
export function applyAmendments(frozen, amendments, issueText = null, { generatedPaths = [], baseFiles = null, addedPaths = [], defaultWhy = null } = {}) {
|
|
744
700
|
const c = structuredClone(frozen);
|
|
745
701
|
c.deliverables = c.deliverables ?? [];
|
|
746
|
-
for (const v of c.validate ?? []) if (v && typeof v === "object") delete v.substituted; //
|
|
702
|
+
for (const v of c.validate ?? []) if (v && typeof v === "object") delete v.substituted; // a frozen contract never carries a substitute (#6083: substitute-validate is gone)
|
|
747
703
|
const applied = [], toTrack = [], problems = [], decisions = [];
|
|
748
704
|
const genRes = (Array.isArray(generatedPaths) ? generatedPaths : []).filter((g) => typeof g === "string" && g).map(shellGlobRe);
|
|
749
705
|
const rows = [];
|
|
@@ -779,16 +735,6 @@ export function applyAmendments(frozen, amendments, issueText = null, { generate
|
|
|
779
735
|
// package.json declares the edge (forge#4159); before, it was reported as applied but changed nothing.
|
|
780
736
|
if (have) { have.change = have.change ? `${have.change}; ${a.why}` : a.why; have.amended = true; }
|
|
781
737
|
else c.deliverables.push({ id: a.id ?? `A${c.deliverables.length + 1}`, path: a.path, change: a.why, amended: true });
|
|
782
|
-
} else if (a.kind === "substitute-validate" && !blank(a.validate)) {
|
|
783
|
-
// #4857: a runnable equivalent of an unrunnable frozen validate command; same id, same checks as a planned command
|
|
784
|
-
const v = (c.validate ?? []).find((x) => x.id === a.validate);
|
|
785
|
-
if (!v) { problems.push(`substitute-validate names unknown validate ${a.validate}`); continue; }
|
|
786
|
-
const bad = blank(a.command) ? "no command" : substituteShellProblem(a.command) ? "not valid shell (bash -n)" : noopCommand(a.command) ? "runs no check (true, :, exit 0, echo)" : movingBaseDiff(a.command) ? "diffs against a moving base tip" : tmpdirInputs(a.command).length ? "reads a $TMPDIR file it did not create" : null;
|
|
787
|
-
if (bad) { problems.push(`substitute-validate ${a.validate}: ${bad}`); continue; }
|
|
788
|
-
// SEC-11: a second substitute of the same id keeps the frozen command as `from`, so the engine always reruns the original
|
|
789
|
-
v.substituted = { from: v.substituted?.from ?? v.command, why: String(a.why).trim() }; v.command = String(a.command).trim();
|
|
790
|
-
applied.push({ kind: a.kind, target: a.validate, why: String(a.why).trim() });
|
|
791
|
-
continue;
|
|
792
738
|
} else if (a.kind === "out-of-band" && !blank(a.requirement) && !blank(a.evidence ?? a.job)) {
|
|
793
739
|
// #5036: the existing out_of_band path for a deliver requirement; evidence names the job that measures it
|
|
794
740
|
const r = c.requirements.find((x) => x.id === a.requirement);
|
|
@@ -822,6 +768,8 @@ export function applyAmendments(frozen, amendments, issueText = null, { generate
|
|
|
822
768
|
c.mechanisms = [...(c.mechanisms ?? []).filter((m) => m.mechanism !== mechanism), { mechanism, why: String(a.why).trim() }];
|
|
823
769
|
applied.push({ kind: a.kind, target: `mechanism ${mechanism}`, why: String(a.why).trim() });
|
|
824
770
|
continue;
|
|
771
|
+
} else if (a.kind === "supersedes" && isValidateRowGuard(a, [...(c.validate ?? []), ...(c.regression ?? [])].map((v) => v?.id))) {
|
|
772
|
+
continue; // a validate-row id is not a guard issue: not applied (#6083)
|
|
825
773
|
} else if (a.kind === "supersedes" && GUARD_ID_RE.test(String(a.guard ?? "").trim())) {
|
|
826
774
|
// #4693: retires one guard's guard_broken for this lane; the reviewer judges it, the engine tells the guarded issue after merge
|
|
827
775
|
const guard = `#${String(a.guard).trim().replace(/^#/, "")}`;
|
|
@@ -906,12 +854,6 @@ export function shellSyntaxError(command) {
|
|
|
906
854
|
if (r.error || r.status === 0 || r.status == null) return null;
|
|
907
855
|
return String(r.stderr || "syntax error").trim().split("\n")[0].replace(/^bash: (?:line \d+: )?/, "").slice(0, 160);
|
|
908
856
|
}
|
|
909
|
-
/** #5020: like shellSyntaxError, but fails closed: when bash cannot run the check the command is not shown to parse. */
|
|
910
|
-
export function substituteShellProblem(command) {
|
|
911
|
-
const r = spawnSync("bash", ["-n", "-c", String(command ?? "")], { encoding: "utf8", timeout: 5000 });
|
|
912
|
-
if (r.error || r.status == null) return "bash -n could not run, so the command is unverified";
|
|
913
|
-
return r.status === 0 ? null : shellSyntaxError(command) ?? "syntax error";
|
|
914
|
-
}
|
|
915
857
|
export const ORCHESTRATOR_BUCKET = "owner:orchestrator";
|
|
916
858
|
/**
|
|
917
859
|
* #5020: a post-deploy requirement that names no check id (a manual or production-credential action) becomes a `defer` with an
|
|
@@ -975,63 +917,6 @@ export function assertionFailure(output) {
|
|
|
975
917
|
export function reproEnvMiss(run, opts) {
|
|
976
918
|
return run && run.rc !== 0 && run.rc !== 124 ? missingTool(run, opts) : null;
|
|
977
919
|
}
|
|
978
|
-
const NOOP_SEGMENT_RE = /^(?:true|false|:|exit(?:\s+\d+)?|echo(?:\s.*)?|printf(?:\s.*)?|sleep(?:\s+[\d.]+)?|test\s+-?\w+|\[\s+-?\w+\s+\]|fi|done|node\s+-e\s+['"]?[\d;\s]*['"]?|python3?\s+-c\s+['"]?(?:pass|0|None)?['"]?)$/;
|
|
979
|
-
const KEYWORD_RE = /^(if|then|else|elif|do|while|until)(?:\s+|$)/;
|
|
980
|
-
const CONST_FALSE_RE = /^(?:false|\[\s+0\s+=\s+1\s+\]|\[\s+1\s+=\s+0\s+\]|test\s+0\s+=\s+1|test\s+-n\s+(?:""|'')|\[\s+-n\s+(?:""|'')\s+\])$/;
|
|
981
|
-
/**
|
|
982
|
-
* #4979 SPEC-2: a command every segment of which is a no-op (true, :, exit N, echo, printf, sleep, a constant test,
|
|
983
|
-
* shell keywords, `node -e 0`, `python -c pass`) checks nothing. A best-effort denylist: the engine's rerun of the
|
|
984
|
-
* frozen command (`substituteVerdict`) is the real gate.
|
|
985
|
-
*/
|
|
986
|
-
export function noopCommand(command) {
|
|
987
|
-
// SEC-22: a leading shell keyword is stripped and the rest judged, so `if [ -f x ]; then pytest; fi` is a real check
|
|
988
|
-
const segs = String(command ?? "").split(/&&|\|\||;|\||\n/).map((s) => s.trim()).filter(Boolean);
|
|
989
|
-
const live = [];
|
|
990
|
-
let dead = false; // #4995: inside the body of an if/elif/while whose condition is a constant false
|
|
991
|
-
for (const raw of segs) {
|
|
992
|
-
let s = raw, cond = false, m;
|
|
993
|
-
while ((m = KEYWORD_RE.exec(s))) {
|
|
994
|
-
s = s.slice(m[0].length);
|
|
995
|
-
if (m[1] === "else" || m[1] === "elif") dead = false;
|
|
996
|
-
cond = m[1] === "if" || m[1] === "elif" || m[1] === "while";
|
|
997
|
-
}
|
|
998
|
-
if (s === "fi" || s === "done") dead = false;
|
|
999
|
-
if (cond) { if (CONST_FALSE_RE.test(s)) dead = true; else if (!dead && s) live.push(s); continue; }
|
|
1000
|
-
if (!dead && s) live.push(s);
|
|
1001
|
-
}
|
|
1002
|
-
return segs.length > 0 && live.every((s) => NOOP_SEGMENT_RE.test(s));
|
|
1003
|
-
}
|
|
1004
|
-
/**
|
|
1005
|
-
* #4979 SPEC-2: a substitute-validate stands only when the frozen command it replaced cannot run (died before any test,
|
|
1006
|
-
* a runner usage error, a missing host tool, exit 127) or passes anyway. A frozen command that runs and fails is a real
|
|
1007
|
-
* failure the substitute may not hide. `run` is the engine's rerun of the frozen command; null when none was made.
|
|
1008
|
-
*/
|
|
1009
|
-
export function substituteVerdict(run, { repoHas = () => false, command = "" } = {}) {
|
|
1010
|
-
if (!run) return "unverified";
|
|
1011
|
-
if (run.rc === 0 || run.rc === 127 || unrunnableValidate(run, command) || cliUsageError(run) || missingTool(run, { repoHas, command })) return "ok";
|
|
1012
|
-
return run.rc === 124 ? "timeout" : "runs";
|
|
1013
|
-
}
|
|
1014
|
-
/**
|
|
1015
|
-
* #4990 SEC-13: the paths of `removed` (deleted, or the old side of a rename, in the diff) that a frozen command names:
|
|
1016
|
-
* a whitespace token equal to the path, or a directory token above it. A builder that removes the target of its frozen
|
|
1017
|
-
* validate makes the engine's rerun read "unrunnable", so the substitute is judged on the diff instead.
|
|
1018
|
-
*/
|
|
1019
|
-
const TEST_FILE_RE = /\.(?:test|spec)\.[a-z0-9]+$|^test_[^/]+\.[a-z0-9]+$|_test\.[a-z0-9]+$|Tests?\.(?:java|kt|kts|cs|php|scala|swift)$|_spec\.rb$|^tests\.rs$|^conftest\.py$|\.bats$/;
|
|
1020
|
-
/** #5003: a runnable test FILE (by basename), unlike `isTestPath`, which also matches fixtures under tests/. */
|
|
1021
|
-
const isTestFile = (p) => TEST_FILE_RE.test(String(p).split("/").pop());
|
|
1022
|
-
/**
|
|
1023
|
-
* #4990 SEC-13: the paths of `removed` (deleted, or the old side of a rename, in the diff) that a frozen command names.
|
|
1024
|
-
* #5003: a token is stripped of quotes, a `--flag=` prefix and a pytest `::node` suffix; a glob is expanded against
|
|
1025
|
-
* `baseFiles`; an exact path matches itself; a directory or bare-word token matches only a removed test file under it.
|
|
1026
|
-
*/
|
|
1027
|
-
export function removedNamedPaths(command, removed = [], baseFiles = []) {
|
|
1028
|
-
const toks = String(command ?? "").split(/\s+/).map((t) => t.replace(/^['"`(]+|['"`);]+$/g, "").replace(/^-[^=\/]*=/, "").replace(/::.*$/, "").replace(/^['"`]+|['"`]+$/g, "").replace(/^\.\//, "").replace(/\/+$/, "")).filter((t) => t && t !== ".");
|
|
1029
|
-
const files = new Set(baseFiles);
|
|
1030
|
-
return removed.filter((p) => toks.some((t) => {
|
|
1031
|
-
if (/[*?]/.test(t)) return globRe(t).test(p) && (files.size === 0 || files.has(p));
|
|
1032
|
-
return p === t || (p.startsWith(`${t}/`) && isTestFile(p));
|
|
1033
|
-
}));
|
|
1034
|
-
}
|
|
1035
920
|
/** #4990: paths the lane's diff deletes or renames away from (the old side). #5003: `-z` (unquoted), null on a git error (fail closed). */
|
|
1036
921
|
export async function removedPathsOf(git, base) {
|
|
1037
922
|
let out;
|
|
@@ -1182,12 +1067,8 @@ const wantsE2e = (r) => /\[type:(?:e2e|manual)\]/i.test(tagText(r?.quote));
|
|
|
1182
1067
|
* `ciCovered` (#4527): the validate ids accepted only because the head is CI-verified (no local result, or a missing host
|
|
1183
1068
|
* tool), for the trajectory; always an array.
|
|
1184
1069
|
*/
|
|
1185
|
-
export function precheck({ contract, result, changedFiles, ignore = [], ciVerified = false,
|
|
1186
|
-
const failures = [], superseded = [], ciCovered = []
|
|
1187
|
-
// #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)
|
|
1188
|
-
if (checkIds) for (const r of contract.requirements ?? []) {
|
|
1189
|
-
if (r.disposition === "post-deploy" && !(r.check && checkIds.has(r.check))) failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "check_unknown", detail: `${r.id} post-deploy check ${r.check ? `'${r.check}'` : "id"} is neither on the default branch nor added by this PR (.forge/post-deploy-checks.json)` });
|
|
1190
|
-
}
|
|
1070
|
+
export function precheck({ contract, result, changedFiles, ignore = [], ciVerified = false, repro = null, validateRuns = null, repoHas = () => false, frozen = null, baselineFailures = null, guardFailures = null, coupledFailures = null, relaxationFailures = null, routeFailures = null, pageFailures = null, docsPaths = null, prodParityFailures = null, seamFailures = null, newOffKeys = null, removedPaths = [], uiBrowser = null, outcomeEvidenceFailures = null }) {
|
|
1071
|
+
const failures = [], superseded = [], ciCovered = [];
|
|
1191
1072
|
// #5754: a deliver [type:e2e]/[type:manual] row whose observable exists only in production (live stack, deploy, prod window) cannot be produced by the placement: fail fast with a typed code instead of spending builder resumes
|
|
1192
1073
|
for (const r of contract.requirements ?? []) {
|
|
1193
1074
|
if (r.disposition === "deliver" && wantsE2e(r) && !isOutOfBand(r) && r.verify !== "in_lane" && prodOnlyE2e(r.quote)) failures.push({ code: C.CONFORMANCE_E2E_UNVERIFIED, kind: "e2e_placement", detail: `${r.id} is a [type:e2e]/[type:manual] criterion observable only in production or on the live stack, which this lane cannot produce; mark ${r.id} post-deploy so it is transferred to the epic's acceptance instead of spending builder resumes (#5754)` });
|
|
@@ -1202,21 +1083,6 @@ export function precheck({ contract, result, changedFiles, ignore = [], ciVerifi
|
|
|
1202
1083
|
if (creep.length) failures.push({ code: C.CONFORMANCE_SCOPE_CREEP, kind: "scope_creep", detail: `changed outside the contract's deliverables: ${creep.join(", ")}` });
|
|
1203
1084
|
const runs = Array.isArray(result?.validation) ? result.validation : [];
|
|
1204
1085
|
for (const v of contract.validate ?? []) {
|
|
1205
|
-
// #4979 SPEC-2: a substitute counts only when the frozen command it replaced cannot run (or passes); checked first, never CI-covered
|
|
1206
|
-
if (v.substituted) {
|
|
1207
|
-
const shellBad = substituteShellProblem(v.command); // #5020: re-checked before the substitute is used
|
|
1208
|
-
if (shellBad) { failures.push({ code: C.CONTRACT_INVALID_COMMAND, kind: "validate_command_invalid", detail: `validate ${v.id} substitute \`${v.command}\` is not valid shell (bash -n: ${shellBad})` }); continue; }
|
|
1209
|
-
if (removedPaths === null) { failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "substitute_unverified", detail: `validate ${v.id} substituted \`${v.command}\` for the frozen \`${v.substituted.from}\`, but the engine could not read the diff's removed paths to show the frozen command's target survives` }); continue; }
|
|
1210
|
-
const gone = removedNamedPaths(v.substituted.from, removedPaths, baseFiles);
|
|
1211
|
-
if (gone.length) { failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "substitute_removed_path", detail: `validate ${v.id} substituted \`${v.command}\` for the frozen \`${v.substituted.from}\`, but the diff removes ${gone.map((x) => `\`${x}\``).join(", ")} that the frozen command names: a substitute may not replace a check by deleting its target` }); continue; }
|
|
1212
|
-
const verdict = substituteVerdict(substitutedRuns?.[v.id], { repoHas, command: v.substituted.from });
|
|
1213
|
-
const from = `validate ${v.id} substituted \`${v.command}\` for the frozen \`${v.substituted.from}\``;
|
|
1214
|
-
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; }
|
|
1215
|
-
// #5653: the frozen command runs, and the substitute ran the same test ids with the same exit: recorded, not failed
|
|
1216
|
-
if (verdict === "runs" && equivalentRuns(substitutedRuns[v.id], substitutedRuns[v.id].sub)) equivalent.push({ id: v.id, from: v.substituted.from, to: v.command });
|
|
1217
|
-
else if (verdict === "runs") { failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "validate_failed", output: rawTail(substitutedRuns[v.id].output), 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; }
|
|
1218
|
-
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; }
|
|
1219
|
-
}
|
|
1220
1086
|
const r = runs.find((x) => x?.id === v.id);
|
|
1221
1087
|
// #4167: a head the engine verified on CI covers validate ids the builder left to CI (no result, or ci:true without an exit)
|
|
1222
1088
|
const leftToCi = !r || (r.ci === true && r.exit === undefined);
|
|
@@ -1228,7 +1094,7 @@ export function precheck({ contract, result, changedFiles, ignore = [], ciVerifi
|
|
|
1228
1094
|
const rerun = validateRuns?.[v.id];
|
|
1229
1095
|
if (rerun?.rc === 0) continue;
|
|
1230
1096
|
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; }
|
|
1231
|
-
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
|
|
1097
|
+
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` }); continue; }
|
|
1232
1098
|
// #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.
|
|
1233
1099
|
if (rerun?.rc === 124) {
|
|
1234
1100
|
if (ciVerified) { ciCovered.push(v.id); continue; }
|
|
@@ -1250,16 +1116,13 @@ export function precheck({ contract, result, changedFiles, ignore = [], ciVerifi
|
|
|
1250
1116
|
if (r.disposition === "deliver" && isOutOfBand(r)) {
|
|
1251
1117
|
// #4404: measured outside the lane; the builder delivers its instrumentation (budget test or bench committed, job configured)
|
|
1252
1118
|
const row = st.find((x) => x?.id === r.id);
|
|
1253
|
-
if (row?.instrumented !== true && s !== "implemented") failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "requirement_unimplemented", detail: `${r.id} is verified out of band${r.evidence ? ` by ${r.evidence}` : ""} but reported "${s ?? "no status"}" without instrumented: true` });
|
|
1119
|
+
if (row?.instrumented !== true && s !== "implemented") failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: s == null ? "requirement_no_status" : "requirement_unimplemented", ...(s == null ? { reqId: r.id, quote: r.quote } : {}), detail: `${r.id} is verified out of band${r.evidence ? ` by ${r.evidence}` : ""} but reported "${s ?? "no status"}" without instrumented: true` });
|
|
1254
1120
|
} else if (r.disposition === "deliver") {
|
|
1255
1121
|
if (s === "deferred" || s === "post-deploy") failures.push({ code: C.CONFORMANCE_UNTRACKED_DEFERRAL, kind: "untracked_deferral", detail: `${r.id} was contracted as deliver but reported "${s}" without a typed amendment` });
|
|
1256
|
-
else if (s !== "implemented") failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: "requirement_unimplemented", detail: `${r.id} reported "${s ?? "no status"}"` });
|
|
1122
|
+
else if (s !== "implemented") failures.push({ code: C.CONFORMANCE_UNIMPLEMENTED, kind: s == null ? "requirement_no_status" : "requirement_unimplemented", ...(s == null ? { reqId: r.id, quote: r.quote } : {}), detail: `${r.id} reported "${s ?? "no status"}"` }); // #6058: a missing row is a skipped requirement, not a failed one
|
|
1257
1123
|
}
|
|
1258
1124
|
}
|
|
1259
1125
|
for (const f of baselineFailures ?? []) failures.push({ code: C.CONFORMANCE_REGRESSION, ...f }); // #5448
|
|
1260
|
-
failures.push(...hotspotGrowth({ contract, result, hotspots, changedFiles }));
|
|
1261
|
-
failures.push(...counterGrowth({ before: counters?.before, after: counters?.after, contract, result })); // #5751: forge.yaml recurrence.counters, measured at base and lane head
|
|
1262
|
-
failures.push(...designContractFailures(contract, recurrence)); // #5751: a recurring issue's design lane contract
|
|
1263
1126
|
if (repro) failures.push(...reproFailures(contract, repro), ...reproQualityFailures(repro));
|
|
1264
1127
|
failures.push(...sourceDeliverableFailures(contract, changedFiles, ignore));
|
|
1265
1128
|
// #4693: a broken guard fails unless the contract carries a supersedes amendment for it
|
|
@@ -1270,14 +1133,12 @@ export function precheck({ contract, result, changedFiles, ignore = [], ciVerifi
|
|
|
1270
1133
|
for (const f of coupledFailures ?? []) failures.push(f); // #5079
|
|
1271
1134
|
for (const f of relaxationFailures ?? []) failures.push(f); // #5237
|
|
1272
1135
|
failures.push(...(routeFailures ?? [])); // #5087: topology.route_reachability, blocking when declared
|
|
1273
|
-
failures.push(...(docsFailures ?? [])); // #5419: forge.yaml docs
|
|
1274
1136
|
failures.push(...(outcomeEvidenceFailures ?? [])); // #5752: forge.yaml outcome_evidence
|
|
1275
|
-
failures.push(...(ciBudgetFailures ?? [])); // #5760: CI additions need a FORGE:CI_BUDGET annotation or the shared job, scoped hygiene, max counts
|
|
1276
1137
|
failures.push(...(pageFailures ?? [])); // #5428: forge.yaml pages
|
|
1277
1138
|
failures.push(...(prodParityFailures ?? [])); // #5284: topology.prod_parity
|
|
1278
1139
|
failures.push(...interfaceDecisionFailures(contract, result, changedFiles)); // #5338
|
|
1279
1140
|
failures.push(...(seamFailures ?? [])); // #5338: a declared interface's provider and consumer no longer agree
|
|
1280
|
-
return { ok: failures.length === 0, failures, superseded, ciCovered, equivalent };
|
|
1141
|
+
return { ok: failures.length === 0, failures, superseded, ciCovered, equivalent: [] };
|
|
1281
1142
|
}
|
|
1282
1143
|
|
|
1283
1144
|
/**
|
|
@@ -1360,26 +1221,6 @@ export function alreadyFixedOnBase(failures = [], changedFiles = [], ignore = []
|
|
|
1360
1221
|
return failures.some((f) => f.kind === "repro_base_green") && failures.every((f) => f.kind === "repro_base_green" || f.kind === "source_deliverable_untouched");
|
|
1361
1222
|
}
|
|
1362
1223
|
|
|
1363
|
-
const EXEMPT_RE = /hotspot-exempt:\s*\S/i;
|
|
1364
|
-
/**
|
|
1365
|
-
* forge#4195: a changed file already over `file_lines` (not generated, vendored or glob-excluded; forge#4519: a
|
|
1366
|
-
* `generated` row, from linguist-generated, maintenance.generated_paths or a generated header, never counts) that grew by more
|
|
1367
|
-
* than `growth_lines` since the base, with no `hotspot-exempt: <reason>` in a covering deliverable's change or an
|
|
1368
|
-
* add-deliverable amendment's why. `hotspots` is scripts/hotspots.sh --base output; null or disabled checks nothing.
|
|
1369
|
-
*/
|
|
1370
|
-
export function hotspotGrowth({ contract, result, hotspots, changedFiles = [] }) {
|
|
1371
|
-
if (!hotspots || hotspots.enabled === false || !Array.isArray(hotspots.files)) return [];
|
|
1372
|
-
const limit = Number(hotspots.growth_lines) || 0, max = Number(hotspots.file_lines) || 0;
|
|
1373
|
-
const changed = new Set(changedFiles.map(cleanPath));
|
|
1374
|
-
const amends = Array.isArray(result?.amendments) ? result.amendments : [];
|
|
1375
|
-
const exempt = (f) => (contract?.deliverables ?? []).some((d) => pathCovers(d.path, f) && EXEMPT_RE.test(String(d.change ?? "")))
|
|
1376
|
-
|| amends.some((a) => a?.kind === "add-deliverable" && pathCovers(a.path, f) && EXEMPT_RE.test(String(a.why ?? "")));
|
|
1377
|
-
return hotspots.files
|
|
1378
|
-
.filter((h) => h?.over && !h.excluded && !h.generated && Number(h.growth) > limit && changed.has(cleanPath(h.path)) && !exempt(h.path))
|
|
1379
|
-
.map((h) => ({ code: C.MAINTENANCE_HOTSPOT_GROWTH, kind: "hotspot_growth",
|
|
1380
|
-
detail: `${h.path} grew by ${h.growth} lines (now ${h.lines}, limit +${limit} over ${max}) without hotspot-exempt` }));
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
1224
|
/** The reviewer's JSON object (a json fence first, then the outermost braces), or null. */
|
|
1384
1225
|
export function parseReview(text) {
|
|
1385
1226
|
const s = String(text ?? "");
|
|
@@ -1578,6 +1419,9 @@ export function prodOnlyE2e(quote) {
|
|
|
1578
1419
|
const LIVE_INFRA_RE = /\b(?:live|paid|remote)\s+(?:benchmarks?|runs?|infra(?:structure)?|hosts?)\b|\bbench(?:mark)?[\w.-]*\.(?:mjs|js|py|sh)\b|\bre-?run\b[^.]{0,60}\bbench(?:mark)?\b|\b(?:sandbox pool|(?:remote|rented|cloud|gpu) (?:infra|hosts?|runners?|clusters?|boxe?s?|machines?|gpus?|pool)|on (?:a|the) (?:remote|rented|cloud|gpu) \w+)\b|\bsynthetic load\b|\b\d+\s*[×x]\s*(?:nproc|cores?|cpus?)\b|\bCPU hogs?\b|\bhost[- ]level (?:load|run)\b|\b[≤<]=?\s*[\d.]+\s*[×x]\s*(?:the\s+)?(?:control\s+)?cost\b/i;
|
|
1579
1420
|
/** #5524: production observation windows without a URL: a metric/alert window, "at the next <weekday>", current volume, a prod host. */
|
|
1580
1421
|
const PROD_WINDOW_RE = /\b(?:over|for|within|across)\s+(?:the\s+(?:last|next)\s+)?\d+\s*(?:h|hrs?|hours?|d|days?|w|weeks?|min|minutes?)\b|\bat the next (?:mon|tues?|wednes|thurs?|fri|sat(?:ur)?|sun)(?:day)?\b|\bat current (?:volume|traffic|load)\b|\bon (?:OVH|prod(?:uction)?)\b|\b\w*Slo\w*Burn\w*\b|\bSLO\b|\b(?:does not|doesn't|did not) fire\b/i;
|
|
1422
|
+
/** #6051: a metric / replay / production-measurement criterion ("Metric: ... stays under X% over a real batch"): measured on real traffic after deploy, not by the lane. */
|
|
1423
|
+
const METRIC_REPLAY_RE = /^\s*(?:\*\*)?metric\b\s*(?:\*\*)?\s*:|\bover (?:a|the) (?:real|production|live) (?:batch|traffic|corpus|sample|inputs?|runs?)\b|\b(?:replay|replays|replayed)\b[^.]{0,80}\b(?:real|recorded|production|prod)\b|\b(?:real|recorded|production|prod)\b[^.]{0,80}\breplay\b/i;
|
|
1424
|
+
export function metricReplayRow(quote) { return METRIC_REPLAY_RE.test(String(quote ?? "")); }
|
|
1581
1425
|
/**
|
|
1582
1426
|
* #5468: rewrite production-only e2e/manual rows (deliver or defer; only `only` ids when given) to `post-deploy` with a generated
|
|
1583
1427
|
* check id. Pure; returns {contract, converted:[{id, check, entry}]}. A row with no probeable URL becomes a checkless post-deploy row (check: null).
|
|
@@ -1585,6 +1429,10 @@ const PROD_WINDOW_RE = /\b(?:over|for|within|across)\s+(?:the\s+(?:last|next)\s+
|
|
|
1585
1429
|
export function autoPostDeployE2e(contract, only = null) {
|
|
1586
1430
|
const converted = [];
|
|
1587
1431
|
const requirements = (Array.isArray(contract?.requirements) ? contract.requirements : []).map((r) => {
|
|
1432
|
+
if (["deliver", "defer"].includes(r?.disposition) && !wantsE2e(r) && !isGuidance(r) && !(only && !only.includes(r.id)) && !isOutOfBand(r) && metricReplayRow(r.quote)) { // #6051: a measurement over real production inputs is a checkless post-deploy row (outcome evidence), as #5524
|
|
1433
|
+
converted.push({ id: r.id, check: null, entry: null });
|
|
1434
|
+
return { ...r, disposition: "post-deploy", bucket: "post-deploy", local_infeasible_why: "the criterion is a metric or replay over real production inputs, measured after deploy", why: "metric/replay/production-measurement criterion: tracked post-deploy as outcome evidence, not a lane deliverable (#6051)" };
|
|
1435
|
+
}
|
|
1588
1436
|
if (!["deliver", "defer"].includes(r?.disposition) || !wantsE2e(r) || (only && !only.includes(r.id)) || isOutOfBand(r) || !prodOnlyE2e(r.quote)) return r;
|
|
1589
1437
|
const g = e2eCheckFor(r.id, r.quote);
|
|
1590
1438
|
if (!g && LIVE_INFRA_RE.test(String(r.quote))) { // #5547: needs a paid/remote/host-level run: a checkless row for the orchestrator (its why names spend and a third-party host so deferChecklessPostDeploy routes it)
|
|
@@ -1691,9 +1539,18 @@ export function decide(raw, ctx) {
|
|
|
1691
1539
|
if (!comp.complete) return { state: "review.incomplete", failures: comp.problems.map((d) => ({ code: C.REVIEW_INCOMPLETE, detail: d })), missing: comp.missing, review: rv };
|
|
1692
1540
|
const f = [], converted = [];
|
|
1693
1541
|
const amendedOf = (ids) => (ctx.contract.requirements ?? []).find((r) => r.amendment?.text && (ids ?? []).includes(r.id));
|
|
1694
|
-
|
|
1542
|
+
// #6051: an amendment citing a frozen decision (D#/K#) is weighed against it, not rejected outright
|
|
1543
|
+
const citedDecision = (r) => (ctx.contract.decisions ?? []).find((d) => d?.id && new RegExp(`\\b${d.id}\\b`).test(`${r.amendment?.text ?? ""} ${r.amendment?.why ?? ""}`));
|
|
1544
|
+
const notAccepted = (r) => { if (!r) return ""; const d = citedDecision(r); return `${d ? `amendment cites frozen decision ${d.id} ("${String(d.choice ?? "").slice(0, 120)}"), judged against it` : "amendment not accepted"} (${r.id} amended to "${String(r.amendment.text).slice(0, 200)}"): `; };
|
|
1545
|
+
const named = (c) => { const ids = Array.isArray(c?.contract_ids) ? c.contract_ids : []; const reqs = ctx.contract.requirements ?? []; return ids.length ? reqs.filter((r) => ids.includes(r.id)) : reqs.filter((r) => r.quote === c?.quote); };
|
|
1546
|
+
const followUps = [], decisionBacked = [];
|
|
1695
1547
|
for (const c of rv.issue_coverage) if (c.misclassified === true) f.push({ code: C.CONFORMANCE_OMISSION, detail: `guidance row misclassified: "${c.quote}" is a symptom or success criterion, judge it as binding${c.note ? ` (${c.note})` : ""}` });
|
|
1696
|
-
else if (c.status !== "covered" && !guidanceCoverage(c, ctx.contract))
|
|
1548
|
+
else if (c.status !== "covered" && !guidanceCoverage(c, ctx.contract)) {
|
|
1549
|
+
const rows = named(c);
|
|
1550
|
+
if (rows.length && rows.every((r) => r.disposition === "defer" || r.disposition === "post-deploy")) followUps.push({ quote: c.quote, ids: rows.map((r) => r.id) }); // #6051: a frozen defer/post-deploy row is a tracked follow-up, not an omission
|
|
1551
|
+
else if (c.status === "narrowed" && rows.some((r) => r.amendment?.text && citedDecision(r))) decisionBacked.push({ quote: c.quote, ids: rows.map((r) => r.id), decision: citedDecision(rows.find((r) => r.amendment?.text && citedDecision(r))).id }); // #6051: a narrowing the amendment backs with a frozen decision is weighed against it, not an omission; a missing row still is one
|
|
1552
|
+
else f.push({ code: C.CONFORMANCE_OMISSION, detail: `${notAccepted(amendedOf(c.contract_ids))}issue requirement ${c.status}: "${c.quote}"${c.note ? ` (${c.note})` : ""}` });
|
|
1553
|
+
}
|
|
1697
1554
|
for (const r of ctx.contract.requirements) {
|
|
1698
1555
|
if (isGuidance(r)) continue; // #5750: the outcome rows are judged, never whether the proposal was followed
|
|
1699
1556
|
const row = rv.requirements.find((x) => x.id === r.id);
|
|
@@ -1701,7 +1558,7 @@ export function decide(raw, ctx) {
|
|
|
1701
1558
|
// #4404: the measured result lives in the named job; only the instrumentation is judged here
|
|
1702
1559
|
if (row.instrumented !== true) f.push({ code: C.CONFORMANCE_UNIMPLEMENTED, detail: `${r.id} verified out of band${r.evidence ? ` by ${r.evidence}` : ""}: instrumentation missing${row.note ? `: ${row.note}` : ""}${row.evidence ? ` (${row.evidence})` : ""}` });
|
|
1703
1560
|
} else if (r.disposition === "deliver" && row.status !== "implemented") {
|
|
1704
|
-
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.derived_outcome ? `${r.id} derived outcome not met ("${String(r.derived_outcome).slice(0, 200)}"): ` : `${r.id} `}${row.status}${row.note ? `: ${row.note}` : ""}${row.evidence ? ` (${row.evidence})` : ""}` });
|
|
1561
|
+
f.push({ code: ["deferred", "post-deploy"].includes(row.status) ? C.CONFORMANCE_UNTRACKED_DEFERRAL : C.CONFORMANCE_UNIMPLEMENTED, kind: "review_unimplemented", detail: `${r.amendment?.text ? `${r.id} amendment not accepted (amended to "${String(r.amendment.text).slice(0, 200)}"): ` : r.derived_outcome ? `${r.id} derived outcome not met ("${String(r.derived_outcome).slice(0, 200)}"): ` : `${r.id} `}${row.status}${row.note ? `: ${row.note}` : ""}${row.evidence ? ` (${row.evidence})` : ""}` });
|
|
1705
1562
|
} else if (r.disposition === "deliver" && wantsE2e(r) && !e2eVerified(row, ctx.contract, ctx.e2e)) {
|
|
1706
1563
|
const faked = (ctx.e2e?.faked ?? []).length ? `; faked or mocked components in ${ctx.e2e.faked.slice(0, 3).join(", ")}` : "";
|
|
1707
1564
|
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${ctx.e2e?.sandboxes?.length ? `; it can run pre-merge: declare env: [${ctx.e2e.sandboxes.slice(0, 3).join(", ")}] on its validate to use the test sandbox (#5450), do not defer it` : ""}` });
|
|
@@ -1722,10 +1579,10 @@ export function decide(raw, ctx) {
|
|
|
1722
1579
|
}
|
|
1723
1580
|
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}` : ""}` });
|
|
1724
1581
|
for (const r of rv.regressions ?? []) f.push({ code: C.CONFORMANCE_REGRESSION, detail: `${r?.at ?? "?"}: ${r?.failure ?? ""}` });
|
|
1725
|
-
if (f.length) return { state: "nonconforming", failures: f, inconsistent: rv.verdict === "CONFORMS", review: rv, converted };
|
|
1582
|
+
if (f.length) return { state: "nonconforming", failures: f, inconsistent: rv.verdict === "CONFORMS", review: rv, converted, followUps, decisionBacked };
|
|
1726
1583
|
// A NONCONFORMING verdict with every row passing gives the builder nothing to fix: re-ask the reviewer.
|
|
1727
1584
|
if (rv.verdict !== "CONFORMS") return { state: "review.inconsistent", failures: [{ code: C.REVIEW_INCONSISTENT, detail: "verdict NONCONFORMING with no failing row" }], missing: ["verdict"], review: rv };
|
|
1728
|
-
return { state: "conforms", failures: [], review: rv, converted };
|
|
1585
|
+
return { state: "conforms", failures: [], review: rv, converted, followUps, decisionBacked };
|
|
1729
1586
|
}
|
|
1730
1587
|
|
|
1731
1588
|
/** The ids (or sections) a targeted re-ask must fill: requirement ids without a valid row, issue_coverage problems, ...; [] when complete. */
|
|
@@ -2027,6 +1884,41 @@ export function normalizeKindModes(raw) {
|
|
|
2027
1884
|
* @param {{code?: string}[]} failures
|
|
2028
1885
|
* @param {{shadow?: boolean, kinds?: Record<string,string>|null, allow?: string[]}} [o]
|
|
2029
1886
|
*/
|
|
1887
|
+
/**
|
|
1888
|
+
* Advisory gates (#6083, owner-approved cut of 2026-11-26): everything that is about the shape of the work, the environment,
|
|
1889
|
+
* or a reviewer opinion without a failing assertion is recorded on the trajectory and the PR and never parks a lane. Measured
|
|
1890
|
+
* on 400 issues per repo (inventory on #6083): these rows caused 35-65% of needs-human parks and ~$500 of resume cost, and
|
|
1891
|
+
* the data shows no real defect they caught. What still blocks: a frozen requirement without a passing linked test
|
|
1892
|
+
* (test_missing/test_weak), validate_failed, bug repro red-green, source_deliverable_untouched, conformance.regression,
|
|
1893
|
+
* conformance.omission, ci.red, DCO, builder.blocked/no_commit, base-conflict handling.
|
|
1894
|
+
* forge.yaml engine.conformance_kinds `<code>=enforce` re-promotes a code listed here.
|
|
1895
|
+
*/
|
|
1896
|
+
export const ADVISORY_CODES = Object.freeze([
|
|
1897
|
+
OUTCOME_CODES.CONFORMANCE_SCOPE_CREEP, OUTCOME_CODES.CONFORMANCE_E2E_UNVERIFIED, OUTCOME_CODES.CONFORMANCE_UNTRACKED_DEFERRAL,
|
|
1898
|
+
OUTCOME_CODES.CONFORMANCE_UNJUSTIFIED_DEFERRAL, OUTCOME_CODES.CONFORMANCE_PRESERVE_VIOLATED, OUTCOME_CODES.CONFORMANCE_GUARD_BROKEN,
|
|
1899
|
+
OUTCOME_CODES.ENV_TOOL_MISSING, OUTCOME_CODES.ENV_REPRO_UNRUNNABLE, ENV_VALIDATE_TIMEOUT, OUTCOME_CODES.CONTRACT_INVALID_COMMAND,
|
|
1900
|
+
]);
|
|
1901
|
+
export const ADVISORY_KINDS = Object.freeze([
|
|
1902
|
+
"review_unimplemented",
|
|
1903
|
+
"validate_missing", "validate_command_invalid", "validate_timeout", "validate_env", "validate_drift",
|
|
1904
|
+
"repro_env", "repro_mutation_survivor", "mutation_survived", "dep_install",
|
|
1905
|
+
"e2e_row", "e2e_placement", "ui_browser_unverified",
|
|
1906
|
+
"route_unreachable", "relaxation_untested", "coupled_file_missing", "activation_missing", "mode_unreachable",
|
|
1907
|
+
"decision_unsuperseded", "interface_seam",
|
|
1908
|
+
]);
|
|
1909
|
+
/** Kind families (page_*, design_*, outcome_evidence_*, prod_parity_*) that are advisory as a whole. */
|
|
1910
|
+
export const ADVISORY_KIND_PREFIXES = Object.freeze(["page_", "design_", "outcome_evidence_", "prod_parity_"]);
|
|
1911
|
+
const isAdvisory = (f) => ADVISORY_KINDS.includes(f?.kind) || ADVISORY_CODES.includes(f?.code) || ADVISORY_KIND_PREFIXES.some((p) => String(f?.kind ?? "").startsWith(p));
|
|
1912
|
+
/**
|
|
1913
|
+
* Split failures into {block, advisory}; advisory rows are reported on the issue and never park a lane. `enforce`: codes
|
|
1914
|
+
* a repo explicitly set to "enforce" (forge.yaml engine.conformance_kinds), which stay blocking.
|
|
1915
|
+
*/
|
|
1916
|
+
export function splitAdvisory(failures, { enforce = [] } = {}) {
|
|
1917
|
+
const block = [], advisory = [];
|
|
1918
|
+
for (const f of failures ?? []) (!enforce.includes(f?.code) && !enforce.includes(f?.kind) && isAdvisory(f) ? advisory : block).push(f);
|
|
1919
|
+
return { block, advisory };
|
|
1920
|
+
}
|
|
1921
|
+
|
|
2030
1922
|
export function blockingFailures(failures, { shadow = false, kinds = null, allow = [] } = {}) {
|
|
2031
1923
|
const block = [], record = [];
|
|
2032
1924
|
for (const f of failures ?? []) {
|