forgedock 1.69.0 → 1.70.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/lean/conformance.mjs +3 -0
- package/bin/lean/conformance.test.mjs +1 -0
- package/bin/lean/issuewatch-parity.test.mjs +1 -1
- package/bin/lean/lean.test.mjs +1 -0
- package/bin/lean/release-cigreen.mjs +204 -0
- package/bin/lean/release-cigreen.test.mjs +115 -0
- package/bin/lean/release-fixloop.mjs +1 -1
- package/bin/lean/release-ledger.test.mjs +4 -4
- package/bin/lean/release-preflight.test.mjs +2 -2
- package/bin/lean/release-rehearsal.test.mjs +1 -1
- package/bin/lean/release-review.e2e.test.mjs +4 -3
- package/bin/lean/release-review.mjs +136 -56
- package/bin/lean/release-review.test.mjs +97 -12
- package/bin/lean/release-status.mjs +3 -2
- package/bin/lean/release-status.test.mjs +2 -2
- package/bin/lean/release.mjs +4 -2
- package/bin/lean/release.test.mjs +33 -12
- package/bin/review-staging.mjs +63 -21
- package/commands/review-pr-staging.md +1 -1
- package/docs/CONFIG.md +20 -0
- package/package.json +1 -1
- package/pool/image/Dockerfile +1 -1
|
@@ -42,6 +42,7 @@ function fakeIo(world = {}) {
|
|
|
42
42
|
throw new Error(`unexpected gh ${j}`);
|
|
43
43
|
},
|
|
44
44
|
};
|
|
45
|
+
io.ciGreen = { isDraft: async () => true }; // real ci-green steps skip like a draft PR: CI waiting is tested in release-cigreen.test.mjs
|
|
45
46
|
if (w.scorecard) io.scorecard = w.scorecard;
|
|
46
47
|
return io;
|
|
47
48
|
}
|
|
@@ -52,7 +53,7 @@ describe("unmanaged release carries no epoch (#5553)", () => {
|
|
|
52
53
|
const mod = await import("./release.mjs");
|
|
53
54
|
const io = fakeIo();
|
|
54
55
|
io.api = async () => { throw new Error("no ledger call expected"); };
|
|
55
|
-
const out = await mod.runRelease({ io, repo: REPO, root: tmp(), mounts: DISK, id: newReleaseId(), opts: { merge: true }, config: {}, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ review: ok, fixes: ok, "post-merge": ok }) });
|
|
56
|
+
const out = await mod.runRelease({ io, repo: REPO, root: tmp(), mounts: DISK, id: newReleaseId(), opts: { merge: true }, config: {}, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ "ci-green": ok, review: ok, fixes: ok, "post-merge": ok }) });
|
|
56
57
|
assert.equal(out.status, "done");
|
|
57
58
|
const merge = io.calls.find((a) => a[0] === "pr" && a[1] === "merge");
|
|
58
59
|
assert.deepEqual(merge, ["pr", "merge", "7", "--repo", REPO, "--merge", "--match-head-commit", HEAD]);
|
|
@@ -65,7 +66,7 @@ describe("legacy managed promotion without a fence (#5561 regression)", () => {
|
|
|
65
66
|
const io = fakeIo({ gate: "failure" });
|
|
66
67
|
const shown = [];
|
|
67
68
|
io.git = (a) => { if (a[0] === "show") shown.push(a[1]); throw new Error("no git"); };
|
|
68
|
-
await mod.runRelease({ io, repo: REPO, root: tmp(), mounts: DISK, id: newReleaseId(), opts: { merge: true }, config: { managed: true }, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ review: ok, fixes: ok, "post-merge": ok }) });
|
|
69
|
+
await mod.runRelease({ io, repo: REPO, root: tmp(), mounts: DISK, id: newReleaseId(), opts: { merge: true }, config: { managed: true }, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ "ci-green": ok, review: ok, fixes: ok, "post-merge": ok }) });
|
|
69
70
|
assert.ok(shown.some((x) => x.startsWith("origin/main:")), "policy read for the flake rerun");
|
|
70
71
|
});
|
|
71
72
|
});
|
|
@@ -75,7 +76,7 @@ describe("release job (#5211)", () => {
|
|
|
75
76
|
const io = fakeIo(world), root = tmp(), id = newReleaseId();
|
|
76
77
|
// Real preflight/release-pr/promotion, with review/fixes/post-merge replaced by no-ops.
|
|
77
78
|
const mod = await import("./release.mjs");
|
|
78
|
-
const out = await mod.runRelease({ io, repo: REPO, root, mounts: DISK, id, opts, config, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ review: ok, fixes: ok, "post-merge": ok }) });
|
|
79
|
+
const out = await mod.runRelease({ io, repo: REPO, root, mounts: DISK, id, opts, config, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ "ci-green": ok, review: ok, fixes: ok, "post-merge": ok }) });
|
|
79
80
|
return { io, out, root, id };
|
|
80
81
|
};
|
|
81
82
|
|
|
@@ -139,7 +140,7 @@ describe("release job (#5211)", () => {
|
|
|
139
140
|
const io = fakeIo({ prState: "MERGED" }), root = tmp(), id = newReleaseId();
|
|
140
141
|
const mod = await import("./release.mjs");
|
|
141
142
|
let seen = null;
|
|
142
|
-
const out = await mod.runRelease({ io, repo: REPO, root, mounts: DISK, id, opts: {}, config: {}, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ review: ok, fixes: ok, "post-merge": async (c) => { seen = c.state.steps.promotion.result; return {}; } }) });
|
|
143
|
+
const out = await mod.runRelease({ io, repo: REPO, root, mounts: DISK, id, opts: {}, config: {}, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ "ci-green": ok, review: ok, fixes: ok, "post-merge": async (c) => { seen = c.state.steps.promotion.result; return {}; } }) });
|
|
143
144
|
assert.equal(out.status, "done");
|
|
144
145
|
assert.equal(seen.alreadyMerged, true);
|
|
145
146
|
assert.equal(seen.mergeCommit, "m".repeat(40));
|
|
@@ -210,12 +211,12 @@ describe("release job (#5211)", () => {
|
|
|
210
211
|
const mod = await import("./release.mjs");
|
|
211
212
|
const ran = [];
|
|
212
213
|
const rec = (n, fn) => async (ctx) => { ran.push(n); return fn(ctx); };
|
|
213
|
-
const base = mod.withStubs({ review: ok, fixes: ok, "post-merge": ok });
|
|
214
|
+
const base = mod.withStubs({ "ci-green": ok, review: ok, fixes: ok, "post-merge": ok });
|
|
214
215
|
const kill = async () => { throw new Error("killed"); };
|
|
215
216
|
const first = { ...base, preflight: rec("preflight", base.preflight), "release-pr": rec("release-pr", base["release-pr"]), review: kill };
|
|
216
217
|
await assert.rejects(() => mod.runRelease({ io, repo: REPO, root, mounts: DISK, id, opts: { merge: true }, config: {}, branches: {}, steps: first }), /killed/);
|
|
217
218
|
const st = openRelease(root, id).load();
|
|
218
|
-
assert.deepEqual(Object.keys(st.steps), ["preflight", "release-pr"]);
|
|
219
|
+
assert.deepEqual(Object.keys(st.steps), ["preflight", "release-pr", "ci-green"]);
|
|
219
220
|
const second = { ...base, preflight: rec("preflight2", base.preflight), "release-pr": rec("release-pr2", base["release-pr"]) };
|
|
220
221
|
const out = await mod.runRelease({ io, repo: REPO, root, mounts: DISK, id, opts: { merge: true }, config: {}, branches: {}, steps: second });
|
|
221
222
|
assert.equal(out.status, "done");
|
|
@@ -226,7 +227,7 @@ describe("release job (#5211)", () => {
|
|
|
226
227
|
const root = tmp(), id = newReleaseId(), io = fakeIo(), mod = await import("./release.mjs");
|
|
227
228
|
const at = new Date(io.now()).toISOString();
|
|
228
229
|
const review = { pr: 7, head: HEAD, verdict: "BLOCK DEPLOY", marker: "FORGE:GATE_FAILURE", blocking: [101], filed: [101], ciFailing: 1, items: [] };
|
|
229
|
-
openRelease(root, id, DISK).save({ v: 1, id, repo: REPO, startedAt: at, held: [], steps: { preflight: { done: true, at, result: {} }, "release-pr": { done: true, at, result: { pr: 7, head: HEAD } }, review: { done: true, at, result: review } } });
|
|
230
|
+
openRelease(root, id, DISK).save({ v: 1, id, repo: REPO, startedAt: at, held: [], steps: { preflight: { done: true, at, result: {} }, "release-pr": { done: true, at, result: { pr: 7, head: HEAD } }, "ci-green": { done: true, at, result: {} }, review: { done: true, at, result: review } } });
|
|
230
231
|
const stuckGh = (a) => {
|
|
231
232
|
if (a[0] === "run" && a[1] === "list") return JSON.stringify([{ databaseId: 1, name: "Shell Compatibility", status: "in_progress", conclusion: "" }, { databaseId: 2, name: "CI", status: "completed", conclusion: "failure" }]);
|
|
232
233
|
if (a[0] === "run" && a[1] === "view") return "boom";
|
|
@@ -234,6 +235,7 @@ describe("release job (#5211)", () => {
|
|
|
234
235
|
};
|
|
235
236
|
const waits = [], log = [];
|
|
236
237
|
const real = realSeam({ repo: REPO, def: "main", env: {}, cwd: "/tmp", gh: stuckGh, io: { now: () => 0, sleep: async (ms) => { waits.push(ms); }, print: () => {} } });
|
|
238
|
+
io.ciGreen = { now: () => 0, sleep: async () => {}, isDraft: async () => false, headOf: async () => HEAD, checks: async () => [], required: async () => [] };
|
|
237
239
|
io.review = {
|
|
238
240
|
failedJobs: real.failedJobs, headOf: async () => HEAD, issueMerged: async () => false,
|
|
239
241
|
fileDeferred: async () => [], fileFixIssue: async () => { log.push("fix-issue"); return 200; },
|
|
@@ -241,7 +243,7 @@ describe("release job (#5211)", () => {
|
|
|
241
243
|
pre: async () => ({ code: 1, data: null, lines: ["stopped"] }), // ends the delta review right after the fix lane
|
|
242
244
|
};
|
|
243
245
|
const timer = new Promise((_, rej) => setTimeout(() => rej(new Error("still waiting after 5000ms")), 5000).unref());
|
|
244
|
-
const out = await Promise.race([mod.runRelease({ io, repo: REPO, root, mounts: DISK, id, opts: { merge: true }, config: {}, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ "post-merge": ok }) }), timer]);
|
|
246
|
+
const out = await Promise.race([mod.runRelease({ io, repo: REPO, root, mounts: DISK, id, opts: { merge: true }, config: { reviewFixes: true }, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ "post-merge": ok }) }), timer]);
|
|
245
247
|
assert.deepEqual(log, ["fix-issue", "lane"]);
|
|
246
248
|
assert.deepEqual(waits, []);
|
|
247
249
|
assert.equal(out.step, "fixes"); // reached the fix step and ran it, not stopped at review
|
|
@@ -276,7 +278,7 @@ describe("release job (#5211)", () => {
|
|
|
276
278
|
assert.equal(readReleaseConfig("release:\n managed: true\n").managed, true);
|
|
277
279
|
const apiCalls = [], ghCalls = [], io = { print() {}, now: () => 1_700_000_000_000, runningLanes: async () => [], batches: async () => [], setParallel: async () => {}, gh: async (a) => { ghCalls.push(a); return ""; }, api: async (...a) => { apiCalls.push(a); return {}; } };
|
|
278
280
|
const ok = async () => ({});
|
|
279
|
-
const out = await (await import("./release.mjs")).runRelease({ io, repo: REPO, root: tmp(), mounts: DISK, id: newReleaseId(), opts: {}, config: {}, branches: {}, steps: { preflight: ok, "host-preflight": ok, "release-pr": ok, review: ok, fixes: ok, "mark-ready": ok, rehearsal: ok, promotion: ok, "post-merge": ok, deploy: async () => ({ skipped: true }) } });
|
|
281
|
+
const out = await (await import("./release.mjs")).runRelease({ io, repo: REPO, root: tmp(), mounts: DISK, id: newReleaseId(), opts: {}, config: {}, branches: {}, steps: { preflight: ok, "host-preflight": ok, "release-pr": ok, "ci-green": ok, review: ok, fixes: ok, "mark-ready": ok, rehearsal: ok, promotion: ok, "post-merge": ok, deploy: async () => ({ skipped: true }) } });
|
|
280
282
|
assert.equal(out.status, "done");
|
|
281
283
|
assert.deepEqual(apiCalls, []);
|
|
282
284
|
assert.deepEqual(ghCalls, []);
|
|
@@ -418,7 +420,7 @@ describe("release post-merge step (#5213)", () => {
|
|
|
418
420
|
const go = async (runs) => {
|
|
419
421
|
const io = fakeIo({ pm: world(runs).pm });
|
|
420
422
|
const config = { postMerge: { publishPolls: 1, runPolls: 1 } };
|
|
421
|
-
return mod.runRelease({ io, repo: REPO, root, mounts: DISK, id, opts: { merge: true }, config, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ review: ok, fixes: ok }) });
|
|
423
|
+
return mod.runRelease({ io, repo: REPO, root, mounts: DISK, id, opts: { merge: true }, config, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ "ci-green": ok, review: ok, fixes: ok }) });
|
|
422
424
|
};
|
|
423
425
|
assert.equal((await go([[{ databaseId: 1, status: "completed", conclusion: "failure" }]])).status, "blocked");
|
|
424
426
|
assert.equal((await go([[{ databaseId: 2, status: "completed", conclusion: "success" }]])).status, "done");
|
|
@@ -441,7 +443,7 @@ describe("snapshot releases (#5276)", () => {
|
|
|
441
443
|
const io = fakeIo(world);
|
|
442
444
|
if (world.git) io.git = world.git;
|
|
443
445
|
const mod = await import("./release.mjs");
|
|
444
|
-
const out = await mod.runRelease({ io, repo: REPO, root: tmp(), mounts: DISK, id: newReleaseId(), opts, config, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ review: ok, fixes: ok, "post-merge": ok }) });
|
|
446
|
+
const out = await mod.runRelease({ io, repo: REPO, root: tmp(), mounts: DISK, id: newReleaseId(), opts, config, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ "ci-green": ok, review: ok, fixes: ok, "post-merge": ok }) });
|
|
445
447
|
return { io, out };
|
|
446
448
|
};
|
|
447
449
|
|
|
@@ -615,7 +617,7 @@ describe("preflight staging-health gate (#6013)", () => {
|
|
|
615
617
|
it("refuses a snapshot cut on a red staging head and proceeds when green", async () => {
|
|
616
618
|
const mod = await import("./release.mjs");
|
|
617
619
|
const root = tmp(), id = newReleaseId();
|
|
618
|
-
const base = (io) => ({ io, repo: REPO, root, mounts: DISK, id, opts: {}, config: snap, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ "release-pr": ok, review: ok, fixes: ok, promotion: ok, "post-merge": ok }) });
|
|
620
|
+
const base = (io) => ({ io, repo: REPO, root, mounts: DISK, id, opts: {}, config: snap, branches: { staging: "staging", default: "main" }, steps: mod.withStubs({ "release-pr": ok, "ci-green": ok, review: ok, fixes: ok, promotion: ok, "post-merge": ok }) });
|
|
619
621
|
const reds = await mod.runRelease(base(fakeIo(world([{ name: "black", status: "completed", conclusion: "failure", text: "" }]))));
|
|
620
622
|
assert.equal(reds.status, "refused");
|
|
621
623
|
assert.match(JSON.stringify(reds), /black/);
|
|
@@ -626,3 +628,22 @@ describe("preflight staging-health gate (#6013)", () => {
|
|
|
626
628
|
assert.notEqual(green.status, "refused");
|
|
627
629
|
});
|
|
628
630
|
});
|
|
631
|
+
|
|
632
|
+
describe("default ci-green flow in the conductor (#6164)", () => {
|
|
633
|
+
it("runs ci-green after release-pr and before review; a review blocker stops the job as blocked (exit 3) with the blockers named", async () => {
|
|
634
|
+
const mod = await import("./release.mjs");
|
|
635
|
+
const order = [], io = fakeIo();
|
|
636
|
+
const rec = (n, r = {}) => async () => { order.push(n); return r; };
|
|
637
|
+
const steps = mod.withStubs({ "ci-green": rec("ci-green"), review: rec("review"), fixes: async () => ({ blocked: true, held: true, reason: "review blockers #101 #102; release PR #7 closed; the next release starts fresh after they merge" }), "post-merge": ok });
|
|
638
|
+
const out = await mod.runRelease({ io, repo: REPO, root: tmp(), mounts: DISK, id: newReleaseId(), opts: { merge: true }, config: {}, branches: { staging: "staging", default: "main" }, steps: { ...steps, preflight: ok, "release-pr": rec("release-pr", { pr: 7, head: HEAD }) } });
|
|
639
|
+
assert.deepEqual(order, ["release-pr", "ci-green", "review"]);
|
|
640
|
+
assert.equal(out.status, "blocked"); assert.equal(out.step, "fixes"); assert.match(out.reason, /^review blockers #101 #102/);
|
|
641
|
+
});
|
|
642
|
+
it("release.block_severity and release.ci_green_max_wait_min only tune the default; absent keys leave it on", () => {
|
|
643
|
+
const c = readReleaseConfig("release:\n block_severity: medium\n ci_green_max_wait_min: 15\n");
|
|
644
|
+
assert.equal(c.blockSeverity, "MEDIUM"); assert.deepEqual(c.ciGreen, { maxWaitMin: 15 });
|
|
645
|
+
assert.equal(readReleaseConfig("release:\n auto_merge: true\n").ciGreen, undefined);
|
|
646
|
+
assert.equal(readReleaseConfig("release:\n auto_merge: true\n").reviewFixes, undefined, "review fix lanes are off unless release.review_fixes: true (compatibility)");
|
|
647
|
+
assert.equal(readReleaseConfig("release:\n review_fixes: true\n").reviewFixes, true);
|
|
648
|
+
});
|
|
649
|
+
});
|
package/bin/review-staging.mjs
CHANGED
|
@@ -33,7 +33,7 @@ import { attemptGuard } from "./lean/release-flakes.mjs";
|
|
|
33
33
|
import { requiredChecksRead } from "./lean/effects.mjs";
|
|
34
34
|
|
|
35
35
|
const INSTALL_ROOT = fileURLToPath(new URL("..", import.meta.url));
|
|
36
|
-
const USAGE = "usage: forgedock review-staging [<PR number|PR URL>] [--thorough | --delta <from-sha>] [--json]\n" +
|
|
36
|
+
const USAGE = "usage: forgedock review-staging [<PR number|PR URL>] [--thorough | --delta <from-sha>] [--allow-ci-pending | --gate-only] [--json]\n" +
|
|
37
37
|
" forgedock review-staging [<PR>] --finalize --test-gate-output <file> [--notes-dropped <n>] [--json]\n" +
|
|
38
38
|
" forgedock review-staging [<PR>] --summary [--filed <issue>]... [--json]\n" +
|
|
39
39
|
" forgedock review-staging [<PR>] --post-reviewer <domain> --body-file <file>";
|
|
@@ -53,13 +53,15 @@ class Stop extends Error {
|
|
|
53
53
|
|
|
54
54
|
/** argv -> {pr, thorough, json, mode, testGateOutput, notesDropped, filed, delta}. Throws Stop(2) on anything else. */
|
|
55
55
|
export function parseArgs(argv) {
|
|
56
|
-
const o = { pr: null, thorough: false, json: false, mode: "pre", testGateOutput: null, notesDropped: 0, filed: [], delta: null, domain: null, bodyFile: null };
|
|
56
|
+
const o = { pr: null, thorough: false, json: false, mode: "pre", testGateOutput: null, notesDropped: 0, filed: [], delta: null, domain: null, bodyFile: null, allowCiPending: false, gateOnly: false };
|
|
57
57
|
const setMode = (m, a) => { if (o.mode !== "pre") throw new Stop(2, [`review-staging: ${a} cannot be combined with --${o.mode}`, USAGE]); o.mode = m; };
|
|
58
58
|
const value = (i, a) => { const v = argv[i + 1]; if (v == null || v.startsWith("--")) throw new Stop(2, [`review-staging: ${a} requires a value`, USAGE]); return v; };
|
|
59
59
|
for (let i = 0; i < argv.length; i++) {
|
|
60
60
|
const a = argv[i];
|
|
61
61
|
if (a === "--thorough") o.thorough = true;
|
|
62
62
|
else if (a === "--json") o.json = true;
|
|
63
|
+
else if (a === "--allow-ci-pending") o.allowCiPending = true;
|
|
64
|
+
else if (a === "--gate-only") o.gateOnly = true;
|
|
63
65
|
else if (a === "--finalize") setMode("finalize", a);
|
|
64
66
|
else if (a === "--summary") setMode("summary", a);
|
|
65
67
|
else if (a === "--post-reviewer") { setMode("post-reviewer", a); o.domain = value(i++, a); }
|
|
@@ -90,6 +92,7 @@ export function parseArgs(argv) {
|
|
|
90
92
|
if (o.mode !== "post-reviewer" && o.bodyFile) throw new Stop(2, ["review-staging: --body-file belongs to --post-reviewer", USAGE]);
|
|
91
93
|
if (o.mode !== "finalize" && (o.testGateOutput != null || o.notesDropped)) throw new Stop(2, ["review-staging: --test-gate-output/--notes-dropped belong to --finalize", USAGE]);
|
|
92
94
|
if (o.mode !== "summary" && o.filed.length) throw new Stop(2, ["review-staging: --filed belongs to --summary", USAGE]);
|
|
95
|
+
if (o.mode !== "pre" && (o.gateOnly || o.allowCiPending)) throw new Stop(2, ["review-staging: --allow-ci-pending belongs to the pre-dispatch", USAGE]);
|
|
93
96
|
if (o.mode !== "pre" && o.thorough) throw new Stop(2, ["review-staging: --thorough belongs to the pre-dispatch", USAGE]);
|
|
94
97
|
if (o.mode !== "pre" && o.delta) throw new Stop(2, ["review-staging: --delta belongs to the pre-dispatch (--finalize reads it from the review context)", USAGE]);
|
|
95
98
|
if (o.thorough && o.delta) throw new Stop(2, ["review-staging: --delta cannot be combined with --thorough", USAGE]);
|
|
@@ -233,6 +236,28 @@ async function retryGh(io, args) {
|
|
|
233
236
|
}
|
|
234
237
|
}
|
|
235
238
|
|
|
239
|
+
/** Phase 0A: the bundle PR set, then the open review-finding gate. Throws Stop(1) on a block. @returns {{common, branches, prsFile, gate}} */
|
|
240
|
+
async function bundleAndGate(io, c, pr, sd, env) {
|
|
241
|
+
const common = ["--repo", c.ghRepo, "--pr", String(pr)];
|
|
242
|
+
const branches = ["--default", c.defaultBranch, "--staging", c.stagingBranch];
|
|
243
|
+
const prsFile = join(sd, `${pr}_bundle-prs.txt`);
|
|
244
|
+
const b = await bash(io, "review-staging-pre.sh", ["bundle", ...common, ...branches, "--sd", sd], env);
|
|
245
|
+
if (b.stdout.trim()) io.err(b.stdout.trim());
|
|
246
|
+
if (b.code !== 0) throw new Stop(1, [b.stderr.trim(), `REVIEW_RESULT: status: BLOCKED, blocker: bundle PR set failed (exit ${b.code})`].filter(Boolean));
|
|
247
|
+
let bundlePrs = "";
|
|
248
|
+
try { bundlePrs = io.readFile(prsFile); } catch { /* unreadable: fail closed below */ }
|
|
249
|
+
// An empty bundle would let the gate pass vacuously (forge#4470): nothing gated is never a pass.
|
|
250
|
+
if (!bundlePrs.split("\n").some((l) => /^\d+$/.test(l.trim()))) throw new Stop(1, [`REVIEW_RESULT: status: BLOCKED, blocker: bundle PR set is empty or unreadable (${prsFile}); nothing gated (fail closed)`]);
|
|
251
|
+
const g = await bash(io, "review-staging-pre.sh", ["gate", ...common, "--prs-file", prsFile], env);
|
|
252
|
+
if (g.code !== 0) {
|
|
253
|
+
const out = g.stdout.trim();
|
|
254
|
+
throw new Stop(1, [out, g.stderr.trim(), /RESULT: BLOCK DEPLOY/.test(out) ? "" : "RESULT: BLOCK DEPLOY"].filter(Boolean));
|
|
255
|
+
}
|
|
256
|
+
const gate = /human override/.test(g.stdout) ? "PASS (override)" : "PASS";
|
|
257
|
+
|
|
258
|
+
return { common, branches, prsFile, gate };
|
|
259
|
+
}
|
|
260
|
+
|
|
236
261
|
async function main(argv, io) {
|
|
237
262
|
const a = parseArgs(argv);
|
|
238
263
|
if (a.mode === "finalize") return finalize(a, io);
|
|
@@ -249,6 +274,11 @@ async function main(argv, io) {
|
|
|
249
274
|
const head = await headSha(io, c, pr);
|
|
250
275
|
if (a.delta && a.delta === head) throw new Stop(1, [`REVIEW_RESULT: status: BLOCKED, blocker: --delta ${head} is the current head of PR #${pr}: nothing changed since that pass, nothing to review`]);
|
|
251
276
|
const sha7 = head.slice(0, 7);
|
|
277
|
+
if (a.gateOnly) { // the release job's first check: an open review-finding issue blocks before CI or any reviewer; posts only the gate marker
|
|
278
|
+
const { gate } = await bundleAndGate(io, c, pr, sd, env);
|
|
279
|
+
io.out(a.json ? JSON.stringify({ pr, headSha: head, gate }) : `OPEN_FINDING_GATE: ${gate} on PR #${pr}`);
|
|
280
|
+
return 0;
|
|
281
|
+
}
|
|
252
282
|
// #4865: with selftest.sandbox_repo set, the release needs a passing live selftest for exactly this head (fail closed).
|
|
253
283
|
// Without a sandbox repo there is nothing the harness can run against, so the gate is skipped and says so.
|
|
254
284
|
if (c.sandboxRepo) {
|
|
@@ -264,26 +294,14 @@ async function main(argv, io) {
|
|
|
264
294
|
} catch { /* unreadable: treated as a first pass */ }
|
|
265
295
|
const priorOpen = priorRoutes > 0 ? await priorFindings(io, c, pr, "open") : [];
|
|
266
296
|
const priorResolved = priorRoutes > 0 ? await priorFindings(io, c, pr, "closed") : [];
|
|
267
|
-
await retryGh(io, ["pr", "comment", String(pr), "-R", c.ghRepo, "--body", `<!-- FORGE:REVIEW_ROUTE mode=staging-deploy spec=review-pr-staging.md sha=${sha7} -->`]);
|
|
297
|
+
await retryGh(io, ["pr", "comment", String(pr), "-R", c.ghRepo, "--body", `<!-- FORGE:REVIEW_ROUTE mode=staging-deploy spec=review-pr-staging.md sha=${sha7}${a.allowCiPending ? " allow_ci_pending=true" : ""} -->`]);
|
|
268
298
|
io.writeFile(join(sd, `staging_pr_number.${runKey(io.env)}`), `${pr}\n`);
|
|
269
299
|
|
|
270
|
-
// 0A: bundle PR set, then the open review-finding gate
|
|
271
|
-
const common =
|
|
272
|
-
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
if (b.stdout.trim()) io.err(b.stdout.trim());
|
|
276
|
-
if (b.code !== 0) throw new Stop(1, [b.stderr.trim(), `REVIEW_RESULT: status: BLOCKED, blocker: bundle PR set failed (exit ${b.code})`].filter(Boolean));
|
|
277
|
-
let bundlePrs = "";
|
|
278
|
-
try { bundlePrs = io.readFile(prsFile); } catch { /* unreadable: fail closed below */ }
|
|
279
|
-
// An empty bundle would let the gate pass vacuously (forge#4470): nothing gated is never a pass.
|
|
280
|
-
if (!bundlePrs.split("\n").some((l) => /^\d+$/.test(l.trim()))) throw new Stop(1, [`REVIEW_RESULT: status: BLOCKED, blocker: bundle PR set is empty or unreadable (${prsFile}); nothing gated (fail closed)`]);
|
|
281
|
-
const g = await bash(io, "review-staging-pre.sh", ["gate", ...common, "--prs-file", prsFile], env);
|
|
282
|
-
if (g.code !== 0) {
|
|
283
|
-
const out = g.stdout.trim();
|
|
284
|
-
throw new Stop(1, [out, g.stderr.trim(), /RESULT: BLOCK DEPLOY/.test(out) ? "" : "RESULT: BLOCK DEPLOY"].filter(Boolean));
|
|
285
|
-
}
|
|
286
|
-
const gate = /human override/.test(g.stdout) ? "PASS (override)" : "PASS";
|
|
300
|
+
// 0A: bundle PR set, then the open review-finding gate (it runs first: an open finding blocks before CI or any reviewer)
|
|
301
|
+
const { common, branches, prsFile, gate } = await bundleAndGate(io, c, pr, sd, env);
|
|
302
|
+
// CI green next (default, no off switch): a review of a head whose required checks are pending or red is wasted when CI then moves the head.
|
|
303
|
+
const ciBlock = a.allowCiPending ? null : await ciNotGreen(io, c, pr, env);
|
|
304
|
+
if (ciBlock) throw new Stop(1, [`REVIEW_RESULT: status: BLOCKED, blocker: CI not green on ${sha7} (pending: ${ciBlock.pending.join(", ") || "none"}, failing: ${ciBlock.failing.join(", ") || "none"}); review starts after CI is green`]);
|
|
287
305
|
|
|
288
306
|
// 0B.1: scope
|
|
289
307
|
const s = await bash(io, "review-staging-pre.sh", ["scope", ...common, ...branches, "--prs-file", prsFile, "--sd", sd], env);
|
|
@@ -492,7 +510,7 @@ async function finalize(a, io) {
|
|
|
492
510
|
const items = worklist.items;
|
|
493
511
|
const state = {
|
|
494
512
|
pr, head, bundle, codeBranch, scopeMode, delta, testGate: { verdict: tg.verdict, reason: tg.reason }, counts, notes,
|
|
495
|
-
confirmedCritical: confirmed("CRITICAL"), confirmedHigh: confirmed("HIGH"), resolved,
|
|
513
|
+
confirmedCritical: confirmed("CRITICAL"), confirmedHigh: confirmed("HIGH"), confirmedMedium: confirmed("MEDIUM"), confirmedIds: findings.filter((f) => !resolvedBy.has(f.id) && upper(f.confidence) === "CONFIRMED").map((f) => f.id), resolved,
|
|
496
514
|
toFile: items.filter((i) => i.action === "file"), skipped: items.filter((i) => String(i.action).startsWith("skip-")),
|
|
497
515
|
};
|
|
498
516
|
io.writeFile(join(sd, `${pr}_finalize.json`), JSON.stringify(state));
|
|
@@ -567,6 +585,30 @@ export function cancelOnlyChecks(checks, required = []) {
|
|
|
567
585
|
return [...seen.values()];
|
|
568
586
|
}
|
|
569
587
|
|
|
588
|
+
/** Required checks on the head, by state: `pending` (running, or required but not reported yet) and `failing` (fail/cancel and not pending). */
|
|
589
|
+
export function ciState(checks, required = []) {
|
|
590
|
+
const rows = redChecks(checks, required).blockRows;
|
|
591
|
+
const names = (f) => [...new Set(rows.filter(f).map((k) => String(k.name)))];
|
|
592
|
+
const pend = names((k) => k.bucket === "pending");
|
|
593
|
+
const seen = new Set(checks.map((k) => k?.name));
|
|
594
|
+
const missing = [...new Set(required)].filter((n) => !CI_EXCLUDED_CHECKS.includes(n) && !seen.has(n));
|
|
595
|
+
const pending = [...new Set([...pend, ...missing])];
|
|
596
|
+
return { pending, failing: names((k) => k.bucket === "fail" || k.bucket === "cancel").filter((n) => !pending.includes(n)), green: !pending.length && !rows.length };
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/** Pre-dispatch CI read: `null` when green (or the PR has no checks), else `{pending, failing}`. An unreadable read fails closed. */
|
|
600
|
+
async function ciNotGreen(io, c, pr, env) {
|
|
601
|
+
const r = await io.run("gh", ["pr", "checks", String(pr), "-R", c.ghRepo, "--json", "name,bucket,link"], { env, cwd: io.cwd });
|
|
602
|
+
const checks = r.code === 0 || r.code === 8 ? parseChecks(r.stdout) : null;
|
|
603
|
+
if (!checks) {
|
|
604
|
+
if (/no checks reported/i.test(`${r.stderr ?? ""}${r.stdout ?? ""}`)) return null;
|
|
605
|
+
return { pending: [], failing: ["checks unreadable"] };
|
|
606
|
+
}
|
|
607
|
+
const read = await requiredChecksRead({ gh: io.gh, repo: c.ghRepo, lane: c.defaultBranch });
|
|
608
|
+
const st = ciState(checks, requiredSet(read, c.extraRequiredChecks));
|
|
609
|
+
return st.green ? null : st;
|
|
610
|
+
}
|
|
611
|
+
|
|
570
612
|
const CI_POLL_MS = 20_000, CI_POLL_MAX = 45;
|
|
571
613
|
|
|
572
614
|
/** One `gh run rerun --failed` per cancelled run of the cancel-only required checks (#6014: never past RERUN_ATTEMPT_CAP reruns of a run), then wait until none of them is pending. @returns the re-read checks, or `checks` when nothing could be rerun. */
|
|
@@ -89,7 +89,7 @@ The **Evidence-Based Review Protocol** and **Structured Findings Protocol** are
|
|
|
89
89
|
|
|
90
90
|
## Step 1: Pre-dispatch (`forgedock review-staging`)
|
|
91
91
|
|
|
92
|
-
**This step is MANDATORY and runs first. No step may be skipped.** One CLI call runs the deterministic pre-dispatch (forge#4358): the `FORGE:REVIEW_ROUTE` marker (route assertion and audit trail), prior-finding awareness on re-entry, the Phase 0A bundle PR set and open review-finding gate (it posts `FORGE:GATE_FAILURE` / `FORGE:GATE_PASS` and stops on a block, including degraded bundle panels), the 0B.1 bundle review scope (`scripts/review-staging-pre.sh`), the 0C prepare (`scripts/review-prepare.sh --no-delta --build-gate advisory`) and the risk-tiered roster (`scripts/review-roster.sh`, inside prepare). It writes one reviewer brief per roster domain and truncates the PR-keyed launched-agent file. All state lives in `$FORGE_SCRATCHPAD` (default `$PWD/.forge-scratch`) under the PR-keyed names the later steps read. Every helper comes from the ForgeDock install, never from the repo under review.
|
|
92
|
+
**This step is MANDATORY and runs first. No step may be skipped.** Order: the open-finding gate, then CI green, then one review pass (the v1.0 contract). The call refuses (`REVIEW_RESULT: status: BLOCKED, blocker: CI not green on <sha> (pending: ..., failing: ...)`) while a required check on the head is pending or failing, also with `--delta`; wait for green (the release job does this in its `ci-green` step) and rerun. `--allow-ci-pending` overrides and is recorded in the `FORGE:REVIEW_ROUTE` marker. One CLI call runs the deterministic pre-dispatch (forge#4358): the `FORGE:REVIEW_ROUTE` marker (route assertion and audit trail), prior-finding awareness on re-entry, the Phase 0A bundle PR set and open review-finding gate (it posts `FORGE:GATE_FAILURE` / `FORGE:GATE_PASS` and stops on a block, including degraded bundle panels), the 0B.1 bundle review scope (`scripts/review-staging-pre.sh`), the 0C prepare (`scripts/review-prepare.sh --no-delta --build-gate advisory`) and the risk-tiered roster (`scripts/review-roster.sh`, inside prepare). It writes one reviewer brief per roster domain and truncates the PR-keyed launched-agent file. All state lives in `$FORGE_SCRATCHPAD` (default `$PWD/.forge-scratch`) under the PR-keyed names the later steps read. Every helper comes from the ForgeDock install, never from the repo under review.
|
|
93
93
|
|
|
94
94
|
**Idempotent re-review (merge-train aware)**: <!-- Added: forge#1328, extended: forge#1332 --> This spec is safe to invoke multiple times on the same PR. Each invocation posts a new `FORGE:REVIEW_ROUTE` marker with the current SHA, so re-review passes are distinguished by SHA, not by PR number. Prior open findings are carried forward into the briefs (do not re-file them). Prior resolved findings are excluded from the verdict.
|
|
95
95
|
|
package/docs/CONFIG.md
CHANGED
|
@@ -850,6 +850,26 @@ release:
|
|
|
850
850
|
|
|
851
851
|
`forgedock release verify <release id>` (#5562) re-runs the deploy verification of a release that passed LIVE_CHECK; a release id (`rYYYYMMDD-HHMMSS-N`) is never mistaken for a sha. Policy `verify` block (default branch, `.forge/release.yaml`): `results` (list of `{workflow, kind: smoke|edge|convergence}`, layer 1), `workflow` (verification workflow dispatched through the epoch fence, layer 2), `slis` (layer 3, entries `{name, tolerance, worse: higher|lower, abs}` read through an injected read-only metric source; without one the layer reports `sli: skipped (no host)`), `post_deploy_checks_file` (layer 4, each issue's `[check:id]` runs once; entries with `for` are windowed and become rollup follow-ups), `flags` (layer 5, `{flag, off_command}` verified in the off state, never activated) and `close_requires: verified|deployed`. With `verified` (default once the block is set) an issue is closed only after a `FORGE:VERIFIED <deploy sha>` comment; `deployed` closes without it. Soak minutes by risk class: low 10, medium 20, full 30, p0 15, overridden by `lanes.<lane>.soak_min` (a number or a map by class). An empty `verify` block leaves VERIFYING a bare transition to LIVE.
|
|
852
852
|
|
|
853
|
+
### Default release flow: the v1.0 contract (#6164)
|
|
854
|
+
|
|
855
|
+
`forgedock release` and `forgedock review-staging` follow the original release contract of `commands/review-pr-staging.md` (commit dcfb86bf, 2026-06-05), restored as the default for every repo. There is no switch to turn it off.
|
|
856
|
+
|
|
857
|
+
1. **Open-finding gate first**: an open `review-finding` issue blocks the release before CI or any reviewer.
|
|
858
|
+
2. **`ci-green` step** before `review`: waits for every required check on the release PR head (protection, rulesets and `gate.required_checks`; `forgedock/verify`, `forge/deploy-gate` and the gate-marker check excluded). A failed check is rerun once; a pass on the rerun counts as green and files a `flaky-test` issue naming the test when the log shows it. A check still red after its rerun gets one CI fix round in the release PR, then CI is awaited again. A draft release PR (host preflight mode) has no Actions CI yet, so the step skips it.
|
|
859
|
+
3. **One review pass** on the green head. Every finding is filed as an issue (Phase 7). Nothing the review finds is fixed inside the release PR: no review fix lanes and no review-driven delta passes. A head that moves during review stops the job; re-run it.
|
|
860
|
+
4. **Verdict**: a CONFIRMED CRITICAL/HIGH finding (or a failed guard) means BLOCK. The job stops with `blocked: review blockers #A #B`, the release PR is closed, the blocker issues are added to the repo's open orchestrate batch (`orchestrate --add`) when one exists, and the next release starts fresh after they merge (the open-finding gate enforces it). Without blockers the release merges on GATE_PASS and everything else stays filed for later.
|
|
861
|
+
5. `forgedock review-staging <PR>` pre-dispatch (also `--delta`) runs the gate, then refuses while a required check is pending or failing (`CI not green on <sha> (pending: ..., failing: ...)`); `--allow-ci-pending` overrides and is recorded in the route marker. `--gate-only` runs just the open-finding gate.
|
|
862
|
+
6. `release status` prints `timing`: `ci_green_min`, `review_min`, `fix_rounds`, `review_passes`; the release ledger mirrors them.
|
|
863
|
+
|
|
864
|
+
Drift this removes: #4358 and #4360 (pre-dispatch and delta passes in the review loop), #5212 (review step fix lanes and delta passes), #5567 (CI and panel started on the same head, `ci.fix.co_start`, now ignored).
|
|
865
|
+
|
|
866
|
+
```yaml
|
|
867
|
+
release:
|
|
868
|
+
block_severity: high # lowest blocking severity: critical | high | medium (default high)
|
|
869
|
+
ci_green_max_wait_min: 40 # how long ci-green waits for pending checks before it blocks (max 240)
|
|
870
|
+
review_fixes: false # compatibility only: true restores the #5212 review fix lanes and delta passes
|
|
871
|
+
```
|
|
872
|
+
|
|
853
873
|
### `.forge/release.yaml` (#5551)
|
|
854
874
|
|
|
855
875
|
Nested release policy (`schema: 1`) lives in a committed `.forge/release.yaml`, not in the host-local forge.yaml. It is read from the default branch with `git show origin/<default>:.forge/release.yaml`, never from the PR head or the worktree, so a PR cannot weaken its own gates. The flat `release.*` keys above stay the fallback when the file is absent there. Sections: `branches`, `trust`, `state`, `units`, `couplings`, `contracts`, `forces`, `classify`, `risk`, `plan`, `lanes`, `merge`, `ci`, `preflight`, `deploy`, `verify`, `rollback`, `controls`.
|
package/package.json
CHANGED
package/pool/image/Dockerfile
CHANGED
|
@@ -22,7 +22,7 @@ RUN test -n "$FORGEDOCK_VERSION" || { echo "FORGEDOCK_VERSION build arg is requi
|
|
|
22
22
|
ENV IS_SANDBOX=1 DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 PLAYWRIGHT_BROWSERS_PATH=/opt/playwright UV_PYTHON_INSTALL_DIR=/opt/uv-python PATH=/opt/cs/bin:/opt/node/bin:/root/.local/bin:$PATH
|
|
23
23
|
|
|
24
24
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
25
|
-
ca-certificates curl git jq xz-utils build-essential python3 python3-venv python3-dev python3-yaml pkg-config libpq-dev \
|
|
25
|
+
ca-certificates curl git jq xz-utils build-essential python3 python3-venv python3-dev python3-yaml gnupg pkg-config libpq-dev \
|
|
26
26
|
shellcheck xvfb xauth postgresql-client redis-tools \
|
|
27
27
|
&& install -d -m 0755 /etc/apt/keyrings \
|
|
28
28
|
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg -o /etc/apt/keyrings/githubcli.gpg \
|