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
+4 -11
View File
@@ -40,18 +40,11 @@ export const TAGS_PAGE = 50;
* is the manifest's container's; no variable names it (a MESH_* word nothing sets is refused, checks/environment). */
export const FORGE_CONTAINER = "gitea";
/** The writer every status of a head takes its turn on (gate.ts): the seat's status lands after every write of the head
* already asked for, so a recheck's pending never lands over a later verdict (novox/hq issue 456). */
export interface HeadStatuses {
status(owner: string, repo: string, sha: string, status: CommitStatus): Promise<void>;
}
/** What the holder reaches beside the forge's API: git in the forge's container (the note), the head's one writer of its
* statuses, and whether the first registrations are written. */
/** What the holder reaches beside the forge's API: git in the forge's container (the note), and whether the first
* registrations are written. */
export interface SeatDeps {
run: Runner;
container: string;
statuses: HeadStatuses;
/** Whether the first registrations were written (registrations.ts): until then merge-pull refuses every merge (design 47 §95). */
registered: () => boolean;
/** The failed `required` step that refuses a head, judged from the module's own state `failed-steps` (failedsteps.ts), or null. */
@@ -229,14 +222,14 @@ export function seatTools(gitea: GiteaClient, deps: SeatDeps): ToolDefinition[]
const combined = await gitea.combinedStatus(owner, repo, commit);
return { commit, combined: combined.state, statuses: newestByContext(combined.statuses).map(statusOf) };
}),
verb(GIT_VERBS.status, "The seat git's status: an act of the forge bridge, a commit status set in its turn after every write of the head already asked for; the same id said again sets it again to the same.",
verb(GIT_VERBS.status, "The seat git's status: an act of the forge bridge, a commit status set on a commit; the same id said again sets it again to the same.",
async (args): Promise<StatusAnswer> => {
const id = idOf(args.id);
const { owner, repo } = repositoryOf(args.repository);
const commit = commitOf("commit", args.commit);
const state = String(args.state ?? "");
if (!STATES.has(state)) throw new Refused(`state ${JSON.stringify(state)} is none of ${[...STATES].join(", ")}`);
await deps.statuses.status(owner, repo, commit, { state: state as CommitStatus["state"], context: String(args.context ?? ""),
await gitea.setCommitStatus(owner, repo, commit, { state: state as CommitStatus["state"], context: String(args.context ?? ""),
description: String(args.description ?? ""), ...(args.target ? { target_url: String(args.target) } : {}) });
return { id, performed: true };
}),