forgedock 1.57.0 → 1.58.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/engine/outcome-codes.mjs +1 -1
- package/bin/engine-cli.mjs +2 -2
- package/bin/help-text.mjs +1 -1
- package/bin/lean/conformance.mjs +30 -3
- package/bin/lean/conformance.test.mjs +74 -0
- package/bin/lean/decisions.mjs +12 -0
- package/bin/lean/decisions.test.mjs +9 -0
- package/bin/lean/issuewatch-parity.mjs +4 -1
- package/bin/lean/issuewatch-parity.test.mjs +6 -0
- package/bin/lean/lean.mjs +41 -6
- package/bin/lean/lean.test.mjs +34 -1
- package/bin/lean/recovery.test.mjs +3 -3
- package/bin/lean/release-config.mjs +18 -7
- package/bin/lean/release-config.test.mjs +23 -0
- package/bin/lean/release-control.mjs +26 -3
- package/bin/lean/release-control.test.mjs +24 -0
- package/bin/lean/release-deploy.mjs +209 -0
- package/bin/lean/release-deploy.test.mjs +217 -0
- package/bin/lean/release-gates.mjs +230 -0
- package/bin/lean/release-gates.test.mjs +146 -0
- package/bin/lean/release-ledger.mjs +16 -0
- package/bin/lean/release-ledger.test.mjs +3 -3
- package/bin/lean/release-minutes.mjs +12 -2
- package/bin/lean/release-minutes.test.mjs +8 -0
- package/bin/lean/release-status.mjs +300 -0
- package/bin/lean/release-status.test.mjs +220 -0
- package/bin/lean/release-verify.mjs +221 -0
- package/bin/lean/release-verify.test.mjs +176 -0
- package/bin/lean/release.mjs +70 -6
- package/bin/lean/release.test.mjs +5 -1
- package/docs/CONFIG.md +20 -1
- package/package.json +1 -1
- package/scripts/ci-local/scoping.mjs +19 -0
- package/scripts/ci-local.test.sh +13 -0
|
@@ -236,7 +236,7 @@ function classifyNeedsHumanBase(row) {
|
|
|
236
236
|
if (outcome === "budget-exceeded") return "recoverable";
|
|
237
237
|
if (outcome !== "needs-human") return "terminal";
|
|
238
238
|
if (HUMAN_CODES.includes(row.code)) return "human";
|
|
239
|
-
if (row.code === OUTCOME_CODES.CONTRACT_INVALID) return
|
|
239
|
+
if (row.code === OUTCOME_CODES.CONTRACT_INVALID) return "recoverable"; // #5623: a fresh plan (one recovery requeue) before a person is asked
|
|
240
240
|
return RECOVERABLE_CODES.includes(row.code) ? "recoverable" : "terminal";
|
|
241
241
|
}
|
|
242
242
|
|
package/bin/engine-cli.mjs
CHANGED
|
@@ -1062,7 +1062,7 @@ export async function runFromCli(argv, deps = {}) {
|
|
|
1062
1062
|
...(rotatorKind({ execution: readExecution(process.cwd()), env }) ? { accountRotator: rotatorKind({ execution: readExecution(process.cwd()), env }) } : {}), // #5094, #5205: detected
|
|
1063
1063
|
onTeardown: (fn) => { teardown = fn; }, ...(env.FORGEDOCK_BATCH_ID ? { batchId: env.FORGEDOCK_BATCH_ID } : {}), ...(placement ? { placement } : {}), ...(recover ? { recover } : {}),
|
|
1064
1064
|
emitTelemetry: deps.emitTelemetry ?? composeEmit(makeEmitTelemetry({ repo: leanRepo }), makeEventEmitter({ repo: leanRepo, config: readEvents() }).emit),
|
|
1065
|
-
admission: readAdmission(), heavy: readHeavy(), ...readCoreLimits(), ...readEnvConfig(), ...(readMergeWait() ? { mergeWait: readMergeWait() } : {}), ...(readConformanceMode() ? { conformance: readConformanceMode() } : {}), ...(readConformanceKinds() ? { conformanceKinds: readConformanceKinds() } : {}), ...(readConformanceMutation() ? { conformanceMutation: "report" } : {}), ...(readContextPack() ? { contextPack: readContextPack() } : {}), ...(readSequenceVersioned() ? { sequenceVersioned: readSequenceVersioned() } : {}), ...(readSharedSurfaces() ? { sharedSurfaces: readSharedSurfaces() } : {}), ...(readReviewIncomplete() ? { reviewIncomplete: readReviewIncomplete() } : {}), ...(readLaneInstructions() ? { laneInstructions: readLaneInstructions() } : {}), ...(readReproTest() ? { reproTest: readReproTest() } : {}), ...(readReproQuality() ? { reproQuality: readReproQuality() } : {}), ...(readExplore() ? { explore: readExplore() } : {}), ...(readExperiment() ? { experiment: readExperiment() } : {}), light: readLight(), ...(readCloseParent() ? { closeParent: true } : {}), ...(readReviewTrigger() ? { reviewTrigger: readReviewTrigger() } : {}), ...(readVerify() ? { verify: readVerify() } : {}), ...readPrecheckOptions(), ...(model ? { builderModel: model } : {}), ...(readLeanSetting("reviewer_model") ? { reviewerModel: readLeanSetting("reviewer_model") } : {}), ...(readFixModel() ? { fixModel: readFixModel() } : {}), ...(readBuilderRouting() ? { builderRouting: readBuilderRouting() } : {}), ...(readVerifier() ? { verifier: readVerifier() } : {}), ...(readHostCaps() ? { hostCaps: readHostCaps() } : {}), ...readRelayCaps(), ...(readSequenceRegenerate() ? { sequenceRegenerate: readSequenceRegenerate() } : {}), ...(readBaseMerge() ? { baseMerge: readBaseMerge() } : {}), ...(readFollowupsDefaultMilestone() ? { followupsDefaultMilestone: readFollowupsDefaultMilestone() } : {}), ...(readFollowupsRollupLabel() ? { followupsRollupLabel: readFollowupsRollupLabel() } : {}) });
|
|
1065
|
+
admission: readAdmission(), heavy: readHeavy(), ...readCoreLimits(), ...readEnvConfig(), ...(readMergeWait() ? { mergeWait: readMergeWait() } : {}), ...(readConformanceMode() ? { conformance: readConformanceMode() } : {}), ...(readConformanceKinds() ? { conformanceKinds: readConformanceKinds() } : {}), ...(readConformanceMutation() ? { conformanceMutation: "report" } : {}), ...(readContextPack() ? { contextPack: readContextPack() } : {}), ...(readSequenceVersioned() ? { sequenceVersioned: readSequenceVersioned() } : {}), ...(readSharedSurfaces() ? { sharedSurfaces: readSharedSurfaces() } : {}), ...(readReviewIncomplete() ? { reviewIncomplete: readReviewIncomplete() } : {}), ...(readLaneInstructions() ? { laneInstructions: readLaneInstructions() } : {}), ...(readReproTest() ? { reproTest: readReproTest() } : {}), ...(readReproQuality() ? { reproQuality: readReproQuality() } : {}), ...(readExplore() ? { explore: readExplore() } : {}), ...(readExperiment() ? { experiment: readExperiment() } : {}), light: readLight(), ...(readCloseParent() ? { closeParent: true } : {}), ...(readReviewTrigger() ? { reviewTrigger: readReviewTrigger() } : {}), ...(readVerify() ? { verify: readVerify() } : {}), ...readPrecheckOptions(), ...(model ? { builderModel: model } : {}), ...(readLeanSetting("reviewer_model") ? { reviewerModel: readLeanSetting("reviewer_model") } : {}), ...(readFixModel() ? { fixModel: readFixModel() } : {}), ...(readBuilderRouting() ? { builderRouting: readBuilderRouting() } : {}), ...(readVerifier() ? { verifier: readVerifier() } : {}), ...(readHostCaps() ? { hostCaps: readHostCaps() } : {}), ...readRelayCaps(), ...(readSequenceRegenerate() ? { sequenceRegenerate: readSequenceRegenerate() } : {}), ...(readBaseMerge() ? { baseMerge: readBaseMerge() } : {}), ...(readFollowupsDefaultMilestone() ? { followupsDefaultMilestone: readFollowupsDefaultMilestone() } : {}), ...(readFollowupsRollupLabel() ? { followupsRollupLabel: readFollowupsRollupLabel() } : {}), ...(Number.isInteger(Number(readLeanSetting("contract_max_corrections"))) && Number(readLeanSetting("contract_max_corrections")) >= 1 ? { contractMaxCorrections: Number(readLeanSetting("contract_max_corrections")) } : {}) });
|
|
1066
1066
|
} catch (e) { if (!interrupted) report({ terminalReason: "engine-error", detail: String(e?.message ?? e).slice(0, 500) }); throw e; }
|
|
1067
1067
|
finally { if (!interrupted) for (const [sig, f] of Object.entries(handlers)) off(sig, f); }
|
|
1068
1068
|
if (interrupted) return lres; // the signal handler reported and exits
|
|
@@ -1915,7 +1915,7 @@ export async function runBatch({ argv, cwd: callerCwd = process.cwd(), env: call
|
|
|
1915
1915
|
lanes = { adopt: null, runOne: (n, ln, ctx = {}) => runCore({ issue: n, repo, lane: ln, deferPostRun: true, // #5437: orchestrate runs result.postRun once the slot is free
|
|
1916
1916
|
laneOverride, ...(ctx.placement ? { placement: { ...ctx.placement, mode: execMode() } } : {}), ...(ctx.recover ? { recover: ctx.recover } : {}), branches, cwd, dir, io: leanIo, agentId: `orch_${process.pid}_${n}`, emitTelemetry, batchId: batch.id,
|
|
1917
1917
|
...(rotatorKind({ execution: readExecution(cwd), env }) ? { accountRotator: rotatorKind({ execution: readExecution(cwd), env }) } : {}), // #5094, #5205: detected
|
|
1918
|
-
admission: readAdmission(cwd), heavy: readHeavy(cwd), ...readCoreLimits(cwd), ...readEnvConfig(cwd), ...(readMergeWait(cwd) ? { mergeWait: readMergeWait(cwd) } : {}), ...(readConformanceMode(cwd) ? { conformance: readConformanceMode(cwd) } : {}), ...(readConformanceKinds(cwd) ? { conformanceKinds: readConformanceKinds(cwd) } : {}), ...(readConformanceMutation(cwd) ? { conformanceMutation: "report" } : {}), ...(readContextPack(cwd) ? { contextPack: readContextPack(cwd) } : {}), ...(readSequenceVersioned(cwd) ? { sequenceVersioned: readSequenceVersioned(cwd) } : {}), ...(readSharedSurfaces(cwd) ? { sharedSurfaces: readSharedSurfaces(cwd) } : {}), ...(readReviewIncomplete(cwd) ? { reviewIncomplete: readReviewIncomplete(cwd) } : {}), ...(readLaneInstructions(cwd) ? { laneInstructions: readLaneInstructions(cwd) } : {}), ...(readReproTest(cwd) ? { reproTest: readReproTest(cwd) } : {}), ...(readReproQuality(cwd) ? { reproQuality: readReproQuality(cwd) } : {}), ...(readExplore(cwd) ? { explore: readExplore(cwd) } : {}), ...(readExperiment(cwd) ? { experiment: readExperiment(cwd) } : {}), light: readLight(cwd), ...(readCloseParent(cwd) ? { closeParent: true } : {}), ...(readReviewTrigger(cwd) ? { reviewTrigger: readReviewTrigger(cwd) } : {}), ...(readVerify(cwd) ? { verify: readVerify(cwd) } : {}), ...readPrecheckOptions(cwd), ...(model ? { builderModel: model } : {}), ...(readLeanSetting("reviewer_model", cwd) ? { reviewerModel: readLeanSetting("reviewer_model", cwd) } : {}), ...(readFixModel(cwd) ? { fixModel: readFixModel(cwd) } : {}), ...(readBuilderRouting(cwd) ? { builderRouting: readBuilderRouting(cwd) } : {}), ...(readVerifier(cwd) ? { verifier: readVerifier(cwd) } : {}), ...(readHostCaps(cwd) ? { hostCaps: readHostCaps(cwd) } : {}), ...readRelayCaps(), ...(readSequenceRegenerate(cwd) ? { sequenceRegenerate: readSequenceRegenerate(cwd) } : {}), ...(readBaseMerge(cwd) ? { baseMerge: readBaseMerge(cwd) } : {}), ...(readFollowupsDefaultMilestone(cwd) ? { followupsDefaultMilestone: readFollowupsDefaultMilestone(cwd) } : {}), ...(readFollowupsRollupLabel(cwd) ? { followupsRollupLabel: readFollowupsRollupLabel(cwd) } : {}) }) };
|
|
1918
|
+
admission: readAdmission(cwd), heavy: readHeavy(cwd), ...readCoreLimits(cwd), ...readEnvConfig(cwd), ...(readMergeWait(cwd) ? { mergeWait: readMergeWait(cwd) } : {}), ...(readConformanceMode(cwd) ? { conformance: readConformanceMode(cwd) } : {}), ...(readConformanceKinds(cwd) ? { conformanceKinds: readConformanceKinds(cwd) } : {}), ...(readConformanceMutation(cwd) ? { conformanceMutation: "report" } : {}), ...(readContextPack(cwd) ? { contextPack: readContextPack(cwd) } : {}), ...(readSequenceVersioned(cwd) ? { sequenceVersioned: readSequenceVersioned(cwd) } : {}), ...(readSharedSurfaces(cwd) ? { sharedSurfaces: readSharedSurfaces(cwd) } : {}), ...(readReviewIncomplete(cwd) ? { reviewIncomplete: readReviewIncomplete(cwd) } : {}), ...(readLaneInstructions(cwd) ? { laneInstructions: readLaneInstructions(cwd) } : {}), ...(readReproTest(cwd) ? { reproTest: readReproTest(cwd) } : {}), ...(readReproQuality(cwd) ? { reproQuality: readReproQuality(cwd) } : {}), ...(readExplore(cwd) ? { explore: readExplore(cwd) } : {}), ...(readExperiment(cwd) ? { experiment: readExperiment(cwd) } : {}), light: readLight(cwd), ...(readCloseParent(cwd) ? { closeParent: true } : {}), ...(readReviewTrigger(cwd) ? { reviewTrigger: readReviewTrigger(cwd) } : {}), ...(readVerify(cwd) ? { verify: readVerify(cwd) } : {}), ...readPrecheckOptions(cwd), ...(model ? { builderModel: model } : {}), ...(readLeanSetting("reviewer_model", cwd) ? { reviewerModel: readLeanSetting("reviewer_model", cwd) } : {}), ...(readFixModel(cwd) ? { fixModel: readFixModel(cwd) } : {}), ...(readBuilderRouting(cwd) ? { builderRouting: readBuilderRouting(cwd) } : {}), ...(readVerifier(cwd) ? { verifier: readVerifier(cwd) } : {}), ...(readHostCaps(cwd) ? { hostCaps: readHostCaps(cwd) } : {}), ...readRelayCaps(), ...(readSequenceRegenerate(cwd) ? { sequenceRegenerate: readSequenceRegenerate(cwd) } : {}), ...(readBaseMerge(cwd) ? { baseMerge: readBaseMerge(cwd) } : {}), ...(readFollowupsDefaultMilestone(cwd) ? { followupsDefaultMilestone: readFollowupsDefaultMilestone(cwd) } : {}), ...(readFollowupsRollupLabel(cwd) ? { followupsRollupLabel: readFollowupsRollupLabel(cwd) } : {}), ...(Number.isInteger(Number(readLeanSetting("contract_max_corrections", cwd))) && Number(readLeanSetting("contract_max_corrections", cwd)) >= 1 ? { contractMaxCorrections: Number(readLeanSetting("contract_max_corrections", cwd)) } : {}) }) };
|
|
1919
1919
|
} else {
|
|
1920
1920
|
const laneScript = deps.laneScript ?? fileURLToPath(new URL("./forgedock.mjs", import.meta.url));
|
|
1921
1921
|
// #4690: lanes learn K (the default MemoryMax is derived from it); one line says so when no scope caps them.
|
package/bin/help-text.mjs
CHANGED
|
@@ -101,7 +101,7 @@ export const FULL_COMMAND_GROUPS = [
|
|
|
101
101
|
["npx forgedock review-staging [<PR>] --finalize --test-gate-output <file>", "Staging->main review post-dispatch: delivery, test-gate verdict, extract/classify/file-prepare; prints the findings to file"],
|
|
102
102
|
["npx forgedock review-staging [<PR>] --summary [--filed <N>]...", "Staging->main review Phase 8: verdict and summary comment with the FORGE:GATE_PASS / FORGE:GATE_FAILURE marker"],
|
|
103
103
|
["npx forgedock intake pause|resume|status [--reason \"...\"] [--tracker <issue>] [--release <id>] [--repo owner/repo]", "Managed releases (release.managed): write _active.intake and the forge:intake-paused label on the tracker; the issue watch reads it from GitHub, so every host stops claiming (also while a release/*, train/* or hotfix/* PR is open or a ledger entry is active); freeze.intake_auto_resume resumes when the named release ends"],
|
|
104
|
-
["npx forgedock release [--repo owner/repo] [--merge] [--watch] [--resume <id>] | release verify <sha> [--repo owner/repo]", "Staging->default release as one resumable job: preflight, release PR, review, fixes, promotion (stops at GATE_PASS unless --merge or release.auto_merge), post-merge; release.mode: snapshot cuts release/<id> from staging (lanes keep merging, fixes are cherry-picked, FORGE:RELEASE records them); verify checks a release head against that record"],
|
|
104
|
+
["npx forgedock release [--repo owner/repo] [--merge] [--watch] [--resume <id>] | release verify <sha> [--repo owner/repo] | release status [<id>] [--watch] [--interval s] [--json] | release explain <id | #issue | PR> [--json]", "Staging->default release as one resumable job: preflight, release PR, review, fixes, promotion (stops at GATE_PASS unless --merge or release.auto_merge), post-merge; release.mode: snapshot cuts release/<id> from staging (lanes keep merging, fixes are cherry-picked, FORGE:RELEASE records them); verify checks a release head against that record; status/explain are read-only views of the ledger plus GitHub (--watch re-polls, printing on change, until a terminal state) (JSON schema forgedock.release.*/v1 with next_actions)"],
|
|
105
105
|
]],
|
|
106
106
|
["Maintenance and hosting", [
|
|
107
107
|
["npx forgedock fix-close-reasons <owner/repo> [--milestone <m>] [--apply]", "Re-close issues that were closed not planned but carry workflow:merged or workflow:decomposed (delivered, not dropped) as completed, with a comment; dry run unless --apply; workflow:invalid issues are never touched"],
|
package/bin/lean/conformance.mjs
CHANGED
|
@@ -33,7 +33,7 @@ export const MIN_QUOTE_CHARS = 12;
|
|
|
33
33
|
/** A contract larger than this cannot be posted whole in one comment (the comment cap is 60k). */
|
|
34
34
|
export const MAX_CONTRACT_CHARS = 40000;
|
|
35
35
|
import { CHECK_ID_RE, e2eCheckFor } from "./postdeploy-check.mjs";
|
|
36
|
-
import { normaliseDecision, deadAnchors, anchorMatches } from "./decisions.mjs";
|
|
36
|
+
import { normaliseDecision, deadAnchors, anchorMatches, parseRequirementDecision } from "./decisions.mjs";
|
|
37
37
|
import { globToRegex } from "../../scripts/ci-local/lib.mjs";
|
|
38
38
|
import { contractBriefProblems } from "./pagegate.mjs"; // #5428
|
|
39
39
|
const C = OUTCOME_CODES;
|
|
@@ -1433,7 +1433,9 @@ export function checkCompleteness(rv, { contract, changedFiles, issueText, pathE
|
|
|
1433
1433
|
|
|
1434
1434
|
|
|
1435
1435
|
/** #4726, #5339: a requirement quote that carries a `[type:e2e]` or `[type:manual]` criterion. */
|
|
1436
|
-
|
|
1436
|
+
/** #5547: a tag inside a mid-sentence code span (`` `[type:e2e]` row whose ... ``) is a mention of the tag, not the tag; a trailing backticked tag still counts. */
|
|
1437
|
+
const tagText = (q) => String(q ?? "").replace(/`[^`\n]*`/g, (span, at, all) => (/[^\s.,;:)]/.test(all.slice(at + span.length).replace(/`[^`\n]*\[type:[^`\n]*`/g, "")) ? "" : span));
|
|
1438
|
+
const wantsE2e = (r) => /\[type:(?:e2e|manual)\]/i.test(tagText(r?.quote));
|
|
1437
1439
|
/** #5339: failure kinds enforced without an `engine.conformance_kinds` entry (the entry still overrides). */
|
|
1438
1440
|
// #5449: test_missing/test_weak are only generated for bug lanes (testadequacy.mjs), so enforcing the kinds is bug-only.
|
|
1439
1441
|
const DEFAULT_ENFORCED_KINDS = ["e2e_row", "test_missing", "test_weak"];
|
|
@@ -1452,9 +1454,12 @@ export function isE2eCommand(command, e2e = null) {
|
|
|
1452
1454
|
/** #5468: a `[type:e2e]`/`[type:manual]` quote whose observable only exists in production (live URL, deploy, prod probe); local stack, browser and sandbox wording is runnable pre-merge. */
|
|
1453
1455
|
export function prodOnlyE2e(quote) {
|
|
1454
1456
|
const q = String(quote ?? "");
|
|
1457
|
+
if (LIVE_INFRA_RE.test(q)) return true; // #5547
|
|
1455
1458
|
if (/\b(?:localhost|127\.0\.0\.1|local stack|playwright|browser|sandbox|staging)\b/i.test(q)) return false;
|
|
1456
1459
|
return /https?:\/\//i.test(q) || /\b(?:after (?:the )?deploy|production|prod probe|live (?:domain|site)|prod)\b/i.test(q) || PROD_WINDOW_RE.test(q);
|
|
1457
1460
|
}
|
|
1461
|
+
/** #5547: criteria whose run needs a live benchmark, a paid run, remote infra or host-level load: observable only outside the lane, by shape not by repo name. */
|
|
1462
|
+
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;
|
|
1458
1463
|
/** #5524: production observation windows without a URL: a metric/alert window, "at the next <weekday>", current volume, a prod host. */
|
|
1459
1464
|
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;
|
|
1460
1465
|
/**
|
|
@@ -1466,6 +1471,10 @@ export function autoPostDeployE2e(contract, only = null) {
|
|
|
1466
1471
|
const requirements = (Array.isArray(contract?.requirements) ? contract.requirements : []).map((r) => {
|
|
1467
1472
|
if (!["deliver", "defer"].includes(r?.disposition) || !wantsE2e(r) || (only && !only.includes(r.id)) || isOutOfBand(r) || !prodOnlyE2e(r.quote)) return r;
|
|
1468
1473
|
const g = e2eCheckFor(r.id, r.quote);
|
|
1474
|
+
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)
|
|
1475
|
+
converted.push({ id: r.id, check: null, entry: null });
|
|
1476
|
+
return { ...r, e2e_tracked: true, disposition: "post-deploy", bucket: "post-deploy", local_infeasible_why: "the run needs a live benchmark, paid run, remote infra or host-level load that no local fixture provides", why: "live benchmark/paid run/remote infra/host-level load: needs spend or a third-party host the lane cannot run; tracked by the orchestrator (#5547)" };
|
|
1477
|
+
}
|
|
1469
1478
|
if (!g) { // #5524: no probeable URL: a checkless post-deploy row; deferChecklessPostDeploy routes it to the orchestrator
|
|
1470
1479
|
converted.push({ id: r.id, check: null, entry: null });
|
|
1471
1480
|
return { ...r, disposition: "post-deploy", bucket: "post-deploy", local_infeasible_why: "the observable is a production observation window with no probeable URL", why: "production observation window: read-only production telemetry, no probeable URL (#5524)" };
|
|
@@ -1475,6 +1484,24 @@ export function autoPostDeployE2e(contract, only = null) {
|
|
|
1475
1484
|
});
|
|
1476
1485
|
return { contract: converted.length ? { ...contract, requirements } : contract, converted };
|
|
1477
1486
|
}
|
|
1487
|
+
/**
|
|
1488
|
+
* #5547: apply trusted structured operator decisions (`<!-- FORGE:DECISION {"requirement":"R2","disposition":"post-deploy"} -->`) to a
|
|
1489
|
+
* frozen contract: a deliver/defer row becomes a checkless post-deploy row (deferChecklessPostDeploy then routes it). Only comments after
|
|
1490
|
+
* the last FORGE:CONTRACT comment count. Pure; returns {contract, applied:[id]}.
|
|
1491
|
+
*/
|
|
1492
|
+
export function applyRequirementDecisions(contract, comments = []) {
|
|
1493
|
+
const list = Array.isArray(comments) ? comments : [];
|
|
1494
|
+
const at = list.map((c) => String(c?.body ?? "").trimStart().startsWith("<!-- FORGE:CONTRACT")).lastIndexOf(true);
|
|
1495
|
+
const ds = list.slice(at + 1).map((c) => parseRequirementDecision(c?.body)).filter(Boolean);
|
|
1496
|
+
const applied = [];
|
|
1497
|
+
const requirements = (Array.isArray(contract?.requirements) ? contract.requirements : []).map((r) => {
|
|
1498
|
+
const d = ds.find((x) => x.requirement === r?.id);
|
|
1499
|
+
if (!d || !["deliver", "defer"].includes(r.disposition)) return r;
|
|
1500
|
+
applied.push(r.id);
|
|
1501
|
+
return { ...r, e2e_tracked: true, disposition: "post-deploy", bucket: "post-deploy", local_infeasible_why: "operator decision: the run needs spend or a third-party host outside the lane", why: `operator FORGE:DECISION: tracked post-deploy by the orchestrator, needs spend or a third-party host${d.why ? ` (${d.why})` : ""} (#5547)` };
|
|
1502
|
+
});
|
|
1503
|
+
return { contract: applied.length ? { ...contract, requirements } : contract, applied };
|
|
1504
|
+
}
|
|
1478
1505
|
/** #5468: the row ids named by `e2e_row` failures when every failure is one; null otherwise (anything else blocks as before). */
|
|
1479
1506
|
export function loneE2eRows(failures) {
|
|
1480
1507
|
const fs = failures ?? [];
|
|
@@ -1518,7 +1545,7 @@ export function decide(raw, ctx) {
|
|
|
1518
1545
|
} else if (r.disposition === "deliver" && wantsE2e(r) && !e2eVerified(row, ctx.contract, ctx.e2e)) {
|
|
1519
1546
|
const faked = (ctx.e2e?.faked ?? []).length ? `; faked or mocked components in ${ctx.e2e.faked.slice(0, 3).join(", ")}` : "";
|
|
1520
1547
|
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` : ""}` });
|
|
1521
|
-
} else if (r.disposition === "defer" && wantsE2e(r)) {
|
|
1548
|
+
} else if (r.disposition === "defer" && wantsE2e(r) && r.e2e_tracked !== true) { // #5547: an engine-tracked live-infra/operator-decided row is the transfer the gate asks for
|
|
1522
1549
|
// #5339: a deferred e2e/manual requirement is not met; only a post-deploy one is transferred to the epic (the lane closes partial)
|
|
1523
1550
|
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` });
|
|
1524
1551
|
}
|
|
@@ -2023,3 +2023,77 @@ describe("#5524 URL-less production-only e2e/manual rows", () => {
|
|
|
2023
2023
|
assert.equal(deferChecklessPostDeploy(cv.contract).contract.requirements[0].disposition, "defer");
|
|
2024
2024
|
});
|
|
2025
2025
|
});
|
|
2026
|
+
import { applyRequirementDecisions } from "./conformance.mjs";
|
|
2027
|
+
describe("#5547 live-infra, paid and host-load e2e rows", () => {
|
|
2028
|
+
const Q5541 = "re-run `bench-adversarial.mjs run … --arms full,control` on legion, ≤ 1.3× control cost [type:e2e]";
|
|
2029
|
+
const Q5531 = "Under a synthetic load of 4× nproc CPU hogs, `schedd status` answers in < 1 s [type:e2e]";
|
|
2030
|
+
const LOCAL = "The signup page works against the local stack in a browser under load [type:e2e]";
|
|
2031
|
+
const mk = (quote) => ({ ...C, requirements: [{ id: "R1", quote: Q1, disposition: "deliver" }, { id: "R2", quote, disposition: "deliver" }], validate: [{ id: "V1", command: "pytest tests/test_x.py" }] });
|
|
2032
|
+
it("#5547 prodOnlyE2e recognises live-infra shapes, not local rows", () => {
|
|
2033
|
+
for (const q of [Q5541, Q5531, "a paid run of the batch completes [type:manual]", "on a rented GPU box the job finishes [type:e2e]", "on the remote cluster the job finishes [type:e2e]", "a sandbox pool run passes [type:e2e]", "host-level load keeps p99 low [type:e2e]"]) assert.equal(prodOnlyE2e(q), true, q);
|
|
2034
|
+
for (const q of [LOCAL, "sandbox run over 24h [type:e2e]"]) assert.equal(prodOnlyE2e(q), false, q);
|
|
2035
|
+
});
|
|
2036
|
+
it("#5547 live-infra rows convert to a post-deploy defer owned by the orchestrator", () => {
|
|
2037
|
+
for (const q of [Q5541, Q5531]) {
|
|
2038
|
+
const out = autoPostDeployE2e(mk(q));
|
|
2039
|
+
assert.deepEqual(out.converted.map((x) => x.id), ["R2"]);
|
|
2040
|
+
const d = deferChecklessPostDeploy(out.contract);
|
|
2041
|
+
assert.deepEqual(d.converted, ["R2"]);
|
|
2042
|
+
assert.equal(d.contract.requirements[1].disposition, "defer");
|
|
2043
|
+
assert.equal(d.contract.requirements[1].bucket, "owner:orchestrator");
|
|
2044
|
+
assert.equal(d.contract.requirements[0].disposition, "deliver");
|
|
2045
|
+
}
|
|
2046
|
+
assert.equal(autoPostDeployE2e(mk(LOCAL)).converted.length, 0);
|
|
2047
|
+
});
|
|
2048
|
+
it("#5547 the classifier keys on shape, not on host or repo names", () => {
|
|
2049
|
+
for (const q of ["on myhost the job finishes [type:e2e]", "legion of users sign up locally [type:e2e]"]) assert.equal(prodOnlyE2e(q), false, q);
|
|
2050
|
+
});
|
|
2051
|
+
it("#5547 replay: #5531 R2 unchanged converts at review and the lane conforms", () => {
|
|
2052
|
+
const contract = mk(Q5531);
|
|
2053
|
+
const lctx = { ...ctx, contract, issueText: `${ISSUE}\n${Q5531}` };
|
|
2054
|
+
const r = { ...good, issue_coverage: [...good.issue_coverage, { quote: Q5531, status: "covered" }], requirements: [good.requirements[0], { id: "R2", status: "implemented", evidence: "src/search.js:7", validated_by: "V1" }] };
|
|
2055
|
+
const d = decide(r, lctx);
|
|
2056
|
+
assert.equal(d.state, "nonconforming");
|
|
2057
|
+
const ids = loneE2eRows(d.failures);
|
|
2058
|
+
assert.deepEqual(ids, ["R2"]);
|
|
2059
|
+
const eff = deferChecklessPostDeploy(autoPostDeployE2e(contract, ids).contract).contract;
|
|
2060
|
+
assert.equal(eff.requirements[1].disposition, "defer");
|
|
2061
|
+
const d2 = decide({ ...r, requirements: [good.requirements[0], { id: "R2", status: "deferred", evidence: "-", deferral_ok: true }] }, { ...lctx, contract: eff });
|
|
2062
|
+
assert.equal(d2.state, "conforms", JSON.stringify(d2.failures));
|
|
2063
|
+
});
|
|
2064
|
+
it("#5547 a quote that only mentions the tag in a mid-sentence code span is not an e2e row; a trailing backticked tag still is", () => {
|
|
2065
|
+
const R1 = "An `[type:e2e]`/`[type:manual]` row whose quote names a live benchmark, a paid run, remote infra (legion, computeshare, a sandbox pool) or host-level load is converted to a tracked `post-deploy` defer";
|
|
2066
|
+
assert.equal(autoPostDeployE2e(mk(R1)).converted.length, 0, "the mention is not converted to post-deploy");
|
|
2067
|
+
const contract = mk(R1);
|
|
2068
|
+
const lctx = { ...ctx, contract, issueText: `${ISSUE}\n${R1}` };
|
|
2069
|
+
const r = { ...good, issue_coverage: [...good.issue_coverage, { quote: R1, status: "covered" }], requirements: [good.requirements[0], { id: "R2", status: "implemented", evidence: "src/search.js:7", validated_by: "V1" }] };
|
|
2070
|
+
assert.ok(!decide(r, lctx).failures.some((f) => f.kind === "e2e_row"), "no e2e_unverified for a tag mention");
|
|
2071
|
+
assert.deepEqual(autoPostDeployE2e(mk("on a remote host the live benchmark finishes `[type:e2e]`")).converted.map((x) => x.id), ["R2"]);
|
|
2072
|
+
});
|
|
2073
|
+
it("#5547 a structured operator decision amends the frozen row; prose, untargeted and delivered-elsewhere rows are untouched", () => {
|
|
2074
|
+
const contract = mk(Q5531);
|
|
2075
|
+
const dec = (j) => ({ body: `<!-- FORGE:DECISION ${JSON.stringify(j)} -->\n## Decision` });
|
|
2076
|
+
const out = applyRequirementDecisions(contract, [{ body: "<!-- FORGE:CONTRACT -->\n{}" }, dec({ requirement: "R2", disposition: "post-deploy" }), { body: "FORGE:DECISION prose" }]);
|
|
2077
|
+
assert.deepEqual(out.applied, ["R2"]);
|
|
2078
|
+
assert.equal(out.contract.requirements[1].disposition, "post-deploy");
|
|
2079
|
+
assert.equal(deferChecklessPostDeploy(out.contract).contract.requirements[1].bucket, "owner:orchestrator");
|
|
2080
|
+
assert.equal(out.contract.requirements[0].disposition, "deliver");
|
|
2081
|
+
assert.equal(applyRequirementDecisions(contract, [dec({ requirement: "R2", disposition: "deliver" })]).applied.length, 0);
|
|
2082
|
+
assert.equal(applyRequirementDecisions(contract, [dec({ requirement: "R2", disposition: "post-deploy" }), { body: "<!-- FORGE:CONTRACT -->\n{}" }]).applied.length, 0, "a decision older than the contract is ignored");
|
|
2083
|
+
});
|
|
2084
|
+
});
|
|
2085
|
+
|
|
2086
|
+
describe("#5623: builder-correctable contract problems", () => {
|
|
2087
|
+
it("contractSelfCorrectable: shape problems are builder-correctable; a quote-only mismatch is not", async () => {
|
|
2088
|
+
const { contractSelfCorrectable } = await import("./lean.mjs");
|
|
2089
|
+
assert.equal(contractSelfCorrectable(["R7: test_plan no-repro needs a reason the reviewer can reject"]), true);
|
|
2090
|
+
assert.equal(contractSelfCorrectable(["R1: quote is not verbatim", "R7: test_plan no-repro needs a reason the reviewer can reject"]), true);
|
|
2091
|
+
assert.equal(contractSelfCorrectable(["R1: quote is not verbatim"]), false);
|
|
2092
|
+
assert.equal(contractSelfCorrectable([]), false);
|
|
2093
|
+
});
|
|
2094
|
+
it("classifyNeedsHuman: contract.invalid is recoverable (one fresh-plan requeue), with or without an issue edit", async () => {
|
|
2095
|
+
const { classifyNeedsHuman, OUTCOME_CODES } = await import("../engine/outcome-codes.mjs");
|
|
2096
|
+
assert.equal(classifyNeedsHuman({ outcome: "needs-human", code: OUTCOME_CODES.CONTRACT_INVALID }), "recoverable");
|
|
2097
|
+
assert.equal(classifyNeedsHuman({ outcome: "needs-human", code: OUTCOME_CODES.CONTRACT_INVALID, issueEdited: true }), "recoverable");
|
|
2098
|
+
});
|
|
2099
|
+
});
|
package/bin/lean/decisions.mjs
CHANGED
|
@@ -81,6 +81,18 @@ export function parseDecisionComment(body, { issue = null } = {}) {
|
|
|
81
81
|
} catch { return null; }
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/** #5547: `<!-- FORGE:DECISION {"requirement":"R2","disposition":"post-deploy","why":"..."} -->` -> {requirement, disposition, why}; null for anything else (anchored records included). */
|
|
85
|
+
export function parseRequirementDecision(body) {
|
|
86
|
+
const m = MARKER_RE.exec(String(body ?? "").split("\n", 1)[0]);
|
|
87
|
+
if (!m) return null;
|
|
88
|
+
try {
|
|
89
|
+
const raw = JSON.parse(m[1]);
|
|
90
|
+
const id = typeof raw?.requirement === "string" ? raw.requirement.trim() : "";
|
|
91
|
+
if (!/^R\d+$/.test(id) || raw.disposition !== "post-deploy") return null;
|
|
92
|
+
return { requirement: id, disposition: "post-deploy", why: one(raw.why) };
|
|
93
|
+
} catch { return null; }
|
|
94
|
+
}
|
|
95
|
+
|
|
84
96
|
/** One record per id, the latest wins (input in posting order); ids ordered by first appearance. */
|
|
85
97
|
export function foldDecisions(records) {
|
|
86
98
|
const by = new Map();
|
|
@@ -89,3 +89,12 @@ describe("decisions (#4695)", () => {
|
|
|
89
89
|
assert.deepEqual(interfaceDecisions("## Interfaces\nnone", { issue: 1 }), []);
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
|
+
import { parseRequirementDecision } from "./decisions.mjs";
|
|
93
|
+
describe("#5547 requirement decisions", () => {
|
|
94
|
+
it("parses a post-deploy requirement decision and ignores anchored, prose and other dispositions", () => {
|
|
95
|
+
assert.deepEqual(parseRequirementDecision('<!-- FORGE:DECISION {"requirement":"R2","disposition":"post-deploy","why":"paid run"} -->\nx'), { requirement: "R2", disposition: "post-deploy", why: "paid run" });
|
|
96
|
+
assert.equal(parseRequirementDecision('<!-- FORGE:DECISION {"requirement":"R2","disposition":"deliver"} -->'), null);
|
|
97
|
+
assert.equal(parseRequirementDecision('<!-- FORGE:DECISION {"choice":"x","anchors":["a.js"]} -->'), null);
|
|
98
|
+
assert.equal(parseRequirementDecision("FORGE:DECISION prose"), null);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -10,6 +10,9 @@ import { writeAtomic } from "./batch.mjs";
|
|
|
10
10
|
import { delimiter, join } from "node:path";
|
|
11
11
|
import { RELEASE_STEPS } from "./release.mjs";
|
|
12
12
|
|
|
13
|
+
/** Optional steps that leave no trace when unconfigured: once post-merge is done they are not the pending step (#5560). */
|
|
14
|
+
const OPTIONAL_NO_TRACE = ["deploy"];
|
|
15
|
+
|
|
13
16
|
export const DEFAULT_SKIP_LABELS = ["epic", "needs-human", "post-deploy", "workflow:merged", "awaiting-promotion", "host-task"];
|
|
14
17
|
/** A release job that has not written its end `status` for this long is taken as dead, not in flight. */
|
|
15
18
|
export const RELEASE_STALE_MS = 6 * 3600 * 1000;
|
|
@@ -48,7 +51,7 @@ export function releaseInFlight({ root, repo = null, now = Date.now(), staleMs =
|
|
|
48
51
|
if (!st || st.status || (repo && st.repo && st.repo !== repo)) continue;
|
|
49
52
|
let age; try { age = now - stat(f).mtimeMs; } catch { continue; }
|
|
50
53
|
if (age > staleMs) continue;
|
|
51
|
-
if (!best || age < best.ageMs) best = { id, step: RELEASE_STEPS.find((x) => !st.steps?.[x]?.done) ?? null, ageMs: age };
|
|
54
|
+
if (!best || age < best.ageMs) best = { id, step: RELEASE_STEPS.find((x) => !st.steps?.[x]?.done && !(OPTIONAL_NO_TRACE.includes(x) && st.steps?.["post-merge"]?.done)) ?? null, ageMs: age };
|
|
52
55
|
}
|
|
53
56
|
return best;
|
|
54
57
|
}
|
|
@@ -89,6 +89,12 @@ test("#5313 a release in flight pauses the watch (no claims), the next pass resu
|
|
|
89
89
|
assert.match(formatStatus(s, watch, io.now()), /state: exited \(single pass/);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
+
test("#5560 releaseInFlight: an unconfigured (trace-less) deploy is not the pending step after post-merge", () => {
|
|
93
|
+
const env = tmpDir("iwp-"), root = join(env, "releases"), done = { done: true };
|
|
94
|
+
relDir(env, "r20261110-120000-1", { repo: "o/r", steps: { preflight: done, "host-preflight": done, "release-pr": done, review: done, fixes: done, "mark-ready": done, rehearsal: done, promotion: done, "post-merge": done } }, 60000);
|
|
95
|
+
assert.equal(releaseInFlight({ root, repo: "o/r", now: NOW }).step, null);
|
|
96
|
+
});
|
|
97
|
+
|
|
92
98
|
test("#5313 watchLiveness: a fresh heartbeat runs, an old one is dead, a finished watch is done", () => {
|
|
93
99
|
const beat = (ms) => new Date(NOW - ms).toISOString();
|
|
94
100
|
assert.equal(watchLiveness({ phase: "running", heartbeat: beat(1000), heartbeatEveryMs: 300000 }, NOW).state, "running");
|
package/bin/lean/lean.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
21
21
|
import { otherLaneOwner } from "./lanelock.mjs";
|
|
22
22
|
import { stampText, checkStamp } from "./stagestamp.mjs";
|
|
23
23
|
import { acquireBranchLock, waitPidsExit } from "./branchlock.mjs";
|
|
24
|
-
import { contractRuleCounts, onlyTestPlanProblems, isTestPath, applyValidateRecipes, rewriteProjectDirCommand, deferChecklessPostDeploy, autoPostDeployE2e, loneE2eRows, reproEnvMiss, resolveForgedockPaths, describesUnrunnableCommand, removedPathsOf, TRACKED, normalizeKindModes, blockingFailures, unverifiedRequirements, mutationTargets, mutationFailures, runMutationCheck, MUTATION_SURVIVED, isBugIssue, scopeText, explainFailures, inIssue, validateContract, snapQuotes, cliUsageError, normalizeRunnerCommand, applyAmendments, amendmentKindProblems, precheck, alreadyFixedOnBase, READONLY_PROD_RE, EXTERNAL_NEED_RE, intakeHostWork, repoTracks, dropScopeValidates, tagOutOfBand, parseReview, decide, mergeReviewRows, reaskable, criterionLines, closePlan, followupItems, renderPendingFollowups, bucketTally, pendingTracking, unnamedEdges, structureNote, impliedDocDeliverables, convertDelivered } from "./conformance.mjs";
|
|
24
|
+
import { contractRuleCounts, onlyTestPlanProblems, isTestPath, applyValidateRecipes, rewriteProjectDirCommand, deferChecklessPostDeploy, autoPostDeployE2e, applyRequirementDecisions, loneE2eRows, reproEnvMiss, resolveForgedockPaths, describesUnrunnableCommand, removedPathsOf, TRACKED, normalizeKindModes, blockingFailures, unverifiedRequirements, mutationTargets, mutationFailures, runMutationCheck, MUTATION_SURVIVED, isBugIssue, scopeText, explainFailures, inIssue, validateContract, snapQuotes, cliUsageError, normalizeRunnerCommand, applyAmendments, amendmentKindProblems, precheck, alreadyFixedOnBase, READONLY_PROD_RE, EXTERNAL_NEED_RE, intakeHostWork, repoTracks, dropScopeValidates, tagOutOfBand, parseReview, decide, mergeReviewRows, reaskable, criterionLines, closePlan, followupItems, renderPendingFollowups, bucketTally, pendingTracking, unnamedEdges, structureNote, impliedDocDeliverables, convertDelivered } from "./conformance.mjs";
|
|
25
25
|
import { checkAdmission, hostParallelism, ADMISSION_RETRY_SECONDS } from "./admission.mjs";
|
|
26
26
|
import { namedPaths, isTrustedIssueComment } from "./prefilter.mjs";
|
|
27
27
|
import { writeStatus, postUpsert, isStatusPost, isUpsertPost, hasSection, clearPipelineLabels } from "./statuscomment.mjs";
|
|
@@ -48,6 +48,13 @@ import { hostCapabilityBlock, contractHostNeeds } from "./execution.mjs";
|
|
|
48
48
|
|
|
49
49
|
const MISSING_TOOL_RE = /command not found|not found in PATH|no such file or directory.*\b(?:docker|promtool)\b|\b(?:docker|promtool)\b[^\n]{0,80}(?:not (?:installed|found|available)|no such file|cannot connect|daemon)|cannot connect to the docker daemon|no docker daemon|no module named|ModuleNotFoundError|\bENOENT\b[^\n]{0,60}spawn/i;
|
|
50
50
|
/** #4685: true when a builder's block summary names a missing tool or module (environment), not a credential. */
|
|
51
|
+
/** #5623: a contract problem the builder can fix in its own session (shape, typed fields, test-plan rules, check ids), as
|
|
52
|
+
* opposed to one that needs the issue changed (quote not verbatim) or a person. */
|
|
53
|
+
export function contractSelfCorrectable(problems) {
|
|
54
|
+
const list = Array.isArray(problems) ? problems : [];
|
|
55
|
+
return list.length > 0 && !list.every((x) => /: quote is not verbatim/.test(String(x)));
|
|
56
|
+
}
|
|
57
|
+
|
|
51
58
|
export function missingToolBlock(summary) { return MISSING_TOOL_RE.test(String(summary ?? "")); }
|
|
52
59
|
import { reserveForBuild, revalidate } from "./seqreserve.mjs";
|
|
53
60
|
import { patchEcho, mutationsOf, runReproMutations, classifyRepro } from "./reproquality.mjs";
|
|
@@ -279,7 +286,7 @@ const defaultCredExec = (args) => {
|
|
|
279
286
|
export async function runCore(o) {
|
|
280
287
|
const armed = applyArmOverrides(o, o.issue); o = armed.options; // #5206: the arm's overrides shape the lane before any config is parsed
|
|
281
288
|
const { issue, repo, lane: requestedLane = null, laneOverride = false, branches = {}, cwd, dir, io, builderModel = null, reviewerModel = DEFAULT_REVIEWER_MODEL, fixModel = null,
|
|
282
|
-
toolchainOverride = null, testRunners = null, coupledFiles = null, validateRecipes = null, routeReachability = null, docsConfig = null, pagesConfig = null, designConfig = null, prodParity = null, envSetup = null, ciMaxMinutes = 360, conformance = "shadow", conformanceKinds = null, conformanceMutation = "off", reviewIncomplete = "needs-human", reproTest = "prefer", reproQuality = "shadow", closeParent = false, mergeWait = "required", maxSessionLimitPauses = DEFAULT_MAX_SESSION_LIMIT_PAUSES, cliIdleMinutes = 15, cliMaxMinutes = 180, cliBusyMinutes = 45, contextCeilingTokens = 120000, contextCeilingBySize = null, turnBudgets = null, laneLimits = null, maxMergeRetries = 5, sessionLimitMaxWaitMs = DEFAULT_SESSION_LIMIT_WAIT_MS, contextWaitSeconds = 5, onProgress = () => {}, emitTelemetry = null, random = Math.random } = o;
|
|
289
|
+
toolchainOverride = null, testRunners = null, coupledFiles = null, validateRecipes = null, routeReachability = null, docsConfig = null, pagesConfig = null, designConfig = null, prodParity = null, envSetup = null, ciMaxMinutes = 360, conformance = "shadow", conformanceKinds = null, conformanceMutation = "off", reviewIncomplete = "needs-human", reproTest = "prefer", reproQuality = "shadow", closeParent = false, mergeWait = "required", maxSessionLimitPauses = DEFAULT_MAX_SESSION_LIMIT_PAUSES, cliIdleMinutes = 15, cliMaxMinutes = 180, cliBusyMinutes = 45, contextCeilingTokens = 120000, contextCeilingBySize = null, turnBudgets = null, laneLimits = null, maxMergeRetries = 5, contractMaxCorrections = 3, sessionLimitMaxWaitMs = DEFAULT_SESSION_LIMIT_WAIT_MS, contextWaitSeconds = 5, onProgress = () => {}, emitTelemetry = null, random = Math.random } = o;
|
|
283
290
|
const now = io.now ?? (() => Date.now());
|
|
284
291
|
const rotator = io.rotator !== undefined ? io.rotator : openRotator({ kind: o.accountRotator }); // #5094
|
|
285
292
|
// #5205: a rotator with pick() relaunches a limited phase pinned to another account; lane-level rotations and limited accounts
|
|
@@ -2063,7 +2070,11 @@ export async function runCore(o) {
|
|
|
2063
2070
|
if (stale) {
|
|
2064
2071
|
ev({ event: "CONTRACT_STALE", hash: fc.hash, scope: fc.scope, now: scopeHash, reason: stale });
|
|
2065
2072
|
T.decisions.push(`Rerun: frozen contract ${fc.hash} is stale (${stale}); re-planning`);
|
|
2066
|
-
} else {
|
|
2073
|
+
} else {
|
|
2074
|
+
frozen = fc.contract; hash = fc.hash; priorAmendments = fc.amendments ?? []; T.decisions.push(`Rerun: frozen contract ${hash} recovered from the issue`);
|
|
2075
|
+
const ad = applyRequirementDecisions(frozen, trustedComments); // #5547: a structured operator decision amends the frozen row
|
|
2076
|
+
if (ad.applied.length) { frozen = deferChecklessPostDeploy(ad.contract).contract; T.decisions.push(`FORGE:DECISION applied to the frozen contract: ${ad.applied.join(", ")} tracked post-deploy`); }
|
|
2077
|
+
}
|
|
2067
2078
|
}
|
|
2068
2079
|
}
|
|
2069
2080
|
if ((resumed || salvagedRef || recover) && ctxCfg.mode !== "off") {
|
|
@@ -2221,7 +2232,15 @@ export async function runCore(o) {
|
|
|
2221
2232
|
await correctContract([...vc.problems, ...preflightProblems(missed), ...testRunnerProblems(contract, testRunners)], "resumed once");
|
|
2222
2233
|
if (missed.length) misses = await preflightValidates(contract);
|
|
2223
2234
|
}
|
|
2224
|
-
|
|
2235
|
+
// #5623: builder-correctable contract problems get up to contractMaxCorrections rounds (default 3), each with only the
|
|
2236
|
+
// problems still open; the round ends early when a correction changes nothing (same problem set twice).
|
|
2237
|
+
let rounds = vc.ok ? 0 : 1, lastProblems = null;
|
|
2238
|
+
while (!vc.ok && sessionId && rounds < contractMaxCorrections && contractSelfCorrectable(vc.problems)) {
|
|
2239
|
+
const key = JSON.stringify([...vc.problems].sort());
|
|
2240
|
+
if (key === lastProblems) break;
|
|
2241
|
+
lastProblems = key; rounds++;
|
|
2242
|
+
await correctContract(vc.problems, `${vc.problems.length} problem(s) still open, correction round ${rounds} of ${contractMaxCorrections}`);
|
|
2243
|
+
}
|
|
2225
2244
|
if (!vc.ok) ev({ event: "CONTRACT_INVALID_RULES", rules: contractRuleCounts(vc.problems) }), await emit({ event: "CONTRACT_INVALID_RULES", rules: contractRuleCounts(vc.problems) }); // #5587: per-rule counts for the batch false-park rate
|
|
2226
2245
|
planMisses = misses;
|
|
2227
2246
|
if (missed.length) {
|
|
@@ -2232,7 +2251,7 @@ export async function runCore(o) {
|
|
|
2232
2251
|
}
|
|
2233
2252
|
}
|
|
2234
2253
|
await flushStages(result ?? { status: "fixed" }, ["investigation"]); // always posted: FORGE:INVESTIGATION/VALIDATE are read downstream
|
|
2235
|
-
if (!vc.ok) return await needsHuman(`The builder's contract is still invalid after
|
|
2254
|
+
if (!vc.ok) return await needsHuman(`The builder's contract is still invalid after ${rounds} correction(s):\n${vc.problems.slice(0, 12).map((x) => `- ${x}`).join("\n")}`, OUTCOME_CODES.CONTRACT_INVALID, { ...(issueEdited ? { issueEdited: true } : {}), ...(vc.problems.every((x) => /: quote is not verbatim/.test(x)) ? { quoteMismatch: true } : {}) });
|
|
2236
2255
|
frozen = historyRows(contract); // #4694 guards
|
|
2237
2256
|
frozen = withDecisionRows(frozen, readDecisionIndex(repo)); // #4695: anchored decisions on the deliverable paths; one index read
|
|
2238
2257
|
const hRows = (frozen.preserve ?? []).filter((p) => p.source === "decision");
|
|
@@ -3412,6 +3431,19 @@ export async function runCore(o) {
|
|
|
3412
3431
|
};
|
|
3413
3432
|
let blockStartedAt = null, blockPollIndex = 0;
|
|
3414
3433
|
const conflictFiles = async () => (await gitOut(["diff", "--name-only", "--diff-filter=U"])).split("\n").map((x) => x.trim()).filter(Boolean);
|
|
3434
|
+
/** #5583 follow-up: the builder resolved a base-sync whose conflicts were all documentation files, and the lane's non-doc
|
|
3435
|
+
* diff against the new base equals its non-doc diff against the old fork point (so no code changed in the resolution). */
|
|
3436
|
+
const DOC_FILE_RE = /\.(md|mdx|markdown|rst|adoc|txt)$/i, DOC_EXCLUDES = ["md", "mdx", "markdown", "rst", "adoc", "txt"].map((e) => `:(exclude)*.${e}`);
|
|
3437
|
+
const docsOnlyConflict = async (conflicted, laneBefore) => {
|
|
3438
|
+
if (!conflicted.length || !conflicted.every((f) => DOC_FILE_RE.test(f))) return false;
|
|
3439
|
+
try {
|
|
3440
|
+
const fork = await gitOut(["merge-base", laneBefore, "HEAD^2"]);
|
|
3441
|
+
if (!/^[0-9a-f]{7,}$/.test(fork)) return false; // gitOut swallows errors as "": never treat that as "unchanged"
|
|
3442
|
+
const was = await gitOut(["diff", fork, laneBefore, "--", ".", ...DOC_EXCLUDES]);
|
|
3443
|
+
const now = await gitOut(["diff", "HEAD^2", "HEAD", "--", ".", ...DOC_EXCLUDES]);
|
|
3444
|
+
return was === now;
|
|
3445
|
+
} catch { return false; }
|
|
3446
|
+
};
|
|
3415
3447
|
const unresolved = async () => (await conflictFiles()).length > 0 || (await gitOut(["grep", "-n", "-e", "^<<<<<<< ", "-e", "^>>>>>>> "])) !== ""
|
|
3416
3448
|
|| (await gitOut(["diff", "--check"])) !== "" || (await gitOut(["rev-parse", "-q", "--verify", "MERGE_HEAD"])) !== "";
|
|
3417
3449
|
const syncRow = [];
|
|
@@ -3435,7 +3467,7 @@ export async function runCore(o) {
|
|
|
3435
3467
|
// #4386: conflicts only in sequence files (numbered, journal, snapshot, their index) resolve without a builder
|
|
3436
3468
|
// #4588: union / JSON-map / generated files resolve first; only the files left go to the sequence resolver
|
|
3437
3469
|
const bm = o.baseMerge, cr = !clean && io.conflictResolve && bm && Object.values(bm).some((v) => v?.length) ? await io.conflictResolve({ cwd: wt, files, cfg: bm }).catch(() => null) : null;
|
|
3438
|
-
let seqFiles = cr?.resolved?.length ? cr.remaining : files, crDone = false;
|
|
3470
|
+
let seqFiles = cr?.resolved?.length ? cr.remaining : files, crDone = false, docsOnlySync = false;
|
|
3439
3471
|
if (cr?.resolved?.length && !seqFiles.length) { try { await git(["commit", "--no-edit"]); crDone = true; } catch { /* the builder finishes the merge */ } }
|
|
3440
3472
|
if (cr?.note) T.decisions.push(`Base-sync ${syncs}: ${cr.note}`);
|
|
3441
3473
|
const rs = !clean && !crDone && seqFiles.length && io.sequenceResolve ? ((await io.sequenceResolve({ cwd: wt, files: seqFiles }).catch((e) => ({ unsupported: String(e?.message ?? e) }))) ?? {}) : null;
|
|
@@ -3463,6 +3495,8 @@ export async function runCore(o) {
|
|
|
3463
3495
|
how = `builder resolved ${files.length} conflicted file(s) and committed the merge`;
|
|
3464
3496
|
const r2 = await readResult();
|
|
3465
3497
|
tests = Array.isArray(r2?.tests) && r2.tests.length ? r2.tests.map((t) => (typeof t === "string" ? t : `${t.command}: ${t.result}`)).join("; ") : NR_TESTS;
|
|
3498
|
+
docsOnlySync = await docsOnlyConflict(files, before); // #5583 follow-up
|
|
3499
|
+
if (docsOnlySync) { T.decisions.push(`Base-sync ${syncs}: conflicts only in documentation (${files.join(", ")}) and the lane's code diff is unchanged; no re-review`); tests = "not required (documentation-only conflicts; lane code diff unchanged)"; }
|
|
3466
3500
|
}
|
|
3467
3501
|
const sq = await sequenceHandoff(`base-sync ${syncs}`, detResolved ? { laneRef: before } : {}); // #4322: a clean text merge can still bring a taken number
|
|
3468
3502
|
if (sq?.done) return sq.done;
|
|
@@ -3489,6 +3523,7 @@ export async function runCore(o) {
|
|
|
3489
3523
|
if (remoteVerify && after !== before) { const v = await ciVerify("base-sync"); if (v.done) return v.done; ciFixes = v.fixes; }
|
|
3490
3524
|
const engineOnly = !ciFixes && !pm.fixed && !dupFixed && (clean || detResolved) && (!sq?.renumbered || sq.deterministic); // #4386: no builder touched the delta
|
|
3491
3525
|
if (!isSplit && engineOnly && (detResolved || sq?.deterministic)) rereview = "not required (deterministic renumber + base merge)";
|
|
3526
|
+
else if (!isSplit && docsOnlySync && !ciFixes && !pm.fixed && !dupFixed && !sq?.renumbered) rereview = "not required (documentation-only conflicts; lane code diff unchanged)";
|
|
3492
3527
|
else if (!isSplit && (!clean || sq?.renumbered || ciFixes || pm.fixed || dupFixed)) {
|
|
3493
3528
|
let rv = await doReview();
|
|
3494
3529
|
if (rv.env) return await envNeedsHuman(rv.env);
|
package/bin/lean/lean.test.mjs
CHANGED
|
@@ -1225,7 +1225,7 @@ describe("conformance gate (frozen contract, precheck, structured review)", () =
|
|
|
1225
1225
|
assert.match(builders(w)[1][4], /R1: quote is not verbatim from the issue/);
|
|
1226
1226
|
assert.equal(r.quoteMismatch, true, "#4789: quote-only problems are recoverable");
|
|
1227
1227
|
assert.equal(builders(w).length, 2, "plan + one correction, no implement call");
|
|
1228
|
-
assert.match(nhBody(w), /still invalid after
|
|
1228
|
+
assert.match(nhBody(w), /still invalid after \d+ correction\(s\)/);
|
|
1229
1229
|
const w2 = world({ contract: bad1, fixedContract: CONTRACT });
|
|
1230
1230
|
assert.equal((await run(w2)).terminalReason, "merged");
|
|
1231
1231
|
});
|
|
@@ -3492,6 +3492,32 @@ describe("base-sync (#4100)", () => {
|
|
|
3492
3492
|
noRebaseNoForce(w);
|
|
3493
3493
|
});
|
|
3494
3494
|
|
|
3495
|
+
it("#5583 follow-up: a builder-resolved base-sync with only documentation conflicts and an unchanged code diff skips the re-review", async () => {
|
|
3496
|
+
const w = world({ prView: [CONFLICTING, OKSTATE], mergeResults: ["conflict"], conflictFiles: ["devdocs/modules/lean.md"], reviews: [ok(), ok()] });
|
|
3497
|
+
const git = w.io.git;
|
|
3498
|
+
w.io.git = async (a, o) => {
|
|
3499
|
+
if (a[0] === "merge-base" && a[1] !== "--is-ancestor") return "f0f0f0f0f0f0f0f0";
|
|
3500
|
+
if (a[0] === "diff" && a.includes(":(exclude)*.md")) return "diff --git a/src/foo.js b/src/foo.js\n+fix";
|
|
3501
|
+
return git(a, o);
|
|
3502
|
+
};
|
|
3503
|
+
const r = await run(w);
|
|
3504
|
+
assert.equal(r.terminalReason, "merged");
|
|
3505
|
+
assert.equal(reviewers(w).length, 1, "no re-review for a documentation-only conflict");
|
|
3506
|
+
assert.match(syncComment(w), /not required \(documentation-only conflicts; lane code diff unchanged\)/);
|
|
3507
|
+
});
|
|
3508
|
+
|
|
3509
|
+
it("#5583 follow-up: a documentation-only conflict whose resolution changed the code diff is re-reviewed", async () => {
|
|
3510
|
+
const w = world({ prView: [CONFLICTING, OKSTATE], mergeResults: ["conflict"], conflictFiles: ["devdocs/modules/lean.md"], reviews: [ok(), ok()] });
|
|
3511
|
+
const git = w.io.git; let n = 0;
|
|
3512
|
+
w.io.git = async (a, o) => {
|
|
3513
|
+
if (a[0] === "merge-base" && a[1] !== "--is-ancestor") return "f0f0f0f0f0f0f0f0";
|
|
3514
|
+
if (a[0] === "diff" && a.includes(":(exclude)*.md")) return `diff --git a/src/foo.js b/src/foo.js\n+fix${n++}`;
|
|
3515
|
+
return git(a, o);
|
|
3516
|
+
};
|
|
3517
|
+
await run(w);
|
|
3518
|
+
assert.equal(reviewers(w).length, 2, "re-review: the resolution touched code");
|
|
3519
|
+
});
|
|
3520
|
+
|
|
3495
3521
|
it("conflict resolution that the re-review FAILs gets one retry then merges on PASS", async () => {
|
|
3496
3522
|
const w = world({ prView: [CONFLICTING, OKSTATE], mergeResults: ["conflict"], reviews: [ok(), bad("src/foo.js:4 lost base change"), ok()] });
|
|
3497
3523
|
assert.equal((await run(w)).terminalReason, "merged");
|
|
@@ -7761,6 +7787,13 @@ describe("resume digest in builder prompts (#4400)", () => {
|
|
|
7761
7787
|
assert.doesNotMatch(p, /untrusted override|older decision/);
|
|
7762
7788
|
});
|
|
7763
7789
|
|
|
7790
|
+
it("#5547 a structured post-deploy decision after the freeze amends the recovered frozen contract", async () => {
|
|
7791
|
+
const sd = { body: `<!-- FORGE:DECISION ${JSON.stringify({ requirement: CONTRACT.requirements[0].id, disposition: "post-deploy" })} -->\n## Decision\npaid run`, ...BOT };
|
|
7792
|
+
const w = withDecisions([CONTRACT_C, sd, { body: factsRec, ...BOT }]);
|
|
7793
|
+
await run(w);
|
|
7794
|
+
assert.match(traj(w).join("\n"), new RegExp(`FORGE:DECISION applied to the frozen contract: ${CONTRACT.requirements[0].id} tracked post-deploy`));
|
|
7795
|
+
});
|
|
7796
|
+
|
|
7764
7797
|
it("context_pack off still passes the decision", async () => {
|
|
7765
7798
|
const w = withDecisions([CONTRACT_C, dec("deliver the nightly timer")]);
|
|
7766
7799
|
await run(w, { contextPack: { mode: "off" } });
|
|
@@ -161,10 +161,10 @@ describe("in-batch recovery of mechanical needs-human (#4267)", () => {
|
|
|
161
161
|
assert.deepEqual(seen.sort(), [[1, 101], [2, 102]]);
|
|
162
162
|
});
|
|
163
163
|
|
|
164
|
-
it("contract.invalid recovers
|
|
165
|
-
const { rows, calls } = await batch({ 1: [NH("contract.invalid", "contract invalid", { issueEdited: true }), { terminalReason: "merged" }], 2: [NH("contract.invalid")] });
|
|
164
|
+
it("#5623: contract.invalid recovers with a fresh plan whether or not the issue was edited mid-run", async () => {
|
|
165
|
+
const { rows, calls } = await batch({ 1: [NH("contract.invalid", "contract invalid", { issueEdited: true }), { terminalReason: "merged" }], 2: [NH("contract.invalid"), { terminalReason: "merged" }] });
|
|
166
166
|
assert.equal(byIssue(rows)[1].recovered, "contract.invalid");
|
|
167
|
-
assert.equal(byIssue(rows)[2].outcome, "
|
|
167
|
+
assert.equal(byIssue(rows)[2].recovered, "contract.invalid"); assert.equal(byIssue(rows)[2].outcome, "merged"); assert.equal(calls.filter((c) => c.n === 2).length, 2);
|
|
168
168
|
});
|
|
169
169
|
|
|
170
170
|
it("relabelNeedsHuman (SPEC-7/8): only a recovery that ends final engine-error/deferred relabels; invalid/merged never; a requeued deferred waits", async () => {
|
|
@@ -12,6 +12,7 @@ import { createHash } from "node:crypto";
|
|
|
12
12
|
import { load, JSON_SCHEMA } from "../vendor/js-yaml/js-yaml.mjs";
|
|
13
13
|
import { readReleaseConfig } from "./release.mjs";
|
|
14
14
|
import { readBranches } from "./lane.mjs";
|
|
15
|
+
import { catalogueFindings } from "./release-gates.mjs";
|
|
15
16
|
|
|
16
17
|
export const POLICY_PATH = ".forge/release.yaml";
|
|
17
18
|
export const DEFERRED_KEYS = ["plan.auto_if", "retention_days", "ci.forbid_per_issue_steps", "couplings[].refine", "ci.provider=command", "risk.weights"];
|
|
@@ -46,10 +47,11 @@ export const POLICY_SCHEMA = obj({
|
|
|
46
47
|
merge: obj({ approval: en("confirm", "with-plan", "auto"), method: en("merge-commit", "squash", "rebase"), trailers: list() }),
|
|
47
48
|
ci: obj({ provider: en("github-actions", "command"), required_checks: ANY, selection: ANY, rerun_budget_min: N, fix: ANY, flake: obj({ quarantine_after: N, window_days: N }), unskippable: list(), tiers: { t: "map", v: obj({ jobs: list() }) }, nightly: ANY, budget: ANY }),
|
|
48
49
|
preflight: obj({ commands: list(), timeout_s: N, blocking: B }),
|
|
49
|
-
deploy: obj({ live_release_command: S, freeze_variable: S, concurrency_group: S, start_timeout_s: N, stage_timeout_s:
|
|
50
|
-
verify: obj({ slis: list(ANY), post_deploy_checks_file: S, close_requires: en("verified", "deployed") }),
|
|
50
|
+
deploy: obj({ live_release_command: S, freeze_variable: S, concurrency_group: S, start_timeout_s: N, stage_timeout_s: N, expected_digests_command: S, recovery: obj({ rerun_max: I, max_attempts: I, signatures: list() }), pipelines: { t: "map", v: PIPELINE } }),
|
|
51
|
+
verify: obj({ workflow: S, results: list(obj({ workflow: S, kind: en("smoke", "edge", "convergence") })), flags: list(obj({ flag: S, off_command: S })), slis: list(ANY), post_deploy_checks_file: S, close_requires: en("verified", "deployed") }),
|
|
51
52
|
rollback: obj({ triggers: list(), ladder: list(), refuse_across: list(), open_revert_pr: B }),
|
|
52
53
|
quarantine: obj({ days: N, max: N }),
|
|
54
|
+
gates: obj({ demote_fb_rate: N, demote_window: I, safety: list() }),
|
|
53
55
|
controls: obj({ intake: ANY, conductor: ANY, exempt: ANY }),
|
|
54
56
|
});
|
|
55
57
|
|
|
@@ -135,16 +137,25 @@ export function readPolicy({ io, defaultBranch, cwd = process.cwd(), ref }) {
|
|
|
135
137
|
return { source: "file", policy: findings.length ? null : policy, findings, sha: createHash("sha256").update(text).digest("hex") };
|
|
136
138
|
}
|
|
137
139
|
|
|
140
|
+
const GATES_PATH_LABEL = ".forge/gates.yaml";
|
|
138
141
|
const flagOf = (argv, f) => { const i = argv.indexOf(f); return i >= 0 ? argv[i + 1] : null; };
|
|
139
142
|
|
|
140
143
|
/** `forgedock release check-config [--ref <git ref>]`: exit 0 valid (or file absent: flat keys), 1 on any finding. */
|
|
141
144
|
export function checkConfigFromCli(argv, { io, cwd = process.cwd() }) {
|
|
142
145
|
const defaultBranch = readBranches(cwd).default || "main";
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
const ref = flagOf(argv, "--ref");
|
|
147
|
+
const gf = catalogueFindings(io, ref ?? `origin/${defaultBranch}`); // #5583: .forge/gates.yaml, validated when present
|
|
148
|
+
const gatesLines = () => (gf ?? []).map((f) => `release check-config: ${GATES_PATH_LABEL}: ${f}`);
|
|
149
|
+
const r = readPolicy({ io, defaultBranch, cwd, ref });
|
|
150
|
+
if (r.source === "forge.yaml") {
|
|
151
|
+
io.print(`release check-config: no ${POLICY_PATH} on origin/${defaultBranch}; using forge.yaml release.* keys`);
|
|
152
|
+
gatesLines().forEach((l) => io.print(l));
|
|
153
|
+
return gf?.length ? 1 : 0;
|
|
154
|
+
}
|
|
155
|
+
const findings = [...r.findings, ...(gf ?? []).map((f) => `${GATES_PATH_LABEL}: ${f}`)];
|
|
156
|
+
findings.forEach((f) => io.print(`release check-config: ${f}`));
|
|
157
|
+
io.print(findings.length ? `release check-config: FAILED (${findings.length})` : `release check-config: ok (sha256 ${r.sha.slice(0, 12)})`);
|
|
158
|
+
return findings.length ? 1 : 0;
|
|
148
159
|
}
|
|
149
160
|
|
|
150
161
|
/** `forgedock release init`: writes the zero-config profile (7.4) to `.forge/release.yaml` and nothing else; never overwrites. */
|
|
@@ -106,4 +106,27 @@ describe("CLI", () => {
|
|
|
106
106
|
assert.deepEqual(check(`${OK} flake: {quarantine_after: 3, window_days: 14}\nquarantine: {days: 14, max: 15}\n`.replace("ci:\n tiers: {T3: {jobs: [e2e]}}\n flake", "ci:\n tiers: {T3: {jobs: [e2e]}}\n flake")), []);
|
|
107
107
|
assert.notDeepEqual(check(`${OK}quarantine: {max: x}\n`), []);
|
|
108
108
|
});
|
|
109
|
+
it("accepts the verification layer keys and rejects a bad result kind (#5562)", () => {
|
|
110
|
+
assert.deepEqual(check(`${OK}verify:\n workflow: verify.yml\n close_requires: verified\n results: [{workflow: smoke.yml, kind: smoke}]\n flags: [{flag: F, off_command: x}]\n`), []);
|
|
111
|
+
assert.notDeepEqual(check(`${OK}verify:\n results: [{workflow: s.yml, kind: nope}]\n`), []);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe("gates catalogue and policy (#5583)", () => {
|
|
116
|
+
const GATE = `schema: 1\ngates:\n - {id: g1, protects_against: "#1", where: deploy, determinism: high, pre_merge_artifact: f.json, version: v1, mode: block, owner: me, review_by: 2027-01-01}\n`;
|
|
117
|
+
const gio = (files) => ({ printed: [], print(l) { this.printed.push(l); }, git(a) { const t = files[a[1].split(":").slice(1).join(":")]; if (t === undefined) throw new Error("missing"); return t; } });
|
|
118
|
+
it("accepts the gates policy keys and rejects a wrong type", () => {
|
|
119
|
+
assert.deepEqual(check(OK + "gates: {demote_fb_rate: 5, demote_window: 20, safety: [a]}\n"), []);
|
|
120
|
+
assert.match(check(OK + "gates: {demote_window: 2.5}\n").join(), /demote_window/);
|
|
121
|
+
});
|
|
122
|
+
it("check-config reports catalogue errors, passes a valid one, ignores an absent one", () => {
|
|
123
|
+
const bad = gio({ ".forge/gates.yaml": GATE.replace("mode: block", "mode: nope"), [POLICY_PATH]: OK });
|
|
124
|
+
assert.equal(checkConfigFromCli([], { io: bad }), 1);
|
|
125
|
+
assert.match(bad.printed.join("\n"), /gates\.yaml: gates\[0\]\.mode/);
|
|
126
|
+
const good = gio({ ".forge/gates.yaml": GATE, [POLICY_PATH]: OK });
|
|
127
|
+
assert.equal(checkConfigFromCli([], { io: good }), 0);
|
|
128
|
+
const none = gio({ [POLICY_PATH]: OK });
|
|
129
|
+
assert.equal(checkConfigFromCli([], { io: none }), 0);
|
|
130
|
+
assert.doesNotMatch(none.printed.join("\n"), /gates/);
|
|
131
|
+
});
|
|
109
132
|
});
|