forgedock 1.58.0 → 1.59.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 +7 -2
- package/bin/lean/conformance.test.mjs +19 -0
- package/bin/lean/lean.mjs +3 -2
- package/bin/lean/lean.test.mjs +3 -3
- package/bin/lean/prompts.mjs +1 -1
- package/bin/lean/release-config.mjs +1 -1
- package/bin/lean/release-config.test.mjs +8 -0
- package/bin/lean/release-fixloop.mjs +108 -0
- package/bin/lean/release-fixloop.test.mjs +80 -0
- package/bin/lean/release-preflight.mjs +22 -0
- package/bin/lean/release-preflight.test.mjs +18 -2
- package/bin/lean/release-review.e2e.test.mjs +3 -2
- package/bin/lean/release-review.mjs +114 -31
- package/bin/lean/release-review.test.mjs +107 -20
- package/bin/lean/release-snapshot.mjs +32 -1
- package/bin/lean/release-snapshot.test.mjs +18 -1
- package/bin/lean/release.mjs +7 -1
- package/package.json +1 -1
package/bin/lean/conformance.mjs
CHANGED
|
@@ -558,7 +558,7 @@ export function testPlanProblems(c, { required = false } = {}) {
|
|
|
558
558
|
|
|
559
559
|
/** #5448: a requirement that starts as an imperative build verb is development work, not a prod-only measurement. */
|
|
560
560
|
const DEV_WORK_RE = /^\W*(?:\w+\s+){0,2}?(?:find|fix|implement|develop|build|write|patch|add|change)\b/i;
|
|
561
|
-
export function validateContract(c, issueText, { repro = false, pages = null, testPlan = false, readFile = null } = {}) {
|
|
561
|
+
export function validateContract(c, issueText, { repro = false, pages = null, testPlan = false, readFile = null, checkIds = null } = {}) {
|
|
562
562
|
const problems = [];
|
|
563
563
|
if (!c || typeof c !== "object" || Array.isArray(c)) return { ok: false, problems: ["contract.json is missing or not a JSON object"] };
|
|
564
564
|
const reqs = Array.isArray(c.requirements) ? c.requirements : [];
|
|
@@ -572,6 +572,11 @@ export function validateContract(c, issueText, { repro = false, pages = null, te
|
|
|
572
572
|
if (!inIssue(r?.quote, issueText)) problems.push(quoteMiss(id, r?.quote, issueText));
|
|
573
573
|
if (TRACKED.includes(r?.disposition) && blank(r?.why)) problems.push(`${id}: ${r.disposition} needs a why`);
|
|
574
574
|
if (r?.disposition === "post-deploy" && !CHECK_ID_RE.test(String(r?.check ?? ""))) problems.push(`${id}: post-deploy needs a check id (\`check\`, e.g. "login-smoke") naming an entry of .forge/post-deploy-checks.json on the default branch`);
|
|
575
|
+
if (r?.disposition === "post-deploy" && !r?.e2e_tracked && !r?.engine_check && CHECK_ID_RE.test(String(r?.check ?? "")) && checkIds) { // first-pass: an unregistered check id fails at freeze, not after the build (precheck check_unknown); checkIds = the base's check ids, as precheck reads them
|
|
576
|
+
const known = [...checkIds];
|
|
577
|
+
const delivers = (Array.isArray(c.deliverables) ? c.deliverables : []).some((d) => String(d?.path ?? "").replace(/^\.\//, "") === ".forge/post-deploy-checks.json");
|
|
578
|
+
if (!known.includes(r.check) && !delivers) problems.push(`${id}: post-deploy check '${r.check}' is not registered in .forge/post-deploy-checks.json; either add a deliverable {"path":".forge/post-deploy-checks.json","change":"register check ${r.check} (run, pass, timeout)"} or use an existing id${known.length ? ` (${known.slice(0, 8).join(", ")}${known.length > 8 ? ", ..." : ""})` : ""}`);
|
|
579
|
+
}
|
|
575
580
|
if (r?.disposition === "post-deploy" && blank(r?.local_infeasible_why)) problems.push(`${id}: post-deploy needs local_infeasible_why: why a fixture or recorded response cannot check this locally (#5448)`);
|
|
576
581
|
if (r?.disposition === "post-deploy" && (inLaneDeferral(r) || (bucketKind(r?.bucket) !== "owner" && bucketKind(r?.bucket) !== "host" && DEV_WORK_RE.test(String(r?.quote ?? ""))))) problems.push(`${id}: development work (finding or fixing the signal) is delivered in-lane, never deferred as prod-only; deliver it and keep only the measurement post-deploy (#5448)`);
|
|
577
582
|
if (r?.disposition === "not-applicable" && blank(r?.evidence)) problems.push(`${id}: not-applicable needs file:line evidence`);
|
|
@@ -1480,7 +1485,7 @@ export function autoPostDeployE2e(contract, only = null) {
|
|
|
1480
1485
|
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)" };
|
|
1481
1486
|
}
|
|
1482
1487
|
converted.push({ id: r.id, check: g.id, entry: g.entry });
|
|
1483
|
-
return { ...r, disposition: "post-deploy", bucket: "post-deploy", check: g.id, local_infeasible_why: "the observable exists only in production (live domain or deploy), so no local fixture can check it", why: "production-only e2e/manual criterion: converted by the engine to a post-deploy check (#5468)" };
|
|
1488
|
+
return { ...r, disposition: "post-deploy", bucket: "post-deploy", check: g.id, engine_check: true, local_infeasible_why: "the observable exists only in production (live domain or deploy), so no local fixture can check it", why: "production-only e2e/manual criterion: converted by the engine to a post-deploy check (#5468)" };
|
|
1484
1489
|
});
|
|
1485
1490
|
return { contract: converted.length ? { ...contract, requirements } : contract, converted };
|
|
1486
1491
|
}
|
|
@@ -2097,3 +2097,22 @@ describe("#5623: builder-correctable contract problems", () => {
|
|
|
2097
2097
|
assert.equal(classifyNeedsHuman({ outcome: "needs-human", code: OUTCOME_CODES.CONTRACT_INVALID, issueEdited: true }), "recoverable");
|
|
2098
2098
|
});
|
|
2099
2099
|
});
|
|
2100
|
+
|
|
2101
|
+
describe("first-pass: an unregistered post-deploy check id fails at freeze, not after the build", () => {
|
|
2102
|
+
const issue = "The schedd answers status in under 1 s under load.";
|
|
2103
|
+
const row = (extra = {}) => ({ requirements: [{ id: "R1", quote: "The schedd answers status in under 1 s under load.", disposition: "post-deploy", why: "needs a loaded host", bucket: "post-deploy", check: "schedd-status-under-load", local_infeasible_why: "needs real host load" }], deliverables: [{ id: "D1", path: "bin/x.mjs", change: "x", requirements: ["R1"] }], ...extra });
|
|
2104
|
+
const files = (json) => new Set(Object.keys(JSON.parse(json)));
|
|
2105
|
+
it("an id absent from the checks file and not delivered is a freeze problem naming the fix", () => {
|
|
2106
|
+
const v = validateContract(row(), issue, { checkIds: files('{"login-smoke":{"run":"true"}}') });
|
|
2107
|
+
assert.ok(v.problems.some((p) => /R1: post-deploy check 'schedd-status-under-load' is not registered[\s\S]*login-smoke/.test(p)), v.problems.join("\n"));
|
|
2108
|
+
});
|
|
2109
|
+
it("a registered id, or a deliverable that adds the checks file, passes this rule", () => {
|
|
2110
|
+
const reg = validateContract(row(), issue, { checkIds: files('{"schedd-status-under-load":{"run":"true"}}') });
|
|
2111
|
+
assert.ok(!reg.problems.some((p) => /is not registered/.test(p)));
|
|
2112
|
+
const del = validateContract(row({ deliverables: [{ id: "D1", path: "bin/x.mjs", change: "x", requirements: ["R1"] }, { id: "D2", path: ".forge/post-deploy-checks.json", change: "register it", requirements: ["R1"] }] }), issue, { checkIds: files("{}") });
|
|
2113
|
+
assert.ok(!del.problems.some((p) => /is not registered/.test(p)));
|
|
2114
|
+
});
|
|
2115
|
+
it("without checkIds (not resolved) the rule is skipped", () => {
|
|
2116
|
+
assert.ok(!validateContract(row(), issue).problems.some((p) => /is not registered/.test(p)));
|
|
2117
|
+
});
|
|
2118
|
+
});
|
package/bin/lean/lean.mjs
CHANGED
|
@@ -2216,7 +2216,8 @@ export async function runCore(o) {
|
|
|
2216
2216
|
};
|
|
2217
2217
|
contract = snapContract(contract);
|
|
2218
2218
|
const wtRead = (p) => { try { return readFileSync(join(wt, p), "utf8"); } catch { return ""; } }; // #5585: noindex pages are not public
|
|
2219
|
-
|
|
2219
|
+
const freezeCheckIds = await (async () => { try { return new Set(Object.keys(await checksAt(git, [base], wt))); } catch { return null; } })(); // first-pass: the base's registered post-deploy check ids
|
|
2220
|
+
let vc = validateContract(contract, issueText, { repro: reproOn(), pages: pagesConfig, testPlan: reproOn(), readFile: wtRead, checkIds: freezeCheckIds });
|
|
2220
2221
|
const missed = await preflightValidates(contract); // #4328: validate commands the host cannot run share the one correction
|
|
2221
2222
|
let misses = missed;
|
|
2222
2223
|
const correctContract = async (problems, note) => {
|
|
@@ -2226,7 +2227,7 @@ export async function runCore(o) {
|
|
|
2226
2227
|
await persistGenChecks();
|
|
2227
2228
|
await refreshIssue("contract validation");
|
|
2228
2229
|
contract = snapContract(contract);
|
|
2229
|
-
vc = validateContract(contract, issueText, { repro: reproOn(), pages: pagesConfig, testPlan: reproOn(), readFile: wtRead });
|
|
2230
|
+
vc = validateContract(contract, issueText, { repro: reproOn(), pages: pagesConfig, testPlan: reproOn(), readFile: wtRead, checkIds: freezeCheckIds });
|
|
2230
2231
|
};
|
|
2231
2232
|
if ((!vc.ok || missed.length || testRunnerProblems(contract, testRunners).length) && sessionId) {
|
|
2232
2233
|
await correctContract([...vc.problems, ...preflightProblems(missed), ...testRunnerProblems(contract, testRunners)], "resumed once");
|
package/bin/lean/lean.test.mjs
CHANGED
|
@@ -2179,7 +2179,7 @@ describe("hotspot prevention (forge#4195): plan facts, build rule, unexempted gr
|
|
|
2179
2179
|
assert.equal(hotspotBuildRule(null), ""); assert.equal(hotspotBuildRule(facts([], { enabled: false })), "");
|
|
2180
2180
|
const plan = builderPlanPrompt(7) + hotspotPlanNote(facts([HOT, { ...HOT, path: "a/b.py" }, { ...HOT, path: "c/d.py" }]));
|
|
2181
2181
|
// 1850: #4404 (verify out_of_band) and #4396 (split size rule) grew the plan prompt to ~1803 tokens on CI paths; 1900: #4589 (check timeout is not a block, one block-rule line). 2050: #4724 (deferred-row bucket rule). 1675 (hotspot case): #5284 (rubric prod_parity clause). 2375/1825: #5345 (self-check and pitfall lines).
|
|
2182
|
-
assert.ok(approxTokens(plan) <=
|
|
2182
|
+
assert.ok(approxTokens(plan) <= 2650, `plan prompt with hotspots is ${approxTokens(plan)} tokens`);
|
|
2183
2183
|
assert.ok(approxTokens(builderImplementPrompt() + hotspotBuildRule(facts([]))) <= 1875, `implement prompt with the hotspot rule is ${approxTokens(builderImplementPrompt() + hotspotBuildRule(facts([])))} of 1675 tokens`); // 1600: #4591 (never hand-name migration files) and #4596 (i18n translate rule), one line each; 1650: #4726 (e2e rule)
|
|
2184
2184
|
});
|
|
2185
2185
|
|
|
@@ -2668,7 +2668,7 @@ describe("comment templates", () => {
|
|
|
2668
2668
|
|
|
2669
2669
|
it("plan and implement prompts carry the stage templates and the contract schema within budget", () => {
|
|
2670
2670
|
const plan = builderPlanPrompt(7), impl = builderImplementPrompt();
|
|
2671
|
-
assert.ok(approxTokens(plan) <=
|
|
2671
|
+
assert.ok(approxTokens(plan) <= 2550, `plan prompt is ${approxTokens(plan)} tokens`); // 2550: first-pass check-id + dependency-block rule; 2500: #5445 (Test plan heading); 2475: staging; 2375: #5432 (duplicate rule); 2075: #5284 (prod_parity plan line); 2050: #4769 (activation-row rule); 2000: #4730 (owner-step remainder); 1950: #4724 (deferred-row bucket rule) // 2325: #5333 (git stash rule + stage stamp line)
|
|
2672
2672
|
assert.ok(approxTokens(impl) <= 1850, `implement prompt is ${approxTokens(impl)} of 1700 tokens`); // 1650: #4726 e2e rule; 1550: #4596 i18n translate rule // 1850: #5333 (git stash rule + stage stamp)
|
|
2673
2673
|
for (const h of ["### What Was Claimed", "### What We Found", "### Root Cause", "### Affected Files", "### Sibling Sweep", "### History", "### Recommendation", "### Related Issues", "### Test plan",
|
|
2674
2674
|
"investigation.md", "contract.json", "PLANNING ONLY", '"requirements"', '"deliverables"', '"preserve"', '"validate"', "verbatim", "defer", "post-deploy"]) assert.ok(plan.includes(h), h);
|
|
@@ -7914,7 +7914,7 @@ describe("#4395 lane profile", () => {
|
|
|
7914
7914
|
assert.match(p, /Read each file's ranges once .* and keep notes; don't re-read it\./);
|
|
7915
7915
|
}
|
|
7916
7916
|
assert.ok(approxTokens(builderImplementPrompt()) <= 1850, `implement prompt is ${approxTokens(builderImplementPrompt())} of 1700 tokens`);
|
|
7917
|
-
assert.ok(approxTokens(builderPlanPrompt(7)) <=
|
|
7917
|
+
assert.ok(approxTokens(builderPlanPrompt(7)) <= 2550, `plan prompt is ${approxTokens(builderPlanPrompt(7))} of 2125 tokens`);
|
|
7918
7918
|
});
|
|
7919
7919
|
|
|
7920
7920
|
it("runCliBackendAsync reports the first stream turn's context as baselineTokens; makeLeanRunner drops it on resume", async () => {
|
package/bin/lean/prompts.mjs
CHANGED
|
@@ -194,7 +194,7 @@ A validate or repro command must not read a $TMPDIR file it did not create: each
|
|
|
194
194
|
Scope is enforced by the engine: it checks the changed files against the deliverables plus typed amendments itself, so do not write a file-allowlist or denylist validate (git diff --name-only | grep); the engine drops such a validate at freeze.
|
|
195
195
|
A new dependency between workspace packages (a workspace package added to a package.json dependencies, devDependencies or peerDependencies) must be a deliverable on that package.json whose change names the package and gives the reason, citing the architecture doc where there is one; "the lint allows it" or "there is a precedent" is not a reason on its own. Record each non-obvious choice in "decisions" with where its justification comes from (doc, lint, precedent or spec); omit the field when none. Then stop. Finish your reply with "Build reads:", the files (with line ranges) and searches the build needs; the build opens by issuing them all in one turn.
|
|
196
196
|
|
|
197
|
-
Blast radius: list neighbours (callers, shared modules, sibling configs) from the code graph; add \`"regression":[{"id":"G1","command":"","covers":""}]\` (engine runs it as validate). A post-deploy row needs a
|
|
197
|
+
Blast radius: list neighbours (callers, shared modules, sibling configs) from the code graph; add \`"regression":[{"id":"G1","command":"","covers":""}]\` (engine runs it as validate). A post-deploy row needs \`local_infeasible_why\` and a \`check\` id from .forge/post-deploy-checks.json on the base, or a deliverable adding it there. Never narrow a requirement that needs another open issue's code: block {"kind":"dependency","issues":[N]}. developing or fixing the signal is never post-deploy.
|
|
198
198
|
|
|
199
199
|
An added route needs its production ingress rule, and a touched topology.prod_parity surface its check or parity entry, cited in ${INVESTIGATION_FILE}. No decision may swap e2e for mocked tests without a forge-probe.
|
|
200
200
|
|
|
@@ -45,7 +45,7 @@ export const POLICY_SCHEMA = obj({
|
|
|
45
45
|
plan: obj({ approval: en("wait", "auto", "auto-if"), skip_labels: list(), require_design_gate: B, max_issues: N, stale_snapshot_s: N }),
|
|
46
46
|
lanes: { t: "map", v: obj({ pipeline: S, ci_tier: S, approval: S, budget: S, base: en("live", "integration", "default"), units_max: N, max_risk: en("low", "medium", "high"), train_max_issues: N, train_max_units: N, soak_min: { t: "any" }, flag_policy: en("require", "warn", "off"), requires: list() }) },
|
|
47
47
|
merge: obj({ approval: en("confirm", "with-plan", "auto"), method: en("merge-commit", "squash", "rebase"), trailers: list() }),
|
|
48
|
-
ci: obj({ provider: en("github-actions", "command"), required_checks: ANY, selection: ANY, rerun_budget_min: N, fix:
|
|
48
|
+
ci: obj({ provider: en("github-actions", "command"), required_checks: ANY, selection: ANY, rerun_budget_min: N, fix: obj({ max_rounds: I, co_start: B, full_run_workflow: S }), flake: obj({ quarantine_after: N, window_days: N }), unskippable: list(), tiers: { t: "map", v: obj({ jobs: list() }) }, nightly: ANY, budget: ANY }),
|
|
49
49
|
preflight: obj({ commands: list(), timeout_s: N, blocking: B }),
|
|
50
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
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") }),
|
|
@@ -47,6 +47,14 @@ describe("validate", () => {
|
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
describe("ci.fix (#5567)", () => {
|
|
51
|
+
it("accepts max_rounds, co_start and full_run_workflow; rejects unknown keys and a non-integer max_rounds", () => {
|
|
52
|
+
assert.deepEqual(check(OK.replace("ci:\n", "ci:\n fix: {max_rounds: 1, co_start: true, full_run_workflow: full.yml}\n")), []);
|
|
53
|
+
assert.match(check(OK.replace("ci:\n", "ci:\n fix: {bogus: 1}\n")).join(), /bogus: unknown key/);
|
|
54
|
+
assert.notDeepEqual(check(OK.replace("ci:\n", "ci:\n fix: {max_rounds: x}\n")), []);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
50
58
|
describe("I23 deferred keys are rejected", () => {
|
|
51
59
|
const cases = {
|
|
52
60
|
"plan.auto_if": "plan: {auto_if: x}\n", "retention_days": "retention_days: 30\n", "ci.forbid_per_issue_steps": "ci: {forbid_per_issue_steps: true}\n",
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
/**
|
|
4
|
+
* One-round CI fix loop of `forgedock release` (#5567, epic #5549 5.2/5.3, I16). Pure functions, no model call, no I/O of their
|
|
5
|
+
* own: the findings collector (every failed CI job, review finding and guard failure on one head, flake-classified), the brief
|
|
6
|
+
* compiler (grouped by the violated property, deterministic), the round counter keyed by head sha, and the second-push policy
|
|
7
|
+
* (a mechanical revert or an infra-flake rerun, once; anything else is HELD with an owner ask). `fixStep` in
|
|
8
|
+
* `release-review.mjs` drives them through its seam.
|
|
9
|
+
*/
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { classifyFailure } from "./release-flakes.mjs";
|
|
12
|
+
|
|
13
|
+
export const ReleaseFixloopDEFAULT_MAX_ROUNDS = 1;
|
|
14
|
+
const LOG_TAIL = 400;
|
|
15
|
+
const uniq = (a) => [...new Set(a)];
|
|
16
|
+
const byText = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
17
|
+
|
|
18
|
+
/** policy `ci.fix` -> {maxRounds, coStart, fullRunWorkflow}; defaults: one round, no co-start, no uncached full run. */
|
|
19
|
+
export function parseFixConfig(fix) {
|
|
20
|
+
const n = Number(fix?.max_rounds ?? fix?.maxRounds); // accepts the policy form and an already parsed one
|
|
21
|
+
const wf = [fix?.full_run_workflow, fix?.fullRunWorkflow].find((x) => typeof x === "string" && x.trim())?.trim() ?? null;
|
|
22
|
+
return { maxRounds: Number.isInteger(n) && n >= 1 ? n : ReleaseFixloopDEFAULT_MAX_ROUNDS, coStart: fix?.co_start === true || fix?.coStart === true || Boolean(wf), fullRunWorkflow: wf };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* One record of everything wrong at `head`. `jobs`: [{name, conclusion, log?, inputHash?}] of the finished CI jobs (only failed ones
|
|
27
|
+
* are kept), `findings`: review findings [{id?, title, severity?, property?, wave?: boolean, blocking?: boolean}], `guards`:
|
|
28
|
+
* [{name, why}]. Sorted so a fixed input gives a fixed record.
|
|
29
|
+
*/
|
|
30
|
+
export function collectFindings({ head, jobs = [], findings = [], guards = [] }) {
|
|
31
|
+
const ci = jobs
|
|
32
|
+
.filter((j) => j.conclusion === "failure")
|
|
33
|
+
.map((j) => ({ name: j.name, ...classifyFailure(j.log), inputHash: j.inputHash ?? null, tail: String(j.log ?? "").slice(-LOG_TAIL) }))
|
|
34
|
+
.sort((a, b) => byText(a.name, b.name));
|
|
35
|
+
const review = findings
|
|
36
|
+
.map((f) => ({ id: f.id ?? null, title: String(f.title ?? f.id ?? "finding"), severity: String(f.severity ?? "").toUpperCase() || null, property: f.property ?? f.invariant ?? f.category ?? null, inWave: f.wave !== false, blocking: f.blocking !== false && /^(CRITICAL|HIGH)$/i.test(String(f.severity ?? "")) }))
|
|
37
|
+
.sort((a, b) => byText(a.title, b.title) || byText(String(a.id), String(b.id)));
|
|
38
|
+
const gs = guards.map((g) => ({ name: g.name, why: String(g.why ?? "") })).sort((a, b) => byText(a.name, b.name));
|
|
39
|
+
return { head, ci, review, guards: gs };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Findings that block this round: blocking, in-wave review findings; every failed CI job; every guard failure. */
|
|
43
|
+
export const blockingOf = (rec) => ({ ci: rec.ci, review: rec.review.filter((f) => f.blocking && f.inWave), guards: rec.guards });
|
|
44
|
+
/** Findings that never block: non-blocking or outside the wave. They become issues for the next plan and are never merged after READY (I16). */
|
|
45
|
+
export const deferredOf = (rec) => rec.review.filter((f) => !(f.blocking && f.inWave));
|
|
46
|
+
/** True when every failed CI job carries a known infra signature and nothing else is wrong. */
|
|
47
|
+
export const onlyInfraFlakes = (rec) => rec.ci.length > 0 && rec.ci.every((j) => j.class === "infra") && !blockingOf(rec).review.length && !rec.guards.length;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The fix brief: findings grouped by the property they violate (a CI job is `ci:<name>`, a guard `guard:<name>`), one
|
|
51
|
+
* sibling-sweep instruction, the CI-equivalent local commands and the checks that will rerun. Deterministic for a fixed input.
|
|
52
|
+
*/
|
|
53
|
+
export function compileBrief(rec, { commands = [], rerunChecks = [] } = {}) {
|
|
54
|
+
const groups = new Map();
|
|
55
|
+
const add = (prop, line) => groups.set(prop, [...(groups.get(prop) ?? []), line]);
|
|
56
|
+
const b = blockingOf(rec);
|
|
57
|
+
for (const f of b.review) add(f.property ?? "unclassified", `${f.severity ?? "finding"}: ${f.title}`);
|
|
58
|
+
for (const j of b.ci) add(`ci:${j.name}`, j.tail ? `failed: ${j.tail.replace(/\s+/g, " ").trim()}` : "failed");
|
|
59
|
+
for (const g of b.guards) add(`guard:${g.name}`, g.why || "failed");
|
|
60
|
+
const out = [`Fix everything below in ONE commit series on the wave branch, at head ${rec.head}. One push; there is no second round.`, ""];
|
|
61
|
+
for (const prop of [...groups.keys()].sort(byText)) {
|
|
62
|
+
out.push(`## Invariant: ${prop}`, ...uniq(groups.get(prop)).sort(byText).map((l) => `- ${l}`), "");
|
|
63
|
+
}
|
|
64
|
+
out.push("## Sibling sweep", "For each invariant above, search the whole change for other places that break the same property and fix those too; do not fix only the instances named.", "");
|
|
65
|
+
const cmds = uniq(commands);
|
|
66
|
+
out.push("## Run locally first (CI-equivalent; all must be green before you push)", ...(cmds.length ? cmds.map((c) => `- \`${c}\``) : ["- (no preflight.commands configured)"]), "");
|
|
67
|
+
const checks = uniq(rerunChecks).sort(byText);
|
|
68
|
+
out.push("## Checks that will rerun", ...(checks.length ? checks.map((c) => `- ${c}`) : ["- (none recorded)"]), "");
|
|
69
|
+
return out.join("\n");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Stable hash of a job's inputs: a rerun is requested only for jobs whose hash differs from the one that last ran. */
|
|
73
|
+
export const inputHash = (...parts) => createHash("sha256").update(parts.map(String).join("\0")).digest("hex").slice(0, 16);
|
|
74
|
+
/** Names of the jobs to rerun after the fix push: `now` and `before` map job name -> input hash; unchanged jobs are not requested. */
|
|
75
|
+
export const jobsToRerun = (now, before = {}) => Object.keys(now).filter((n) => before[n] !== now[n]).sort(byText);
|
|
76
|
+
|
|
77
|
+
/** Fix rounds already spent for `head`: the counter is keyed by head sha and a fix push links the new head to its parent. */
|
|
78
|
+
export const roundsAt = (state, head) => state?.fixloop?.heads?.[head]?.rounds ?? 0;
|
|
79
|
+
/** Link the head a push produced to its parent; `kind` is set for a second push (`revert`|`rerun`), `failedBefore` the failing check names at `from`. */
|
|
80
|
+
export function recordRound(state, { from, to, kind = null, failedBefore = null }) {
|
|
81
|
+
const fl = (state.fixloop ??= { heads: {} });
|
|
82
|
+
fl.heads[to] = { parent: from, rounds: roundsAt(state, from) + 1, ...(kind ? { second: kind } : {}), ...(failedBefore ? { failedBefore } : {}) };
|
|
83
|
+
}
|
|
84
|
+
/** The second push already used on this head's line, if any. */
|
|
85
|
+
export const secondPushOf = (state, head) => state?.fixloop?.heads?.[head]?.second ?? null;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* May the loop push again (the round budget is spent or the first fix did not clear the head)? Only (a) a mechanical revert of the
|
|
89
|
+
* round-1 commit or (b) an infra-flake rerun with no code change, each once; anything else is HELD with an owner ask.
|
|
90
|
+
* `lastPush` is what the previous second push was, if any. No model adjudicates whether the fix caused the failure: a revert is
|
|
91
|
+
* chosen only when a check fails now that was not failing before the fix (a set difference by check name).
|
|
92
|
+
* @returns {{action: "revert"|"rerun"}|{action: "hold", ask: string}}
|
|
93
|
+
*/
|
|
94
|
+
export function secondPush({ rec, failedBefore = null, lastPush = null, maxRounds = ReleaseFixloopDEFAULT_MAX_ROUNDS, rounds }) {
|
|
95
|
+
const ask = (why) => ({ action: "hold", ask: `Owner: ${why} The one-round fix budget (ci.fix.max_rounds=${maxRounds}, ${rounds} used) is spent; decide the next step, then resume the release.` });
|
|
96
|
+
if (lastPush) return ask(`a second push (${lastPush}) was already used on this head.`);
|
|
97
|
+
if (onlyInfraFlakes(rec)) return { action: "rerun" };
|
|
98
|
+
const regressed = failedBefore ? rec.ci.filter((j) => !failedBefore.includes(j.name)) : [];
|
|
99
|
+
if (regressed.length) return { action: "revert" };
|
|
100
|
+
const left = [...rec.ci.map((j) => `ci:${j.name}`), ...blockingOf(rec).review.map((f) => f.title), ...rec.guards.map((g) => `guard:${g.name}`)];
|
|
101
|
+
return ask(`still failing after the fix and not an infra flake or a regression from it: ${left.slice(0, 5).join("; ") || "no failure recorded"}.`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Mark the release HELD through the control path (best effort: the returned blocked result stops the run either way). */
|
|
105
|
+
export async function holdForOwner(ctx, ask) {
|
|
106
|
+
try { await ctx.hold?.(ask); } catch { /* the blocked result below still stops the job */ }
|
|
107
|
+
return { blocked: true, held: true, reason: ask };
|
|
108
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
import { describe, it } from "node:test";
|
|
4
|
+
import assert from "node:assert/strict";
|
|
5
|
+
import { parseFixConfig, collectFindings, blockingOf, deferredOf, compileBrief, inputHash, jobsToRerun, roundsAt, recordRound, secondPush, secondPushOf, holdForOwner } from "./release-fixloop.mjs";
|
|
6
|
+
|
|
7
|
+
const HEAD = "a".repeat(40);
|
|
8
|
+
const input = () => ({
|
|
9
|
+
head: HEAD,
|
|
10
|
+
jobs: [{ name: "unit", conclusion: "failure", log: "AssertionError: x" }, { name: "lint", conclusion: "success" }, { name: "e2e", conclusion: "failure", log: "ECONNRESET" }],
|
|
11
|
+
findings: [{ title: "SQL injection", severity: "HIGH", property: "input-validation" }, { title: "Other path injection", severity: "CRITICAL", property: "input-validation" }, { title: "nit", severity: "LOW" }, { title: "elsewhere", severity: "HIGH", wave: false }],
|
|
12
|
+
guards: [{ name: "devdocs", why: "dossier stale" }],
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe("release-fixloop (#5567)", () => {
|
|
16
|
+
it("collects failed jobs (flake-classified), findings and guards into one record", () => {
|
|
17
|
+
const rec = collectFindings(input());
|
|
18
|
+
assert.deepEqual(rec.ci.map((j) => [j.name, j.class]).map(([n, c]) => [n, c === "infra"]), [["e2e", true], ["unit", false]]);
|
|
19
|
+
assert.equal(rec.guards.length, 1);
|
|
20
|
+
assert.equal(blockingOf(rec).review.length, 2);
|
|
21
|
+
});
|
|
22
|
+
it("non-blocking and out-of-wave findings never block; they are deferred to the next plan", () => {
|
|
23
|
+
const d = deferredOf(collectFindings(input())).map((f) => f.title);
|
|
24
|
+
assert.deepEqual(d.sort(), ["elsewhere", "nit"]);
|
|
25
|
+
});
|
|
26
|
+
it("brief groups by invariant, has the sibling sweep, commands and rerun checks, and is deterministic", () => {
|
|
27
|
+
const a = compileBrief(collectFindings(input()), { commands: ["npm test"], rerunChecks: ["unit", "e2e"] });
|
|
28
|
+
const rev = input(); rev.findings.reverse(); rev.jobs.reverse();
|
|
29
|
+
const b = compileBrief(collectFindings(rev), { commands: ["npm test"], rerunChecks: ["e2e", "unit"] });
|
|
30
|
+
assert.equal(a, b);
|
|
31
|
+
assert.match(a, /## Invariant: input-validation\n- CRITICAL: Other path injection\n- HIGH: SQL injection/);
|
|
32
|
+
assert.match(a, /## Sibling sweep/);
|
|
33
|
+
assert.match(a, /`npm test`/);
|
|
34
|
+
assert.match(a, /## Checks that will rerun\n- e2e\n- unit/);
|
|
35
|
+
assert.ok(!a.includes("LOW"), "non-blocking finding is not in the brief");
|
|
36
|
+
});
|
|
37
|
+
it("max_rounds defaults to 1; the counter is keyed by head sha", () => {
|
|
38
|
+
assert.equal(parseFixConfig(undefined).maxRounds, 1);
|
|
39
|
+
assert.equal(parseFixConfig({ max_rounds: 3 }).maxRounds, 3);
|
|
40
|
+
const st = {};
|
|
41
|
+
assert.equal(roundsAt(st, HEAD), 0);
|
|
42
|
+
recordRound(st, { from: HEAD, to: "b".repeat(40) });
|
|
43
|
+
assert.equal(roundsAt(st, "b".repeat(40)), 1);
|
|
44
|
+
assert.equal(roundsAt(st, HEAD), 0);
|
|
45
|
+
});
|
|
46
|
+
it("second push: infra-only -> rerun once; regression -> revert; anything else -> HELD with an owner ask (no model)", () => {
|
|
47
|
+
const flake = collectFindings({ head: HEAD, jobs: [{ name: "e2e", conclusion: "failure", log: "ECONNRESET" }] });
|
|
48
|
+
assert.deepEqual(secondPush({ rec: flake, rounds: 1 }), { action: "rerun" });
|
|
49
|
+
assert.equal(secondPush({ rec: flake, lastPush: "rerun", rounds: 1 }).action, "hold");
|
|
50
|
+
const real = collectFindings({ head: HEAD, jobs: [{ name: "unit", conclusion: "failure", log: "AssertionError" }] });
|
|
51
|
+
assert.deepEqual(secondPush({ rec: real, failedBefore: ["lint"], rounds: 1 }), { action: "revert" });
|
|
52
|
+
const held = secondPush({ rec: real, failedBefore: ["unit"], rounds: 1 });
|
|
53
|
+
assert.equal(held.action, "hold");
|
|
54
|
+
assert.match(held.ask, /^Owner: /);
|
|
55
|
+
});
|
|
56
|
+
it("secondPushOf reads the recorded second push; reruns are limited to jobs whose input hash changed", () => {
|
|
57
|
+
const st = {}; recordRound(st, { from: HEAD, to: HEAD, kind: "rerun" });
|
|
58
|
+
assert.equal(secondPushOf(st, HEAD), "rerun");
|
|
59
|
+
assert.deepEqual(jobsToRerun({ a: inputHash("1"), b: inputHash("2") }, { a: inputHash("1"), b: inputHash("x") }), ["b"]);
|
|
60
|
+
});
|
|
61
|
+
it("holdForOwner marks HELD through ctx.hold and returns a blocked result", async () => {
|
|
62
|
+
let ask = null;
|
|
63
|
+
const r = await holdForOwner({ hold: async (a) => { ask = a; } }, "Owner: x");
|
|
64
|
+
assert.equal(ask, "Owner: x");
|
|
65
|
+
assert.deepEqual(r, { blocked: true, held: true, reason: "Owner: x" });
|
|
66
|
+
});
|
|
67
|
+
it("unmanaged (no ctx.hold): a hold writes nothing and still stops the job", async () => {
|
|
68
|
+
assert.deepEqual(await holdForOwner({}, "Owner: y"), { blocked: true, held: true, reason: "Owner: y" });
|
|
69
|
+
});
|
|
70
|
+
it("replay of a recorded findings fixture ends in one round or a recorded hold", () => {
|
|
71
|
+
const rec = collectFindings(input());
|
|
72
|
+
const d = secondPush({ rec, failedBefore: ["unit", "e2e"], rounds: 1 });
|
|
73
|
+
assert.equal(d.action, "hold", "same failures as before the fix, mixed with a real failure: neither revert nor rerun");
|
|
74
|
+
assert.match(d.ask, /^Owner: .*ci:unit.*max_rounds=1/);
|
|
75
|
+
const flakeOnly = collectFindings({ head: HEAD, jobs: [{ name: "e2e", conclusion: "failure", log: "ECONNRESET" }] });
|
|
76
|
+
assert.equal(secondPush({ rec: flakeOnly, failedBefore: ["e2e"], rounds: 1 }).action, "rerun");
|
|
77
|
+
const regress = collectFindings({ head: HEAD, jobs: [{ name: "unit", conclusion: "failure", log: "x" }, { name: "e2e", conclusion: "failure", log: "y" }] });
|
|
78
|
+
assert.equal(secondPush({ rec: regress, failedBefore: ["unit"], rounds: 1 }).action, "revert");
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* retries. With no command set every function here is a no-op. No model call. Effects go through `ctx.io`.
|
|
8
8
|
*/
|
|
9
9
|
import { fileBlocker, tail } from "./release-rehearsal.mjs";
|
|
10
|
+
import { fenced } from "./release-fence.mjs";
|
|
10
11
|
|
|
11
12
|
export const PREFLIGHT_TIMEOUT_MS = 20 * 60_000;
|
|
12
13
|
const json = (s) => JSON.parse(String(s || "null"));
|
|
@@ -56,3 +57,24 @@ export async function markReadyStep(ctx) {
|
|
|
56
57
|
if (view?.isDraft) await io.gh(["pr", "ready", String(pr), "--repo", repo]);
|
|
57
58
|
return { ...r, ready: true, wasDraft: !!view?.isDraft };
|
|
58
59
|
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* #5567: CI and the review panel start together on the same head. When `ci.fix` is configured (`co_start` or `full_run_workflow`),
|
|
63
|
+
* the draft release PR is marked ready before the review (the host preflight already passed on this head), and the repo's uncached
|
|
64
|
+
* full run is requested in that same pass through the configured workflow, fenced like any dispatch. Unconfigured: nothing happens.
|
|
65
|
+
* @returns {{skipped: true}|{ready: boolean, fullRun: boolean}|{refused: string}}
|
|
66
|
+
*/
|
|
67
|
+
export async function coStartCi(ctx, { pr }) {
|
|
68
|
+
const fix = ctx.config?.fix;
|
|
69
|
+
if (!fix?.coStart) return { skipped: true };
|
|
70
|
+
const { io, repo } = ctx;
|
|
71
|
+
const view = json(await io.gh(["pr", "view", String(pr), "--repo", repo, "--json", "headRefOid,headRefName,isDraft"]));
|
|
72
|
+
if (view?.isDraft) await io.gh(["pr", "ready", String(pr), "--repo", repo]);
|
|
73
|
+
let fullRun = false;
|
|
74
|
+
if (fix.fullRunWorkflow) {
|
|
75
|
+
const f = await fenced(ctx.fence, { action: "dispatch", key: `fullrun:${pr}:${view?.headRefOid}` }, (epoch) => io.gh(["workflow", "run", fix.fullRunWorkflow, "--repo", repo, "--ref", view?.headRefName, ...(epoch != null ? ["-f", `forge_epoch=${epoch}`] : [])]));
|
|
76
|
+
if (f.refused) return { refused: f.refused };
|
|
77
|
+
fullRun = true;
|
|
78
|
+
}
|
|
79
|
+
return { ready: true, wasDraft: !!view?.isDraft, fullRun };
|
|
80
|
+
}
|
|
@@ -4,7 +4,7 @@ import { describe, it } from "node:test";
|
|
|
4
4
|
import assert from "node:assert/strict";
|
|
5
5
|
import { tmpDir } from "../tests/_tmp.mjs";
|
|
6
6
|
import { runRelease, withStubs, readReleaseConfig, newReleaseId } from "./release.mjs";
|
|
7
|
-
import { parsePreflightConfig, markReadyStep } from "./release-preflight.mjs";
|
|
7
|
+
import { parsePreflightConfig, markReadyStep, coStartCi } from "./release-preflight.mjs";
|
|
8
8
|
import { fixStep } from "./release-review.mjs";
|
|
9
9
|
|
|
10
10
|
const DISK = [{ mount: "/", type: "ext4" }];
|
|
@@ -100,7 +100,7 @@ describe("release host preflight (#5277)", () => {
|
|
|
100
100
|
const mk = (pfOk) => {
|
|
101
101
|
const io = fakeIo({ preflightOk: () => pfOk });
|
|
102
102
|
const seam = {
|
|
103
|
-
headOf: async () => HEAD, runLane: async () => ({ terminalReason: "merged" }),
|
|
103
|
+
headOf: async () => HEAD, runLane: async () => ({ terminalReason: "merged" }), fileFixIssue: async () => 3, failedJobs: async () => [],
|
|
104
104
|
calls: [],
|
|
105
105
|
};
|
|
106
106
|
return { io, seam, ctx: { io: Object.assign(io, { review: seam }), repo: REPO, def: "main", staging: "staging", config: CFG, save() {}, state: { steps: { review: { result: { pr: 9, marker: "FORGE:GATE_FAILURE", verdict: "X", head: "b".repeat(40), blocking: [11], ciFailing: 0 } } } } } };
|
|
@@ -112,3 +112,19 @@ describe("release host preflight (#5277)", () => {
|
|
|
112
112
|
assert.equal(red.io.ran.length, 1);
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
|
+
|
|
116
|
+
describe("co-start CI (#5567)", () => {
|
|
117
|
+
it("unconfigured: zero writes (no gh call at all)", async () => {
|
|
118
|
+
const calls = [];
|
|
119
|
+
const r = await coStartCi({ io: { gh: async (a) => { calls.push(a); return "{}"; } }, repo: REPO, config: {} }, { pr: 9 });
|
|
120
|
+
assert.deepEqual(r, { skipped: true });
|
|
121
|
+
assert.deepEqual(calls, []);
|
|
122
|
+
});
|
|
123
|
+
it("configured: marks the draft ready and requests the full run on the same head", async () => {
|
|
124
|
+
const calls = [];
|
|
125
|
+
const gh = async (a) => { calls.push(a.join(" ")); return a[1] === "view" ? JSON.stringify({ headRefOid: HEAD, headRefName: "release/x", isDraft: true }) : ""; };
|
|
126
|
+
const r = await coStartCi({ io: { gh }, repo: REPO, config: { fix: { coStart: true, fullRunWorkflow: "full.yml" } } }, { pr: 9 });
|
|
127
|
+
assert.deepEqual(r, { ready: true, wasDraft: true, fullRun: true });
|
|
128
|
+
assert.ok(calls.some((c) => c.startsWith("pr ready")) && calls.some((c) => c.startsWith("workflow run full.yml")));
|
|
129
|
+
});
|
|
130
|
+
});
|
|
@@ -39,7 +39,8 @@ function world() {
|
|
|
39
39
|
runAgent: async ({ role }) => { w.agents.push(role); return { text: "FORGE:TEST_GATE:RESULT=PASS" }; },
|
|
40
40
|
finalize: async () => ({ code: 0, lines: [], data: { head: sha(w.head), notes: ["- nit"], toFile: w.fixed ? [] : [{ title: "leak", severity: "HIGH" }] } }),
|
|
41
41
|
fileIssue: async ({ item }) => { w.issues.push(item.title); return 100 + w.issues.length; },
|
|
42
|
-
|
|
42
|
+
failedJobs: async () => [],
|
|
43
|
+
fileFixIssue: async () => 999,
|
|
43
44
|
addNotes: async () => {},
|
|
44
45
|
summary: async ({ filed }) => {
|
|
45
46
|
const pass = w.fixed;
|
|
@@ -59,7 +60,7 @@ describe("forgedock release, review to gate (e2e on in-memory GitHub)", () => {
|
|
|
59
60
|
assert.equal(out.step, "promotion");
|
|
60
61
|
assert.match(out.reason, /GATE_PASS/);
|
|
61
62
|
assert.deepEqual(w.issues, ["leak"], "the finding was filed");
|
|
62
|
-
assert.deepEqual(w.lanes, [[
|
|
63
|
+
assert.deepEqual(w.lanes, [[999, "staging"]], "one fix lane, on the consolidated fix issue, on the staging branch");
|
|
63
64
|
assert.deepEqual(w.comments, ["<!-- FORGE:GATE_FAILURE -->", "<!-- FORGE:GATE_PASS -->"], "failure at the first head, pass after the delta review");
|
|
64
65
|
assert.ok(w.agents.includes("release-review-security") && w.agents.includes("release-review-regression-risk") && w.agents.includes("release-test-gate"), "the full panel ran");
|
|
65
66
|
assert.ok(w.printed.some((l) => l.includes(`--match-head-commit ${sha(2)}`)), "merge command at the fixed head");
|
|
@@ -15,11 +15,12 @@ import { delimiter, join } from "node:path";
|
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
16
|
import { runHostPreflight } from "./release-preflight.mjs";
|
|
17
17
|
import { reviewStagingJson, reviewStagingIo, CI_EXCLUDED_CHECKS } from "../review-staging.mjs";
|
|
18
|
-
import { pickFixes, recut } from "./release-snapshot.mjs";
|
|
18
|
+
import { pickFixes, recut, revertLast } from "./release-snapshot.mjs";
|
|
19
|
+
import { parseFixConfig, collectFindings, blockingOf, compileBrief, roundsAt, recordRound, secondPush, secondPushOf, holdForOwner, jobsToRerun, inputHash, deferredOf } from "./release-fixloop.mjs";
|
|
20
|
+
import { coStartCi } from "./release-preflight.mjs";
|
|
19
21
|
|
|
20
|
-
/** Delta passes after a head move
|
|
22
|
+
/** Delta passes after a head move: past it the job blocks for the manual path. Fix rounds are `ci.fix.max_rounds` (release-fixloop.mjs, default 1, #5567). */
|
|
21
23
|
export const MAX_DELTA_PASSES = 2;
|
|
22
|
-
export const MAX_FIX_ROUNDS = 2;
|
|
23
24
|
const REVIEW_MS = 45 * 60_000, LANE_MS = 3 * 60 * 60_000;
|
|
24
25
|
const ROOT = fileURLToPath(new URL("../..", import.meta.url));
|
|
25
26
|
const SEVERE = new Set(["CRITICAL", "HIGH"]);
|
|
@@ -142,7 +143,9 @@ async function reviewRound({ seam, pr, def, delta }) {
|
|
|
142
143
|
return { fail: `reviewer findings block still missing after one re-ask (${missing.join(", ")}): degraded panel${failureNote(failures)}` };
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
+
// #5567: guard failures of this round (a failed test gate), collected into the fix record next to jobs and findings
|
|
147
|
+
const guards = /FORGE:TEST_GATE:RESULT=FAIL/.test(gate?.text ?? "") ? [{ name: "test-gate", why: "the release test gate reported FAIL" }] : [];
|
|
148
|
+
return { ok: { ...fin.data, guards: [...(fin.data.guards ?? []), ...guards] } };
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
/** The whole review of PR `pr`: rounds until one finalizes at its own head. @returns the step result or `{blocked}`. */
|
|
@@ -165,62 +168,126 @@ async function runReview({ seam, pr, def, delta = null }) {
|
|
|
165
168
|
if ((st.notes ?? []).length) await seam.addNotes(pr, st.notes);
|
|
166
169
|
const sum = await seam.summary({ pr, filed });
|
|
167
170
|
if (!sum.data) return blocked(`the gate summary was not posted (exit ${sum.code}): ${(sum.lines ?? []).slice(-1).join("").slice(0, 200)}`);
|
|
168
|
-
return { pr, head: st.head, verdict: sum.data.verdict, marker: sum.data.marker, ciFailing: sum.data.ciFailing, ciCancelOnly: Boolean(sum.data.ciCancelOnly), ciPendingOnly: Boolean(sum.data.ciPendingOnly), filed, blocking, delta: st.delta?.from ?? null };
|
|
171
|
+
return { pr, head: st.head, verdict: sum.data.verdict, marker: sum.data.marker, ciFailing: sum.data.ciFailing, ciCancelOnly: Boolean(sum.data.ciCancelOnly), ciPendingOnly: Boolean(sum.data.ciPendingOnly), filed, blocking, items: st.toFile ?? [], guards: st.guards ?? [], delta: st.delta?.from ?? null };
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
/** Review step. @returns {{pr, head, verdict, marker, filed, blocking}|{blocked: true, reason: string}} */
|
|
172
175
|
export async function reviewStep(ctx) {
|
|
173
176
|
const pr = ctx.state?.steps?.["release-pr"]?.result?.pr;
|
|
174
177
|
if (!pr) return blocked("no release PR recorded by the release-pr step");
|
|
178
|
+
const started = await coStartCi(ctx, { pr }); // #5567: CI and the panel start on the same head (off unless ci.fix is configured)
|
|
179
|
+
if (started?.refused) return { refused: started.refused };
|
|
175
180
|
return runReview({ seam: seamOf(ctx), pr, def: ctx.def });
|
|
176
181
|
}
|
|
177
182
|
|
|
178
|
-
/**
|
|
183
|
+
/** Re-read the gate summary into the review result (after a rerun or a re-summarise). */
|
|
184
|
+
async function resummarise(ctx, seam, r) {
|
|
185
|
+
const sum = await seam.summary({ pr: r.pr, filed: r.filed ?? [] });
|
|
186
|
+
if (!sum.data) return { err: `the gate summary was not posted (exit ${sum.code}) after rerunning the checks of #${r.pr}` };
|
|
187
|
+
const next = { ...r, verdict: sum.data.verdict, marker: sum.data.marker, ciFailing: sum.data.ciFailing, ciCancelOnly: Boolean(sum.data.ciCancelOnly), ciPendingOnly: Boolean(sum.data.ciPendingOnly) };
|
|
188
|
+
ctx.state.steps.review = { ...ctx.state.steps.review, result: next };
|
|
189
|
+
ctx.save();
|
|
190
|
+
return { r: next };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The round budget (`ci.fix.max_rounds`) is spent and the head is still not GATE_PASS. The only second push is a mechanical revert of
|
|
195
|
+
* the fix commit or an infra-flake rerun, once; anything else is HELD with an owner ask (#5567, no LLM adjudication).
|
|
196
|
+
* @returns {{r}|{blocked}}
|
|
197
|
+
*/
|
|
198
|
+
async function secondRound(ctx, seam, r, cfg) {
|
|
199
|
+
const rec = collectFindings({ head: r.head, jobs: await seam.failedJobs({ pr: r.pr, head: r.head }), findings: r.items ?? [], guards: r.guards ?? [] });
|
|
200
|
+
const rounds = roundsAt(ctx.state, r.head);
|
|
201
|
+
const failedBefore = ctx.state.fixloop?.heads?.[r.head]?.failedBefore ?? null;
|
|
202
|
+
const d = secondPush({ rec, failedBefore, lastPush: secondPushOf(ctx.state, r.head), maxRounds: cfg.maxRounds, rounds });
|
|
203
|
+
if (d.action === "hold") return holdForOwner(ctx, `${d.ask}`);
|
|
204
|
+
if (d.action === "rerun") {
|
|
205
|
+
const out = await ctx.rerunInfra?.({ head: r.head });
|
|
206
|
+
if (!out?.reran?.length) return holdForOwner(ctx, `Owner: only infra flakes remain on #${r.pr} but no rerun was possible (${(out?.skipped ?? []).map((x) => x.why).join("; ") || "no rerun seam"}).`);
|
|
207
|
+
recordRound(ctx.state, { from: r.head, to: r.head, kind: "rerun" });
|
|
208
|
+
ctx.save();
|
|
209
|
+
const s = await resummarise(ctx, seam, r);
|
|
210
|
+
return s.err ? blocked(s.err) : { r: s.r };
|
|
211
|
+
}
|
|
212
|
+
if (ctx.config?.mode !== "snapshot") return holdForOwner(ctx, `Owner: the fix regressed ${rec.ci.map((j) => j.name).join(", ")} on #${r.pr}; a mechanical revert needs release.mode: snapshot.`);
|
|
213
|
+
const rev = await revertLast(ctx);
|
|
214
|
+
if (rev.err) return holdForOwner(ctx, `Owner: the mechanical revert of the fix on #${r.pr} failed: ${rev.err}`);
|
|
215
|
+
const head = await seam.headOf(r.pr);
|
|
216
|
+
recordRound(ctx.state, { from: r.head, to: head, kind: "revert", failedBefore: rec.ci.map((j) => j.name) });
|
|
217
|
+
ctx.save();
|
|
218
|
+
const next = await runReview({ seam, pr: r.pr, def: ctx.def, delta: r.head });
|
|
219
|
+
if (next.blocked) return next;
|
|
220
|
+
ctx.state.steps.review = { ...ctx.state.steps.review, result: next };
|
|
221
|
+
ctx.save();
|
|
222
|
+
return { r: next };
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Fix step: nothing to do on GATE_PASS; else ONE round (`ci.fix.max_rounds`, counted per head sha): collect every failed job, finding
|
|
227
|
+
* and guard on the head, compile one invariant-grouped brief, file one fix issue, run one lane, push once, delta-review the fix commits.
|
|
228
|
+
* A still-failing head after the budget gets only a mechanical revert or an infra-flake rerun, once; else HELD with an owner ask.
|
|
229
|
+
*/
|
|
179
230
|
export async function fixStep(ctx) {
|
|
180
231
|
let r = ctx.state?.steps?.review?.result;
|
|
181
232
|
if (!r?.pr) return blocked("no review result recorded by the review step");
|
|
182
233
|
const seam = seamOf(ctx);
|
|
183
|
-
|
|
184
|
-
|
|
234
|
+
const cfg = parseFixConfig(ctx.config?.fix);
|
|
235
|
+
while (r.marker !== "FORGE:GATE_PASS") {
|
|
185
236
|
// Only cancelled duplicate runs are red (#5502): nothing to fix. The summary reruns them once; re-summarise without spending the round.
|
|
186
237
|
if (!r.blocking?.length && r.ciFailing > 0 && r.ciCancelOnly) {
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
189
|
-
r =
|
|
190
|
-
ctx.state.steps.review = { ...ctx.state.steps.review, result: r };
|
|
191
|
-
ctx.save();
|
|
238
|
+
const s = await resummarise(ctx, seam, r);
|
|
239
|
+
if (s.err) return blocked(s.err);
|
|
240
|
+
r = s.r;
|
|
192
241
|
if (r.marker === "FORGE:GATE_PASS") break;
|
|
193
242
|
if (r.ciCancelOnly) return blocked(`required checks of #${r.pr} still cancelled after a rerun, with no failure to fix`);
|
|
194
|
-
|
|
243
|
+
continue;
|
|
195
244
|
}
|
|
196
245
|
// Required checks that are only still pending (#5519) have not failed: no CI issue or lane, the release re-runs once CI finishes.
|
|
197
246
|
if (!r.blocking?.length && r.ciFailing > 0 && r.ciPendingOnly) return blocked(`required checks of #${r.pr} still pending, with no failure to fix; re-run the release once CI finishes`);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
247
|
+
if (roundsAt(ctx.state, r.head) >= cfg.maxRounds) {
|
|
248
|
+
const s = await secondRound(ctx, seam, r, cfg);
|
|
249
|
+
if (s.blocked) return s;
|
|
250
|
+
r = s.r;
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
const rec = collectFindings({ head: r.head, jobs: r.ciFailing > 0 ? await seam.failedJobs({ pr: r.pr, head: r.head }) : [], findings: r.items ?? [], guards: r.guards ?? [] });
|
|
254
|
+
const b = blockingOf(rec);
|
|
255
|
+
if (!b.ci.length && !b.review.length && !b.guards.length && !r.blocking?.length && !(r.ciFailing > 0)) return blocked(`${r.verdict} with neither a blocking finding nor red CI to fix`);
|
|
256
|
+
const hashesNow = Object.fromEntries(rec.ci.map((j) => [j.name, j.inputHash ?? inputHash(j.name, r.head)]));
|
|
257
|
+
const brief = compileBrief(rec, { commands: ctx.config?.preflight ? [ctx.config.preflight.command] : [], rerunChecks: jobsToRerun(hashesNow, ctx.state.fixloop?.hashes ?? {}) });
|
|
258
|
+
// Non-blocking and out-of-wave findings become next-plan issues, once per head; they are never part of the fix and never merged after READY (I16).
|
|
259
|
+
const fl = (ctx.state.fixloop ??= { heads: {} });
|
|
260
|
+
fl.hashes = hashesNow;
|
|
261
|
+
if (!fl.deferred?.includes(r.head)) {
|
|
262
|
+
const later = deferredOf(rec);
|
|
263
|
+
if (later.length) await seam.fileDeferred?.({ pr: r.pr, head: r.head, items: later });
|
|
264
|
+
fl.deferred = [...(fl.deferred ?? []), r.head];
|
|
265
|
+
ctx.save();
|
|
204
266
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
267
|
+
// One issue carries the whole brief (blocking findings stay filed as their own issues and are referenced); its lane is the one fix lane.
|
|
268
|
+
const issue = await seam.fileFixIssue({ pr: r.pr, head: r.head, brief, blocking: r.blocking ?? [] });
|
|
269
|
+
if (!issue) return blocked(`could not file the fix issue for #${r.pr}`);
|
|
270
|
+
// A resume after the fix already merged (by this job or by an intake lane): its lane would end invalid on a closed issue.
|
|
271
|
+
if (!(await seam.issueMerged?.(issue))) {
|
|
209
272
|
const lane = await seam.runLane({ issue, lane: ctx.staging });
|
|
210
273
|
if (lane?.terminalReason !== "merged") return blocked(`fix lane for #${issue} ended ${lane?.terminalReason ?? "without a result"}`);
|
|
211
274
|
}
|
|
212
275
|
// Snapshot mode (#5276): the fixes are merged on staging; bring exactly those onto release/<id> (or recut it) before the delta review.
|
|
213
276
|
if (ctx.config?.mode === "snapshot") {
|
|
214
|
-
const moved = ctx.config.fixMode === "recut" ? await recut(ctx) : await pickFixes(ctx, { issues });
|
|
277
|
+
const moved = ctx.config.fixMode === "recut" ? await recut(ctx) : await pickFixes(ctx, { issues: [issue, ...(r.blocking ?? [])] });
|
|
215
278
|
if (moved.err) return blocked(moved.err);
|
|
216
279
|
}
|
|
217
280
|
// The host preflight re-runs on the head the fixes produced, before the delta review (the draft PR has no Actions CI yet, #5277).
|
|
281
|
+
const head = await seam.headOf(r.pr);
|
|
218
282
|
if (ctx.config?.preflight) {
|
|
219
|
-
const pf = await runHostPreflight(ctx, { head
|
|
283
|
+
const pf = await runHostPreflight(ctx, { head, pr: r.pr });
|
|
220
284
|
if (!pf.ok && pf.blocking) return blocked(`host preflight failed at ${pf.head} after the fix round (release-blocker #${pf.issue})`);
|
|
221
285
|
}
|
|
286
|
+
recordRound(ctx.state, { from: r.head, to: head, failedBefore: rec.ci.map((j) => j.name) });
|
|
287
|
+
ctx.save();
|
|
222
288
|
const next = await runReview({ seam, pr: r.pr, def: ctx.def, delta: r.head });
|
|
223
289
|
if (next.blocked) return next;
|
|
290
|
+
if (next.head && next.head !== head) { recordRound(ctx.state, { from: r.head, to: next.head, failedBefore: rec.ci.map((j) => j.name) }); ctx.save(); } // the reviewed head is the one the budget is keyed on
|
|
224
291
|
r = next;
|
|
225
292
|
ctx.state.steps.review = { ...ctx.state.steps.review, result: r };
|
|
226
293
|
ctx.save();
|
|
@@ -270,16 +337,32 @@ export function realSeam({ repo, def, env = process.env, cwd = process.cwd(), ma
|
|
|
270
337
|
return v.state === "CLOSED" && (v.labels ?? []).some((l) => l.name === "workflow:merged");
|
|
271
338
|
} catch { return false; }
|
|
272
339
|
},
|
|
273
|
-
|
|
340
|
+
// fail-late (#5567): wait until every CI run on `head` finished, then read the log of each failed one
|
|
341
|
+
failedJobs: async ({ head }) => {
|
|
342
|
+
const list = () => JSON.parse(gh(["run", "list", "-R", repo, "--commit", head, "--json", "databaseId,name,status,conclusion", "--limit", "50"]));
|
|
343
|
+
let runs = list();
|
|
344
|
+
for (let i = 0; i < 60 && runs.some((x) => x.status !== "completed"); i++) { await new Promise((res) => setTimeout(res, 60_000)); runs = list(); }
|
|
345
|
+
return runs.filter((x) => x.status === "completed").map((x) => {
|
|
346
|
+
let log = "";
|
|
347
|
+
if (x.conclusion === "failure") { try { log = gh(["run", "view", String(x.databaseId), "-R", repo, "--log-failed"]).slice(-20_000); } catch { /* no log: unknown class */ } }
|
|
348
|
+
return { name: x.name, conclusion: x.conclusion, log };
|
|
349
|
+
});
|
|
350
|
+
},
|
|
351
|
+
// #5567: findings that do not block (or lie outside the wave) are filed for the next plan, labelled so the release never picks them up
|
|
352
|
+
async fileDeferred({ pr, items }) {
|
|
353
|
+
const out = [];
|
|
354
|
+
for (const f of items) { const n = await this.fileIssue({ item: { title: `Next plan: ${f.title}`, severity: f.severity ?? "LOW", body: `Not blocking release PR #${pr} (non-blocking or outside the wave); deferred to the next plan.` }, pr }); if (n) out.push(n); }
|
|
355
|
+
return out;
|
|
356
|
+
},
|
|
357
|
+
async fileFixIssue({ pr, head, brief, blocking = [] }) {
|
|
274
358
|
// one issue per release head: a resume reuses the issue filed for the same head instead of filing a duplicate
|
|
275
|
-
const title = `Release PR #${pr}:
|
|
359
|
+
const title = `Release PR #${pr}: one-round fix at ${head.slice(0, 7)}`;
|
|
276
360
|
try {
|
|
277
361
|
const hit = JSON.parse(gh(["issue", "list", "-R", repo, "--state", "all", "--search", `"${title}" in:title`, "--json", "number,title"])).find((i) => i.title === title);
|
|
278
362
|
if (hit) return hit.number;
|
|
279
363
|
} catch { /* no lookup: file a new one */ }
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
return this.fileIssue({ item: { title: `Release PR #${pr}: CI red at ${head.slice(0, 7)}`, severity: "HIGH", body: `Failing required checks on the release PR #${pr} at ${head}:\n${names.map((n) => `- ${n}`).join("\n")}\n\nFix them on the staging branch.` }, pr });
|
|
364
|
+
const refs = blocking.length ? `\n\nBlocking findings filed separately: ${blocking.map((n) => `#${n}`).join(", ")}.` : "";
|
|
365
|
+
return this.fileIssue({ item: { title, severity: "HIGH", body: `${brief}${refs}\n\nFix them on the staging branch.` }, pr });
|
|
283
366
|
},
|
|
284
367
|
fileIssue: async ({ item, pr }) => {
|
|
285
368
|
const dir = mkdtempSync(join(tmpdir(), "release-finding-"));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
3
|
import { describe, it } from "node:test";
|
|
4
4
|
import assert from "node:assert/strict";
|
|
5
|
-
import { reviewStep, fixStep, missingReviewers, SPEC_PANEL, MAX_DELTA_PASSES,
|
|
5
|
+
import { reviewStep, fixStep, missingReviewers, SPEC_PANEL, MAX_DELTA_PASSES, realSeam, withIntegrityMarker, TEST_GATE_SKIP_NO_TESTS, testGatePrompt, integrationTestCount, resolveSkillName } from "./release-review.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { reviewStagingJson } from "../review-staging.mjs";
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ const manifest = (head, delta = null) => ({ pr: 7, headSha: head, bundle: [1, 2]
|
|
|
11
11
|
const fin = (extra = {}) => ({ code: 0, data: { head: H1, toFile: [], notes: [], ...extra }, lines: [] });
|
|
12
12
|
|
|
13
13
|
/** Seam fake: `heads` is what headOf answers in turn; `fins` what finalize answers in turn. */
|
|
14
|
-
function fakeSeam({ heads = [H1], fins = [fin()], summary, lanes = [], gatePlan = { clusters: 1, skill: "forgedock:test-gate" } } = {}) {
|
|
14
|
+
function fakeSeam({ heads = [H1], fins = [fin()], summary, lanes = [], jobs = [], gatePlan = { clusters: 1, skill: "forgedock:test-gate" } } = {}) {
|
|
15
15
|
const log = [], agents = [], gateSaved = [], agentCalls = [];
|
|
16
16
|
let h = 0, f = 0, l = 0, n = 100;
|
|
17
17
|
return {
|
|
@@ -26,7 +26,9 @@ function fakeSeam({ heads = [H1], fins = [fin()], summary, lanes = [], gatePlan
|
|
|
26
26
|
testGatePlan: async () => gatePlan,
|
|
27
27
|
runAgent: async (a) => { agentCalls.push(a); agents.push(a.role + (a.prompt.includes("findings block required") ? ":reask" : "")); return { text: "ok" }; },
|
|
28
28
|
fileIssue: async ({ item }) => { log.push(["file", item.title]); return n++; },
|
|
29
|
-
|
|
29
|
+
failedJobs: async () => jobs,
|
|
30
|
+
fileDeferred: async ({ items }) => { log.push(["deferred", items.map((i) => i.title)]); return []; },
|
|
31
|
+
fileFixIssue: async () => { log.push(["fix-issue"]); return n++; },
|
|
30
32
|
issueMerged: async () => false,
|
|
31
33
|
addNotes: async (pr, notes) => log.push(["notes", notes]),
|
|
32
34
|
runLane: async (a) => { log.push(["lane", a.issue, a.lane]); return lanes[l++] ?? { terminalReason: "merged" }; },
|
|
@@ -141,21 +143,23 @@ describe("fixStep", () => {
|
|
|
141
143
|
assert.equal(s.log.length, 0);
|
|
142
144
|
});
|
|
143
145
|
|
|
144
|
-
it("runs
|
|
146
|
+
it("runs ONE lane on the consolidated fix issue on the staging branch, then a delta review from the reviewed head", async () => {
|
|
145
147
|
const s = fakeSeam({ heads: [H2] });
|
|
146
148
|
const c = ctx(s, { review: { result: failed } });
|
|
147
149
|
const r = await fixStep(c);
|
|
148
|
-
assert.deepEqual(s.log[
|
|
149
|
-
assert.deepEqual(s.log[1], ["pre", H1]);
|
|
150
|
+
assert.deepEqual(s.log.slice(0, 3), [["fix-issue"], ["lane", 100, "staging"], ["pre", H1]]);
|
|
150
151
|
assert.equal(r.verdict, "APPROVE FOR DEPLOY");
|
|
152
|
+
assert.equal(c.state.fixloop.heads[H2].rounds, 1, "the round is counted per head sha");
|
|
151
153
|
});
|
|
152
154
|
|
|
153
|
-
it("is bounded:
|
|
155
|
+
it("is bounded: one round (ci.fix.max_rounds default 1), then HELD with an owner ask for a non-flake, non-regression failure", async () => {
|
|
154
156
|
const bad = { code: 0, data: { verdict: "BLOCK DEPLOY", marker: "FORGE:GATE_FAILURE", ciFailing: 0 }, lines: [] };
|
|
155
157
|
const s = fakeSeam({ heads: [H2], summary: bad, fins: [fin({ toFile: [{ title: "x", severity: "CRITICAL" }] })] });
|
|
156
158
|
const r = await fixStep(ctx(s, { review: { result: failed } }));
|
|
157
159
|
assert.equal(r.blocked, true);
|
|
158
|
-
assert.equal(
|
|
160
|
+
assert.equal(r.held, true);
|
|
161
|
+
assert.match(r.reason, /^Owner: .*ci\.fix\.max_rounds=1/);
|
|
162
|
+
assert.equal(s.log.filter((e) => e[0] === "lane").length, 1);
|
|
159
163
|
});
|
|
160
164
|
|
|
161
165
|
it("blocks when a lane does not merge", async () => {
|
|
@@ -166,31 +170,31 @@ describe("fixStep", () => {
|
|
|
166
170
|
it("red CI with no finding files one CI issue and runs a lane on it, then reviews the delta", async () => {
|
|
167
171
|
const s = fakeSeam({ heads: [H2] });
|
|
168
172
|
const r = await fixStep(ctx(s, { review: { result: { ...failed, blocking: [], ciFailing: 2 } } }));
|
|
169
|
-
assert.deepEqual(s.log.slice(0, 3), [["
|
|
173
|
+
assert.deepEqual(s.log.slice(0, 3), [["fix-issue"], ["lane", 100, "staging"], ["pre", H1]]);
|
|
170
174
|
assert.equal(r.blocked, undefined);
|
|
171
175
|
});
|
|
172
176
|
|
|
173
177
|
it("a resume skips fix issues already closed as merged and goes on to the delta review", async () => {
|
|
174
178
|
const s = fakeSeam({ heads: [H2] });
|
|
175
|
-
s.issueMerged = async (n) => n ===
|
|
179
|
+
s.issueMerged = async (n) => n === 100;
|
|
176
180
|
const r = await fixStep(ctx(s, { review: { result: failed } }));
|
|
177
181
|
assert.equal(s.log.filter((e) => e[0] === "lane").length, 0);
|
|
178
|
-
assert.deepEqual(s.log[
|
|
182
|
+
assert.deepEqual(s.log.slice(0, 2), [["fix-issue"], ["pre", H1]]);
|
|
179
183
|
assert.equal(r.blocked, undefined);
|
|
180
184
|
});
|
|
181
185
|
|
|
182
|
-
it("realSeam.
|
|
186
|
+
it("realSeam.fileFixIssue reuses the issue already filed for the same release head", async () => {
|
|
183
187
|
const calls = [];
|
|
184
|
-
const gh = (args) => { calls.push(args); if (args[0] === "issue" && args[1] === "list") return JSON.stringify([{ number: 5396, title: "Release PR #7:
|
|
188
|
+
const gh = (args) => { calls.push(args); if (args[0] === "issue" && args[1] === "list") return JSON.stringify([{ number: 5396, title: "Release PR #7: one-round fix at b48bae6" }]); throw new Error("unexpected"); };
|
|
185
189
|
const seam = realSeam({ repo: "o/r", def: "main", env: {}, cwd: "/tmp", gh });
|
|
186
|
-
assert.equal(await seam.
|
|
190
|
+
assert.equal(await seam.fileFixIssue({ pr: 7, head: "b48bae6628432906aa96f509eddfe6d49608e725", brief: "b" }), 5396);
|
|
187
191
|
assert.equal(calls.length, 1);
|
|
188
192
|
});
|
|
189
193
|
|
|
190
|
-
it("a blocking finding and red CI together get
|
|
194
|
+
it("a blocking finding and red CI together get ONE lane on one consolidated issue", async () => {
|
|
191
195
|
const s = fakeSeam({ heads: [H2] });
|
|
192
196
|
await fixStep(ctx(s, { review: { result: { ...failed, ciFailing: 1 } } }));
|
|
193
|
-
assert.deepEqual(s.log.filter((e) => e[0] === "lane").map((e) => e[1]), [
|
|
197
|
+
assert.deepEqual(s.log.filter((e) => e[0] === "lane").map((e) => e[1]), [100]);
|
|
194
198
|
});
|
|
195
199
|
|
|
196
200
|
it("only cancelled CI: no CI issue, no lane, no round spent; re-summarises and goes on", async () => {
|
|
@@ -204,7 +208,7 @@ describe("fixStep", () => {
|
|
|
204
208
|
const s2 = fakeSeam({ summary: still });
|
|
205
209
|
const r2 = await fixStep(ctx(s2, { review: { result: { ...failed, blocking: [], filed: [], ciFailing: 1, ciCancelOnly: true } } }));
|
|
206
210
|
assert.match(r2.reason, /still cancelled/);
|
|
207
|
-
assert.ok(!s2.log.some((e) => e[0] === "
|
|
211
|
+
assert.ok(!s2.log.some((e) => e[0] === "fix-issue" || e[0] === "lane"));
|
|
208
212
|
});
|
|
209
213
|
|
|
210
214
|
it("only pending CI (#5519): blocks without a CI issue or lane; a real failure alongside still files", async () => {
|
|
@@ -214,7 +218,7 @@ describe("fixStep", () => {
|
|
|
214
218
|
assert.deepEqual(s.log, []);
|
|
215
219
|
const s2 = fakeSeam();
|
|
216
220
|
await fixStep(ctx(s2, { review: { result: { ...failed, blocking: [], filed: [], ciFailing: 2, ciPendingOnly: false } } }));
|
|
217
|
-
assert.ok(s2.log.some((e) => e[0] === "
|
|
221
|
+
assert.ok(s2.log.some((e) => e[0] === "fix-issue"));
|
|
218
222
|
});
|
|
219
223
|
|
|
220
224
|
it("blocks when the verdict is not a pass but there is nothing to fix", async () => {
|
|
@@ -240,6 +244,89 @@ describe("reviewStagingJson (library entry)", () => {
|
|
|
240
244
|
});
|
|
241
245
|
});
|
|
242
246
|
|
|
247
|
+
describe("fixStep one-round loop (#5567)", () => {
|
|
248
|
+
const failed = { pr: 7, head: H1, verdict: "BLOCK DEPLOY", marker: "FORGE:GATE_FAILURE", blocking: [], filed: [], ciFailing: 1, items: [] };
|
|
249
|
+
const bad = { code: 0, data: { verdict: "BLOCK DEPLOY", marker: "FORGE:GATE_FAILURE", ciFailing: 1 }, lines: [] };
|
|
250
|
+
it("the brief the lane gets is one compiled record of every failed job (fail-late)", async () => {
|
|
251
|
+
const s = fakeSeam({ heads: [H2], jobs: [{ name: "unit", conclusion: "failure", log: "AssertionError" }, { name: "lint", conclusion: "success" }] });
|
|
252
|
+
let brief = null;
|
|
253
|
+
s.fileFixIssue = async (a) => { brief = a.brief; return 100; };
|
|
254
|
+
await fixStep(ctx(s, { review: { result: failed } }));
|
|
255
|
+
assert.match(brief, /## Invariant: ci:unit/);
|
|
256
|
+
assert.match(brief, /## Sibling sweep/);
|
|
257
|
+
assert.ok(!brief.includes("lint"), "a passing job is not in the brief");
|
|
258
|
+
});
|
|
259
|
+
it("ci.fix.max_rounds raises the round budget", async () => {
|
|
260
|
+
const s = fakeSeam({ heads: [H2], summary: bad, jobs: [{ name: "unit", conclusion: "failure", log: "AssertionError" }] });
|
|
261
|
+
const c = ctx(s, { review: { result: failed } });
|
|
262
|
+
c.config = { fix: { maxRounds: 2 } };
|
|
263
|
+
await fixStep(c);
|
|
264
|
+
assert.equal(s.log.filter((e) => e[0] === "lane").length, 2);
|
|
265
|
+
});
|
|
266
|
+
it("a remaining infra flake gets one rerun, no code change, then GATE_PASS", async () => {
|
|
267
|
+
const s = fakeSeam({ heads: [H2], summary: bad, jobs: [{ name: "unit", conclusion: "failure", log: "ECONNRESET" }] });
|
|
268
|
+
const c = ctx(s, { review: { result: failed } });
|
|
269
|
+
let reran = 0;
|
|
270
|
+
c.rerunInfra = async () => { reran++; s.summary = async () => ({ code: 0, data: { verdict: "APPROVE FOR DEPLOY", marker: "FORGE:GATE_PASS", ciFailing: 0 }, lines: [] }); return { reran: ["unit"], skipped: [] }; };
|
|
271
|
+
const r = await fixStep(c);
|
|
272
|
+
assert.equal(r.verdict, "APPROVE FOR DEPLOY");
|
|
273
|
+
assert.equal(reran, 1);
|
|
274
|
+
assert.equal(s.log.filter((e) => e[0] === "lane").length, 1, "the rerun is not a fix lane");
|
|
275
|
+
});
|
|
276
|
+
it("an infra flake that still fails after its one rerun is HELD, never rerun again", async () => {
|
|
277
|
+
const s = fakeSeam({ heads: [H2], summary: bad, jobs: [{ name: "unit", conclusion: "failure", log: "ECONNRESET" }] });
|
|
278
|
+
const c = ctx(s, { review: { result: failed } });
|
|
279
|
+
let reran = 0, held = null;
|
|
280
|
+
c.rerunInfra = async () => { reran++; return { reran: ["unit"], skipped: [] }; };
|
|
281
|
+
c.hold = async (ask) => { held = ask; };
|
|
282
|
+
const r = await fixStep(c);
|
|
283
|
+
assert.equal(reran, 1);
|
|
284
|
+
assert.equal(r.held, true);
|
|
285
|
+
assert.match(held, /already used/);
|
|
286
|
+
});
|
|
287
|
+
it("a fix that regressed a check is reverted mechanically once (snapshot mode), then HELD if still red", async () => {
|
|
288
|
+
const SNAP = "1".repeat(40), PK = "4".repeat(40), RV = "5".repeat(40);
|
|
289
|
+
const git = [];
|
|
290
|
+
const s = fakeSeam({ heads: [H2, H2], summary: bad });
|
|
291
|
+
let call = 0;
|
|
292
|
+
s.failedJobs = async () => (call++ === 0 ? [{ name: "unit", conclusion: "failure", log: "x" }] : [{ name: "unit", conclusion: "failure", log: "x" }, { name: "e2e", conclusion: "failure", log: "y" }]);
|
|
293
|
+
const c = ctx(s, { review: { result: failed } });
|
|
294
|
+
c.config = { mode: "snapshot" };
|
|
295
|
+
c.git = (a) => { git.push(a); if (a[0] === "commit-tree") return `${RV}\n`; return `${"6".repeat(40)}\n`; };
|
|
296
|
+
c.io = { ...c.io, git: c.git, gh: async (a) => (a[1] === "list" ? "[]" : JSON.stringify({ body: "" })) };
|
|
297
|
+
c.state.release = { branch: "release/x", snapshot: SNAP, range: {}, picks: [{ sha: PK, orig: "3".repeat(40), kind: "fix" }] };
|
|
298
|
+
c.hold = async () => {};
|
|
299
|
+
const r = await fixStep(c);
|
|
300
|
+
assert.ok(git.some((a) => a[0] === "push" && a.includes(`${RV}:refs/heads/release/x`)), "the revert is pushed");
|
|
301
|
+
assert.deepEqual(c.state.release.picks.at(-1), { sha: RV, orig: PK, kind: "revert" });
|
|
302
|
+
assert.equal(r.held, true);
|
|
303
|
+
assert.equal(s.log.filter((e) => e[0] === "lane").length, 1, "the revert is not a lane");
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
describe("fixStep deferred findings and guards (#5567)", () => {
|
|
308
|
+
const failed = { pr: 7, head: H1, verdict: "BLOCK DEPLOY", marker: "FORGE:GATE_FAILURE", blocking: [], filed: [], ciFailing: 1, items: [{ title: "nit", severity: "LOW" }, { title: "far", severity: "HIGH", wave: false }, { title: "real", severity: "HIGH" }], guards: [{ name: "test-gate", why: "FAIL" }] };
|
|
309
|
+
it("non-blocking and out-of-wave findings are filed for the next plan, not into the fix brief; guard failures are in the brief", async () => {
|
|
310
|
+
const s = fakeSeam({ heads: [H2], jobs: [{ name: "unit", conclusion: "failure", log: "x" }] });
|
|
311
|
+
let brief = "";
|
|
312
|
+
s.fileFixIssue = async (a) => { brief = a.brief; return 100; };
|
|
313
|
+
await fixStep(ctx(s, { review: { result: failed } }));
|
|
314
|
+
assert.deepEqual(s.log.find((e) => e[0] === "deferred")[1].sort(), ["far", "nit"]);
|
|
315
|
+
assert.match(brief, /guard:test-gate/);
|
|
316
|
+
assert.match(brief, /real/);
|
|
317
|
+
assert.ok(!/far|nit\b/.test(brief.split("## Sibling")[0].replace(/ci:unit/g, "")), "deferred findings stay out of the brief");
|
|
318
|
+
});
|
|
319
|
+
it("the checks that will rerun are those whose input hash differs from the last run", async () => {
|
|
320
|
+
const s = fakeSeam({ heads: [H2], jobs: [{ name: "unit", conclusion: "failure", log: "x", inputHash: "h1" }, { name: "e2e", conclusion: "failure", log: "y", inputHash: "h2" }] });
|
|
321
|
+
let brief = "";
|
|
322
|
+
s.fileFixIssue = async (a) => { brief = a.brief; return 100; };
|
|
323
|
+
const c = ctx(s, { review: { result: failed } });
|
|
324
|
+
c.state.fixloop = { heads: {}, hashes: { unit: "h1", e2e: "old" } };
|
|
325
|
+
await fixStep(c);
|
|
326
|
+
assert.match(brief, /## Checks that will rerun\n- e2e\n\n?$/);
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
|
|
243
330
|
describe("fixStep in snapshot mode (#5276)", () => {
|
|
244
331
|
const failed = { pr: 7, head: H1, verdict: "BLOCK DEPLOY", marker: "FORGE:GATE_FAILURE", blocking: [101], filed: [101], ciFailing: 0 };
|
|
245
332
|
const SNAP = "1".repeat(40), TIP = "2".repeat(40), ORIG = "3".repeat(40), PICK = "4".repeat(40);
|
|
@@ -281,10 +368,10 @@ describe("fixStep in snapshot mode (#5276)", () => {
|
|
|
281
368
|
const c = snapCtx(s, w);
|
|
282
369
|
const r = await fixStep(c);
|
|
283
370
|
assert.equal(r.blocked, undefined);
|
|
284
|
-
assert.deepEqual(c.state.release.picks, [{ sha: PICK, orig: ORIG, pr: 55 }]);
|
|
371
|
+
assert.deepEqual(c.state.release.picks, [{ sha: PICK, orig: ORIG, pr: 55, kind: "fix" }]);
|
|
285
372
|
assert.ok(w.git.some((a) => a[0] === "push" && a.includes(`${PICK}:refs/heads/release/x`)));
|
|
286
373
|
assert.ok(w.gh.some((a) => a[1] === "edit" && a[a.indexOf("--body") + 1].includes("FORGE:RELEASE")), "the record is written to the PR");
|
|
287
|
-
assert.deepEqual(s.log.slice(0,
|
|
374
|
+
assert.deepEqual(s.log.slice(0, 3), [["fix-issue"], ["lane", 100, "staging"], ["pre", H1]]);
|
|
288
375
|
});
|
|
289
376
|
|
|
290
377
|
it("a conflicting cherry-pick blocks the job instead of reviewing a head that lacks the fix", async () => {
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* (`(args, {env, input}) => stdout`, throws on failure) and `io.gh`, so the module is testable with a real temp repo.
|
|
10
10
|
*/
|
|
11
11
|
const REMOTE = "origin";
|
|
12
|
+
/** Head movement after the cut (#5567): the fix push, a recorded `main-sync` cherry-pick of a staging commit, or a mechanical `revert`. */
|
|
13
|
+
export const PICK_KINDS = ["fix", "main-sync", "revert"];
|
|
12
14
|
import { BLOCKER_LABEL } from "./release-rehearsal.mjs";
|
|
13
15
|
export const DEFAULT_PATTERN = "release/{date}-{n}";
|
|
14
16
|
const MARKER = "FORGE:RELEASE";
|
|
@@ -116,7 +118,7 @@ export async function pickFixes(ctx, { issues = [] } = {}) {
|
|
|
116
118
|
const [an, ae, ad] = git(["log", "-1", "--format=%an%n%ae%n%aI", orig]).trim().split("\n");
|
|
117
119
|
const msg = `${git(["log", "-1", "--format=%B", orig]).trimEnd()}\n\n(cherry picked from commit ${orig})\n`;
|
|
118
120
|
const sha = git(["commit-tree", tree, "-p", head, "-F", "-"], { input: msg, env: { GIT_AUTHOR_NAME: an, GIT_AUTHOR_EMAIL: ae, GIT_AUTHOR_DATE: ad, ...committer(git) } }).trim();
|
|
119
|
-
rec.picks.push({ sha, orig, pr: p.number });
|
|
121
|
+
rec.picks.push({ sha, orig, pr: p.number, kind: "fix" });
|
|
120
122
|
picked.push(p.number);
|
|
121
123
|
head = sha;
|
|
122
124
|
}
|
|
@@ -127,6 +129,27 @@ export async function pickFixes(ctx, { issues = [] } = {}) {
|
|
|
127
129
|
return { picked };
|
|
128
130
|
}
|
|
129
131
|
|
|
132
|
+
/**
|
|
133
|
+
* #5567: the mechanical revert of the newest pick (the round-1 fix commit): a commit whose tree is the tree before that pick, recorded
|
|
134
|
+
* as a `revert` pick naming the reverted commit. No new code; `checkChain` verifies the tree. @returns {{reverted: string}|{err: string}}
|
|
135
|
+
*/
|
|
136
|
+
export async function revertLast(ctx) {
|
|
137
|
+
const { git, state } = ctx;
|
|
138
|
+
const rec = state.release;
|
|
139
|
+
if (!rec?.picks?.length) return { err: "no recorded pick to revert" };
|
|
140
|
+
const last = rec.picks.at(-1);
|
|
141
|
+
if (last.kind === "revert") return { err: "the newest pick is already a revert" };
|
|
142
|
+
const parent = git(["rev-parse", `${last.sha}^`]).trim();
|
|
143
|
+
const tree = git(["rev-parse", `${parent}^{tree}`]).trim();
|
|
144
|
+
const msg = `Revert "${git(["log", "-1", "--format=%s", last.sha]).trim()}"\n\n(reverts commit ${last.sha})\n`;
|
|
145
|
+
const sha = git(["commit-tree", tree, "-p", last.sha, "-F", "-"], { input: msg, env: committer(git) }).trim();
|
|
146
|
+
rec.picks.push({ sha, orig: last.sha, kind: "revert" });
|
|
147
|
+
ctx.save();
|
|
148
|
+
git(["push", "--quiet", REMOTE, `${sha}:refs/heads/${rec.branch}`]);
|
|
149
|
+
await writeRecord(ctx);
|
|
150
|
+
return { reverted: last.sha };
|
|
151
|
+
}
|
|
152
|
+
|
|
130
153
|
/** `fix_mode: recut`: move the (unmerged) release branch to the current staging tip and start the record's picks over. */
|
|
131
154
|
export async function recut(ctx) {
|
|
132
155
|
const { git, staging, state } = ctx;
|
|
@@ -163,6 +186,14 @@ export function checkChain({ git, record, sha, staging, exact = false }) {
|
|
|
163
186
|
const pick = record.picks[i];
|
|
164
187
|
if (c !== pick.sha) return no(`commit ${c.slice(0, 12)} is not the recorded pick ${pick.sha.slice(0, 12)}`);
|
|
165
188
|
if (parents.length !== 1 || parents[0] !== prev) return no(`commit ${c.slice(0, 12)} is not a linear child of ${prev.slice(0, 12)}`);
|
|
189
|
+
if (pick.kind && !PICK_KINDS.includes(pick.kind)) return no(`commit ${c.slice(0, 12)} has the unrecorded pick kind ${JSON.stringify(pick.kind)}`);
|
|
190
|
+
if (pick.kind === "revert") { // #5567: a mechanical revert of the previous pick: same tree as before it, and it names it
|
|
191
|
+
if (pick.orig !== prev) return no(`revert ${c.slice(0, 12)} does not revert the previous pick`);
|
|
192
|
+
if (!git(["log", "-1", "--format=%B", c]).includes(`(reverts commit ${pick.orig})`)) return no(`revert ${c.slice(0, 12)} does not name ${pick.orig.slice(0, 12)}`);
|
|
193
|
+
if (git(["rev-parse", `${c}^{tree}`]).trim() !== git(["rev-parse", `${pick.orig}~1^{tree}`]).trim()) return no(`revert ${c.slice(0, 12)} is not the mechanical revert of ${pick.orig.slice(0, 12)}`);
|
|
194
|
+
prev = c;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
166
197
|
if (!isAncestor(git, pick.orig, stagingTip)) return no(`${pick.orig} is not a ${staging} commit`);
|
|
167
198
|
if (!git(["log", "-1", "--format=%B", c]).includes(`(cherry picked from commit ${pick.orig})`)) return no(`commit ${c.slice(0, 12)} does not name ${pick.orig} as its cherry-pick source`);
|
|
168
199
|
if (git(["rev-parse", `${c}^{tree}`]).trim() !== pickTree(git, prev, pick.orig)) return no(`commit ${c.slice(0, 12)} differs from the cherry-pick of ${pick.orig.slice(0, 12)}`);
|
|
@@ -6,7 +6,7 @@ import { execFileSync } from "node:child_process";
|
|
|
6
6
|
import { writeFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { tmpDir } from "../tests/_tmp.mjs";
|
|
9
|
-
import { cutSnapshot, pickFixes, recut, checkChain, verifyRelease, cleanupSnapshot, parseRecord, withRecord, branchName, patternPrefix } from "./release-snapshot.mjs";
|
|
9
|
+
import { cutSnapshot, pickFixes, revertLast, recut, checkChain, verifyRelease, cleanupSnapshot, parseRecord, withRecord, branchName, patternPrefix } from "./release-snapshot.mjs";
|
|
10
10
|
|
|
11
11
|
const ENV = { GIT_AUTHOR_NAME: "t", GIT_AUTHOR_EMAIL: "t@t", GIT_COMMITTER_NAME: "t", GIT_COMMITTER_EMAIL: "t@t", GIT_CONFIG_GLOBAL: "/dev/null", GIT_CONFIG_NOSYSTEM: "1" };
|
|
12
12
|
const mk = (cwd) => (args, { env, input } = {}) => execFileSync("git", args, { cwd, encoding: "utf8", input, env: { ...process.env, ...ENV, ...env }, stdio: ["pipe", "pipe", "pipe"] });
|
|
@@ -109,6 +109,23 @@ describe("cherry-picks and the verifier (#5276)", () => {
|
|
|
109
109
|
assert.deepEqual(checkChain({ git: s.git, record: s.ctx.state.release, sha: pick.sha, staging: "staging", exact: true }), { ok: true, picks: 1 });
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
+
it("#5567: a recorded mechanical revert verifies; an unrecorded pick kind fails; staging advancing leaves the head alone", async () => {
|
|
113
|
+
const { s, c } = await blockerWorld();
|
|
114
|
+
await pickFixes(s.ctx);
|
|
115
|
+
const rec = s.ctx.state.release;
|
|
116
|
+
const head0 = s.git(["ls-remote", "origin", `refs/heads/${c.branch}`]).split("\t")[0];
|
|
117
|
+
s.commit("later.txt", "l\n", "feat: later");
|
|
118
|
+
assert.equal(s.git(["ls-remote", "origin", `refs/heads/${c.branch}`]).split("\t")[0], head0, "a staging merge does not move the release head");
|
|
119
|
+
const rv = await revertLast(s.ctx);
|
|
120
|
+
assert.equal(rv.reverted, rec.picks[0].sha);
|
|
121
|
+
assert.equal(rec.picks.at(-1).kind, "revert");
|
|
122
|
+
assert.equal(checkChain({ git: s.git, record: rec, sha: rec.picks.at(-1).sha, staging: "staging", exact: true }).ok, true);
|
|
123
|
+
const bad = { ...rec, picks: [{ ...rec.picks[0], kind: "sneaky" }] };
|
|
124
|
+
assert.match(checkChain({ git: s.git, record: bad, sha: rec.picks[0].sha, staging: "staging", exact: true }).why, /unrecorded pick kind/);
|
|
125
|
+
const unrec = { ...rec, picks: [rec.picks[0]] };
|
|
126
|
+
assert.equal(checkChain({ git: s.git, record: unrec, sha: rec.picks.at(-1).sha, staging: "staging", exact: true }).ok, false, "an unrecorded pick fails");
|
|
127
|
+
});
|
|
128
|
+
|
|
112
129
|
it("picks a fix that closes a named issue even without the label", async () => {
|
|
113
130
|
const { s } = await blockerWorld();
|
|
114
131
|
s.w.prs = s.w.prs.map((p) => ({ ...p, labels: [], closingIssuesReferences: [{ number: 31 }] }));
|
package/bin/lean/release.mjs
CHANGED
|
@@ -27,10 +27,11 @@ import { parseBudgetConfig, applyOnExceed, waveReport, trailingMedian, historyFr
|
|
|
27
27
|
import { cutSnapshot, writeRecord, checkChain, verifyRelease, DEFAULT_PATTERN } from "./release-snapshot.mjs";
|
|
28
28
|
import { createReleaseLedger, writeRelease, readLedger, acquireLease, heartbeat } from "./release-ledger.mjs";
|
|
29
29
|
import { fenced, epochTrailer } from "./release-fence.mjs";
|
|
30
|
-
import { holdCheck, exemptionsSection, VERBS as CONTROL_VERBS } from "./release-control.mjs";
|
|
30
|
+
import { holdCheck, exemptionsSection, runControl, VERBS as CONTROL_VERBS } from "./release-control.mjs";
|
|
31
31
|
import { parseFlakeConfig, classifyFailure, planRerun, flakeEntry, recordFlakes, readFlakes } from "./release-flakes.mjs";
|
|
32
32
|
import { readActive } from "./release-ledger.mjs";
|
|
33
33
|
import { statusFromCli, policyFromYaml } from "./release-status.mjs";
|
|
34
|
+
import { parseFixConfig } from "./release-fixloop.mjs";
|
|
34
35
|
import { hostPreflightStep, markReadyStep, parsePreflightConfig } from "./release-preflight.mjs";
|
|
35
36
|
|
|
36
37
|
export const RELEASE_STEPS = ["preflight", "host-preflight", "release-pr", "review", "fixes", "mark-ready", "rehearsal", "promotion", "post-merge", "deploy"];
|
|
@@ -355,6 +356,10 @@ export async function runRelease({ io, repo, opts = {}, config = {}, branches =
|
|
|
355
356
|
return null;
|
|
356
357
|
};
|
|
357
358
|
const ctx = { io, repo, opts: state.opts, config, state, staging: branches.staging || DEFAULT_STAGING_BRANCH, def: branches.default || "main", git: io.git, save: () => rel.save(state) };
|
|
359
|
+
if (lctx) { // #5567: the fix loop's HELD goes through the control path; an infra-flake rerun through the fenced rerun
|
|
360
|
+
ctx.hold = (ask) => runControl("hold", [id, "--reason", ask], { io, repo, policy: null, actor: holder, host: holder });
|
|
361
|
+
ctx.rerunInfra = ({ head }) => rerunInfraFlakes({ io, repo, head, fence: ctx.fence, policy: config.policy });
|
|
362
|
+
}
|
|
358
363
|
ctx.save();
|
|
359
364
|
let out;
|
|
360
365
|
try {
|
|
@@ -500,6 +505,7 @@ export async function releaseFromCli(argv, deps = {}) {
|
|
|
500
505
|
const { readPolicy } = await import("./release-config.mjs");
|
|
501
506
|
const pol = readPolicy({ io, defaultBranch: readBranches(cwd).default || "main", cwd }).policy;
|
|
502
507
|
if (pol?.deploy) config.deploy = pol.deploy;
|
|
508
|
+
config.policy = pol; config.fix = parseFixConfig(pol?.ci?.fix); // #5567: ci.fix.max_rounds / co_start / full_run_workflow
|
|
503
509
|
config.deployPipeline = pol?.lanes?.[flag(argv, "--lane")]?.pipeline ?? "full"; // service/hotfix lanes dispatch with unit inputs
|
|
504
510
|
if (pol?.verify) { // #5562: verification layers; risk class picks the soak minutes
|
|
505
511
|
config.verify = pol.verify;
|