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
37 lines
1.6 KiB
TypeScript
37 lines
1.6 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
import type { GiteaPull } from "../client.ts";
|
|
|
|
// **No poll of the forge for heads** (issue 1422; design 47 H §764, H-A-100): the forge's events say a pull request's new
|
|
// head as pull.updated, a merge and a close; nothing weighs a sibling or asks a merge check.
|
|
|
|
const edited = (base: string) => ({ name: "forge.pull-request.edited", body: { owner: "novox", repo: "hq", number: 7, base, merged: false } });
|
|
|
|
function deps() {
|
|
const calls: string[] = [];
|
|
return { calls, d: {
|
|
getRepo: async () => ({ r: 1 }),
|
|
getPull: async () => ({ state: "open", base: "trunk" }) as any,
|
|
announceUpdated: async () => { calls.push("updated"); },
|
|
announceMerge: async () => { calls.push("merge"); },
|
|
announceClosed: async () => { calls.push("closed"); },
|
|
} };
|
|
}
|
|
|
|
test("an edited event announces the head into the base it now has, without a poll", async () => {
|
|
const { actOn } = await import("../watch.ts");
|
|
const { calls, d } = deps();
|
|
await actOn(edited("trunk"), d);
|
|
assert.deepEqual(calls, ["updated"]);
|
|
});
|
|
|
|
test("a close without a merge is announced by its event, a merged close is left to the merge event", async () => {
|
|
const { actOn } = await import("../watch.ts");
|
|
const { calls, d } = deps();
|
|
await actOn({ name: "forge.pull-request.closed", body: { owner: "novox", repo: "hq", number: 7, merged: false } }, d);
|
|
assert.deepEqual(calls, ["closed"]);
|
|
calls.length = 0;
|
|
await actOn({ name: "forge.pull-request.closed", body: { owner: "novox", repo: "hq", number: 7, merged: true } }, d);
|
|
assert.deepEqual(calls, []);
|
|
});
|