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
43 lines
2.2 KiB
TypeScript
43 lines
2.2 KiB
TypeScript
// **A pull request's new head is said as the seat git's pull.updated** (novox/hq design 47 H §764; H-A-100): from the forge's
|
|
// event of an opened, pushed, reopened or retargeted pull request alone; nothing polls for heads and no merge check is
|
|
// asked or written (the merge-check machinery went with milestone H).
|
|
|
|
import type { GiteaClient, GiteaPull } from "./client.js";
|
|
|
|
/** `pull.updated` for one open pull request's head: what the controller asks the build seat to check (novox/hq to-be
|
|
* 45 §9). The merge tool's ask is this same announcement (ADR 0323 §5). */
|
|
export async function announcementOf(client: GiteaClient, owner: string, name: string, cloneURL: string | undefined,
|
|
pull: GiteaPull): Promise<Record<string, unknown>> {
|
|
const files = await client.listPullFiles(owner, name, pull.number);
|
|
const head = String(pull.head_sha);
|
|
// What the controller maps the change onto the mesh's module graph with (novox/hq ADR 0237 as amended): which
|
|
// changed directories hold a module at the head — the merge's rule (issue 278). Not said when it could not be read; the controller then reads the change as
|
|
// touching everything built from the repository.
|
|
let moduleDirs: string[] | null = null;
|
|
try {
|
|
if (!files.truncated) moduleDirs = await client.moduleDirsAt(owner, name, head, files.paths);
|
|
} catch (err) {
|
|
console.error(`[gitea] ${owner}/${name}#${pull.number}: what the head holds could not be read — ${err instanceof Error ? err.message : err}`);
|
|
}
|
|
// The base branch's head as the head is announced: the trunk commit a verdict no build judges is said against
|
|
// (novox/hq ADR 0323 §3). Not said when it cannot be read; that verdict then names none.
|
|
const baseSHA = pull.base ? await client.branchHead(owner, name, String(pull.base)).catch(() => undefined) : undefined;
|
|
return {
|
|
owner,
|
|
repo: name,
|
|
number: pull.number,
|
|
...(baseSHA ? { base_sha: baseSHA } : {}),
|
|
title: pull.title,
|
|
body: pull.body,
|
|
base: pull.base,
|
|
head: pull.head,
|
|
head_sha: pull.head_sha,
|
|
clone_url: cloneURL,
|
|
html_url: pull.html_url,
|
|
paths: files.paths,
|
|
paths_truncated: files.truncated,
|
|
removed: files.removed,
|
|
...(moduleDirs ? { module_dirs: moduleDirs, module_dirs_said: true } : {}),
|
|
};
|
|
}
|