GIT5: the forge's push webhook of a branch says branch-moved with the new head on the seat

Builds: design 47 G §11, §111, §331 branch-moved

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
2026-11-11 11:32:33 +01:00
parent 0bf636826a
commit 975f1aa8e8
2 changed files with 23 additions and 6 deletions
+7 -1
View File
@@ -45,13 +45,19 @@ test("an announcement is said on the seat git with its id, in the contract's bod
["repo.writable", { owner: "novox", repo: "app", account: "mesh-tools" }, "mesh.seat.git.event.repo-writable"],
["forge.pull-request.synchronized", { full_name: "novox/app", number: 7, head_sha: "aaa111" }, "mesh.seat.git.event.forge-pull"],
["forge.pull-request.labeled", { full_name: "novox/app", number: 7 }, undefined],
["forge.push", { full_name: "novox/app" }, undefined],
["forge.push", { full_name: "novox/app", ref: "refs/tags/v1", after: "a".repeat(40) }, undefined],
["forge.push", { full_name: "novox/app", ref: "refs/heads/gone", after: "0".repeat(40) }, undefined],
["forge.push", { full_name: "novox/app", ref: "refs/heads/feat/x", after: "a".repeat(40) }, "mesh.seat.git.event.branch-moved"],
];
for (const [type, body, subject] of rows) assert.equal(seatEventOf(type, body)?.subject, subject, type);
assert.deepEqual(seatEventOf("pull.updated", updated)?.body, { repository: "novox/app", number: 7, base: "main", branch: "",
head: "aaa111", "base-head": "ttt333" });
assert.equal(seatEventOf("forge.pull-request.edited", { full_name: "novox/app", number: 7, body: "x" })?.body &&
"body" in (seatEventOf("forge.pull-request.edited", { full_name: "novox/app", number: 7, body: "x" })!.body as object), false);
// A push of a branch (a merge and an admitted push alike) says branch-moved with the new head, one id per move.
const moved = seatEventOf("forge.push", { full_name: "novox/app", ref: "refs/heads/main", after: "b".repeat(40) }, () => new Date("2026-11-11T10:00:00Z"));
assert.deepEqual(moved?.body, { repository: "novox/app", branch: "main", head: "b".repeat(40), at: "2026-11-11T10:00:00.000Z" });
assert.equal(moved?.id, `moved:novox/app:main@${"b".repeat(40)}`);
assert.deepEqual([...SEAT_ONLY].sort(), ["forge.delete", "forge.status", "pull.closed", "pull.merged", "pull.updated", "repo.writable"]);
});