R4 correction: a run on request is refused when its branch has no source revision yet

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
This commit is contained in:
2026-11-20 04:56:31 +01:00
parent 79e4688744
commit 1bd410522e
2 changed files with 10 additions and 1 deletions
@@ -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)
@@ -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)
}