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