FORGE-6: the forge module's merge-check machinery and its polls go

announceHead with its mesh/merge-gate pending, the weighing of trunk and
sibling moves (passPulls, trunksMoved, siblingMoves, GateWriter) and their
files on disk, the pass's pull-passing half with its 60 s retry, and the
10-minute keep-main-rules step go. A pull request's new head is said as
pull.updated from the forge's event alone; the seat's status writes
through the client; pollRepos, pollMerged and readAllAtStart stay.

Builds: design 47 H §764 (the forge module: the merge-check machinery, its poll and timer), §762; H-A-28, H-A-100

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
2026-11-20 03:54:09 +01:00
parent f85f639afe
commit 815be6bdce
19 changed files with 92 additions and 1634 deletions
+1 -20
View File
@@ -6,7 +6,7 @@ import { mkdtempSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { keepMainRules, mainRulesStep, LEFT_AS_SET } from "../dist/mainrules.js";
import { keepMainRules } from "../dist/mainrules.js";
function env(body?: string): NodeJS.ProcessEnv {
if (body === undefined) return {};
@@ -23,25 +23,6 @@ test("the setting is false unless the config says true", () => {
assert.equal(keepMainRules(env('{"keep-main-rules":true}')), true);
});
test("false: the step never writes and says once that the rules are left", async () => {
let writes = 0;
const said: string[] = [];
const step = mainRulesStep(false, async () => { writes++; return ["a"]; }, (l) => said.push(l));
await step(); await step(); await step();
assert.equal(writes, 0);
assert.deepEqual(said, [LEFT_AS_SET]);
assert.match(LEFT_AS_SET, /main's rules are left as set at the forge \(keep-main-rules is false\)/);
});
test("true: every step puts the rules right", async () => {
let writes = 0;
const said: string[] = [];
const step = mainRulesStep(true, async () => { writes++; return ["a", "b"]; }, (l) => said.push(l));
await step(); await step();
assert.equal(writes, 2);
assert.deepEqual(said, ["[gitea] main's rule is right in 2 repositories"]);
});
test("a token mint's account setup writes no protection while keep-main-rules is false, and does when true", async () => {
const { setUpToolsAccount } = await import("../dist/tools-account.js");
for (const [keep, want] of [[false, 0], [true, 1]] as const) {