From bff5e98b308c799da710178e20a7adf0c5b83383 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 01:05:16 +0100 Subject: [PATCH] C6: merge-pull refuses a source-only head whose check failed, naming the step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The runner's step-ended of a source-only check names the registration's key source.. 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 --- modules/gitea/index.ts | 6 +++-- .../seatgit/whole_integration_test.go | 24 ++++++++++++++++--- modules/gitea/module.json | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/modules/gitea/index.ts b/modules/gitea/index.ts index 6ba5c79f6..9d80727cd 100644 --- a/modules/gitea/index.ts +++ b/modules/gitea/index.ts @@ -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... (the seat's definition). - const stepEnded = `${RUNNER}.${RUNNER_EVENTS.stepEnded}.*.*.*`; + // The runner's step-ended is said on step-ended... (the seat's definition); a source-only + // check's names the registration's key source.. 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(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(`${GIT}.${GIT_EVENTS.branchMoved}`, async (event) => { diff --git a/modules/gitea/internal/seatgit/whole_integration_test.go b/modules/gitea/internal/seatgit/whole_integration_test.go index 19ed27d79..f29ed9d47 100644 --- a/modules/gitea/internal/seatgit/whole_integration_test.go +++ b/modules/gitea/internal/seatgit/whole_integration_test.go @@ -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() diff --git a/modules/gitea/module.json b/modules/gitea/module.json index 6d490aedc..722686476 100644 --- a/modules/gitea/module.json +++ b/modules/gitea/module.json @@ -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",