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
-18
View File
@@ -3,8 +3,6 @@
// False, the default, leaves every repository's branch protection as people set it at the forge.
import { readFileSync } from "node:fs";
export const LEFT_AS_SET = "[gitea] main's rules are left as set at the forge (keep-main-rules is false)";
/** The setting from the settings-merged config file the mesh delivers; absent, unreadable or not true is false. */
export function keepMainRules(env: NodeJS.ProcessEnv = process.env): boolean {
const file = env.MESH_GITEA_CONFIG_FILE;
@@ -14,19 +12,3 @@ export function keepMainRules(env: NodeJS.ProcessEnv = process.env): boolean {
return v === true || v === "true";
} catch { return false; }
}
/** The 10-minute step: puts the rules right only when kept; else says once that they are left and writes nothing. */
export function mainRulesStep(keep: boolean, put: () => Promise<string[]>, say: (line: string) => void): () => Promise<void> {
let said = false;
let touched = -1;
return async () => {
if (!keep) {
if (!said) say(LEFT_AS_SET);
said = true;
return;
}
const repos = await put();
if (repos.length !== touched) say(`[gitea] main's rule is right in ${repos.length} repositories`);
touched = repos.length;
};
}