From 1bd410522e1fd78a3c30eecf59d51a9507e1253d Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 03:54:34 +0100 Subject: [PATCH] R4 correction: a run on request is refused when its branch has no source revision yet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A run's pipeline puts in source the newest source revision of its branch (H-A-85); a branch whose view holds none yet is refused, naming it, and nothing is written, never a pipeline of source 0. Builds: design 47 H ยง746; lead answer H-A-85, H-A-83 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy --- modules/mesh-delivery-pipeline/internal/pipeline/run.go | 5 +++++ .../mesh-delivery-pipeline/internal/pipeline/run_test.go | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/run.go b/modules/mesh-delivery-pipeline/internal/pipeline/run.go index 3f94f3a9..ceab2baf 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/run.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/run.go @@ -60,12 +60,17 @@ func (s *Starter) Run(caller string, in seat.RunInput, newID func() (string, err } movers = append(movers, seat.Mover{Module: m.Module, Commit: m.Commit}) } + // Its source is the branch's newest source revision, what the run is checked against (H-A-85): a branch with none yet + // is refused, naming it. var source int64 if view != nil { if h, ok := view(branch); ok { source = h.Source } } + if source <= 0 { + return seat.RunAnswer{}, fmt.Errorf("the branch %s has no source revision yet, which a run is checked against: nothing was started", branch) + } id, err := newID() if err != nil { return seat.RunAnswer{}, fmt.Errorf("the run's id is not made: %w", err) diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/run_test.go b/modules/mesh-delivery-pipeline/internal/pipeline/run_test.go index 670e36d5..c7ab5276 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/run_test.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/run_test.go @@ -29,13 +29,17 @@ func TestRunOnRequest(t *testing.T) { return nil }} id := func() (string, error) { return "0a1b2c3d4e5f", nil } - view := func(b string) (Half, bool) { return Half{Source: 41}, b == "fix/1" } + view := func(b string) (Half, bool) { return Half{Source: 41}, b == "fix/1" || b == "main" } if _, err := s.Run("sessions", seat.RunInput{Members: []seat.Member{{Module: "app", Commit: "c1"}}}, id, view); err == nil { t.Error("a member naming no branch was taken") } if _, err := s.Run("sessions", seat.RunInput{Members: []seat.Member{{Module: "app", Commit: "c1", Branch: "fix/1"}, {Module: "lib", Commit: "c0", Branch: "main"}}}, id, view); err == nil { t.Error("a run naming two branches was taken: it is one pipeline of one branch") } + // H-A-85: a branch with no source revision yet is refused, naming it. + if _, err := s.Run("sessions", seat.RunInput{Members: []seat.Member{{Module: "app", Commit: "c1", Branch: "fix/2"}}}, id, view); err == nil || !strings.Contains(err.Error(), "fix/2") { + t.Errorf("a run of a branch with no source revision = %v, want refused naming it", err) + } if len(store.memStore) != 0 || len(said) != 0 { t.Fatalf("a refused run wrote %v and said %v", store.memStore, said) }