Answer what the mesh's checks said of a pull request, as mesh-delivery's checks verb (hq ADR 0239)
mesh/merge-gate pass: builds gitea, mesh-delivery → novox; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery superseded: a newer delivery to the same trunk took over its walk
mesh/delivery-group group feat/delivery-checks-verb delivered: every member is delivered
mesh/merge-gate pass: builds gitea, mesh-delivery → novox; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery superseded: a newer delivery to the same trunk took over its walk
mesh/delivery-group group feat/delivery-checks-verb delivered: every member is delivered
Reading a pull request's mesh/merge-gate and mesh/repo-check meant scraping the controller's journal: the forge clips each status to 140 characters and nothing returned the verdict whole. mesh-delivery already keeps the verdict; it now keeps the machine that ran it, the layers' modules and the report, and its checks verb joins that to the forge's statuses, read through a new gitea_commit_statuses tool that also says whether the base's protection lets the commit merge. after: novox/mesh-controller
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
|
||||
// What the forge says of a commit's checks (novox/hq ADR 0239): read by mesh-delivery's `checks` verb.
|
||||
|
||||
test("the newest status of each context is kept, with what it said, when and by whom", async () => {
|
||||
const { newestByContext } = await import("../checks.ts");
|
||||
const read = newestByContext([
|
||||
{ context: "mesh/merge-gate", status: "success", description: "pass: every machine composes", updated_at: "2026-10-07T10:00:00Z",
|
||||
creator: { login: "mesh-admin" }, target_url: "https://forge.example/o/r/pulls/1" },
|
||||
{ context: "mesh/merge-gate", status: "failure", description: "fail: 0 of 4 compose", updated_at: "2026-10-07T09:00:00Z" },
|
||||
{ context: "mesh/repo-check", state: "error", description: "error: the toolchain was not there", created_at: "2026-10-07T10:01:00Z" },
|
||||
{ status: "success", description: "a status with no context" },
|
||||
]);
|
||||
assert.deepEqual(read.map((s) => [s.context, s.state]), [["mesh/merge-gate", "success"], ["mesh/repo-check", "error"]]);
|
||||
assert.equal(read[0].creator, "mesh-admin");
|
||||
assert.equal(read[0].description, "pass: every machine composes");
|
||||
assert.equal(read[1].created_at, "2026-10-07T10:01:00Z");
|
||||
});
|
||||
|
||||
test("a commit merges only when every required status is a success; a warning blocks", async () => {
|
||||
const { mergeableUnder } = await import("../checks.ts");
|
||||
const rule = { rule_name: "main", enable_status_check: true, status_check_contexts: ["mesh/merge-gate", "mesh/repo-check"] };
|
||||
const ok = mergeableUnder("main", rule, [
|
||||
{ context: "mesh/merge-gate", state: "success", description: "" },
|
||||
{ context: "mesh/repo-check", state: "success", description: "" },
|
||||
]);
|
||||
assert.equal(ok.mergeable, true);
|
||||
assert.deepEqual(ok.blocking, []);
|
||||
|
||||
const not = mergeableUnder("main", rule, [{ context: "mesh/merge-gate", state: "warning", description: "" }]);
|
||||
assert.equal(not.mergeable, false);
|
||||
assert.deepEqual(not.blocking, [{ context: "mesh/merge-gate", state: "warning" }, { context: "mesh/repo-check", state: "missing" }]);
|
||||
assert.match(not.says, /mesh\/repo-check \(missing\)/);
|
||||
});
|
||||
|
||||
test("no rule requires nothing; a rule that cannot be read says nothing, never yes", async () => {
|
||||
const { mergeableUnder } = await import("../checks.ts");
|
||||
const none = mergeableUnder("main", null, []);
|
||||
assert.equal(none.mergeable, true);
|
||||
assert.equal(none.protected, false);
|
||||
const off = mergeableUnder("main", { rule_name: "main", enable_status_check: false, status_check_contexts: ["mesh/merge-gate"] }, []);
|
||||
assert.equal(off.mergeable, true);
|
||||
assert.deepEqual(off.required, []);
|
||||
const unread = mergeableUnder("main", undefined, [], "Gitea API: 500");
|
||||
assert.equal(unread.mergeable, null);
|
||||
assert.match(unread.says, /could not be read/);
|
||||
});
|
||||
Reference in New Issue
Block a user