C6: merge-pull refuses a source-only head whose check failed, naming the step

The runner's step-ended of a source-only check names the registration's key
source.<owner>.<name> as its module and the commit's root tree hash as its
fingerprint, so its subject holds more parts than a module's: the forge
module hears every subject under step-ended and judges it as a module's.
The seat's whole test refuses an hq pull request whose unit step failed.

Builds: design 47 H2 §815; H-A-408
This commit is contained in:
2026-11-22 01:05:16 +01:00
parent 74dd8af699
commit bff5e98b30
3 changed files with 26 additions and 6 deletions
+4 -2
View File
@@ -459,8 +459,10 @@ if (gitea) {
const read = await readHeads(forge, registrations.watched, (line) => console.log(`[gitea] ${line}`));
await failedSteps.lost(heldHeads.replace(read.names, read.branches, read.pulls));
};
// The runner's step-ended is said on step-ended.<module>.<branch>.<commit> (the seat's definition).
const stepEnded = `${RUNNER}.${RUNNER_EVENTS.stepEnded}.*.*.*`;
// The runner's step-ended is said on step-ended.<module>.<branch>.<commit> (the seat's definition); a source-only
// check's names the registration's key source.<owner>.<name> as its module (design 47 H2 §815, H-A-408), so every
// subject under step-ended is heard.
const stepEnded = `${RUNNER}.${RUNNER_EVENTS.stepEnded}.#`;
void bindUntilHeld(stepEnded, () => on<StepEndedEvent>(stepEnded, (event) => failedSteps.stepEnded(event.body)));
// A branch's head is read from the forge, never taken from the event (the seat's definition of branch-moved).
void bindUntilHeld(`${GIT}.${GIT_EVENTS.branchMoved}`, () => on<BranchMovedEvent>(`${GIT}.${GIT_EVENTS.branchMoved}`, async (event) => {
@@ -12,6 +12,7 @@ package seatgit
// - A runner's step-ended of a failed required step at a pull request's head and fingerprint is kept, and a merge call
// naming that head merges nothing and names the step (§735, test 114).
// - A call naming two pull requests in two repositories merges both, in order, and says one merge-called (§734, §736).
// - An hq pull request, of a source-only registration, whose Go checks failed is refused naming the step (H2 §815).
// - With the forge's store stopped a merge call answers away, and called again once it is back it lands (H2 §776).
// - A forge that refuses the second merge gives one merge-called with the first member and `refused`, and merge-partial
// raised; a later call landing the refused member clears it (§767, test 115).
@@ -405,7 +406,7 @@ func TestTheSeatGitWholeOverARealBus(t *testing.T) {
}
kvs[name] = kv
}
A, B, X := strings.Repeat("a", 40), strings.Repeat("b", 40), strings.Repeat("e", 40)
A, B, X, H := strings.Repeat("a", 40), strings.Repeat("b", 40), strings.Repeat("e", 40), strings.Repeat("f", 40)
// A call stopped after the second of three merges, kept and not said (§766).
stopped, _ := json.Marshal(map[string]any{"by": "lead@shanks", "account": "shanks.claude-code", "at": "2026-11-20T03:00:00Z", "said": false,
"members": []any{
@@ -422,6 +423,7 @@ func TestTheSeatGitWholeOverARealBus(t *testing.T) {
"novox/app#7": {repo: "novox/app", base: "main", head: A, number: 7},
"novox/lib#9": {repo: "novox/lib", base: "main", head: B, number: 9, refuse: true},
"novox/lib#10": {repo: "novox/lib", base: "main", head: B, number: 10},
"novox/hq#11": {repo: "novox/hq", base: "main", head: H, number: 11},
}}
srv := httptest.NewServer(http.HandlerFunc(f.serve))
t.Cleanup(srv.Close)
@@ -441,7 +443,10 @@ func TestTheSeatGitWholeOverARealBus(t *testing.T) {
t.Cleanup(func() { _ = in.Close(); _ = cmd.Process.Kill(); _ = cmd.Wait() })
rt := &runtime{t: t, in: in, js: js, kvs: kvs, wait: map[string]chan json.RawMessage{}, regs: []map[string]any{
{"module": "app", "origin": "novox/app", "branches": []string{"main"}},
{"module": "lib", "origin": "novox/lib", "branches": []string{"main"}}}}
{"module": "lib", "origin": "novox/lib", "branches": []string{"main"}},
// A source-only registration (H2 §815): no module, one watched branch, its check a build seat's step.
{"origin": "novox/hq", "branches": []string{"main"}, "policy": map[string]any{"steps": map[string]any{"unit": "required"}},
"check": map[string]any{"seat": "node-build-go", "step": "unit"}}}}
go rt.read(out)
// At the start the stopped call says one merge-called naming the two that landed (§766).
@@ -457,7 +462,7 @@ func TestTheSeatGitWholeOverARealBus(t *testing.T) {
until(t, "the watched heads read after the registrations", func() bool { return f.asked("GET /api/v1/repos/novox/app/branches") })
// A failed required step at a head's fingerprint refuses that head (§735, test 114), heard on the module's consumer.
until(t, "the runner's step-ended followed", func() bool { return rt.subscribed("mesh-pipeline-runner.step-ended.*.*.*") })
until(t, "the runner's step-ended followed", func() bool { return rt.subscribed("mesh-pipeline-runner.step-ended.#") })
rt.ask("mesh/event", map[string]any{"envelope": map[string]any{"key": "mesh-pipeline-runner.step-ended.app.main." + X, "node": "test",
"body": map[string]any{"v": 1, "pipeline": "main.4", "module": "app", "branch": "main", "commit": X, "fingerprint": "fp-x",
"at": "2026-11-20T03:00:00Z", "result": map[string]any{"step": "unit", "status": "required", "outcome": "failed"}}}})
@@ -471,6 +476,19 @@ func TestTheSeatGitWholeOverARealBus(t *testing.T) {
t.Fatalf("merged %v", got)
}
// An hq pull request whose Go checks fail is refused by merge-pull naming the failed step (H2 §815): the runner's
// step-ended of a source-only check names the registration's key as its module and the commit's root tree hash as its
// fingerprint (H-A-408), judged as a module's.
rt.ask("mesh/event", map[string]any{"envelope": map[string]any{"key": "mesh-pipeline-runner.step-ended.source.novox.hq.main." + H, "node": "test",
"body": map[string]any{"v": 1, "pipeline": "main.5", "module": "source.novox.hq", "branch": "main", "commit": H, "fingerprint": strings.Repeat("7", 40),
"at": "2026-11-22T01:00:00Z", "result": map[string]any{"step": "unit", "status": "required", "outcome": "failed"}}}})
hq := rt.mergePull(map[string]any{"repository": "novox/hq", "number": 11, "head": H})
hqm, _ := hq["members"].([]any)
if len(hqm) != 1 || hqm[0].(map[string]any)["state"] != "refused" ||
!strings.Contains(fmt.Sprint(hqm[0].(map[string]any)["why"]), "the unit step of source.novox.hq failed in run main.5") {
t.Fatalf("an hq head at a failed check answered %v", hq)
}
// With the forge's store stopped, a merge call answers away, merging nothing (H2 §776); called again once the store is
// back, it lands (below).
f.mu.Lock()
+1 -1
View File
@@ -683,7 +683,7 @@
"consumes": [
"mesh-catalog.catalog-revision",
"mesh-catalog.registration-changed",
"mesh-pipeline-runner.step-ended.*.*.*",
"mesh-pipeline-runner.step-ended.#",
"git.branch-moved",
"git.pull-updated",
"git.pull-closed",