P11 started-names-what-is-read: pipeline-started's movers are StartedMover's fields alone

Builds: design 47 H2 H-A-709 (3)
This commit is contained in:
2026-11-25 17:18:53 +01:00
parent c0b3fc4138
commit 2eccf99693
2 changed files with 29 additions and 2 deletions
@@ -446,8 +446,14 @@ func (s *Starter) create(key string, p seat.Pipeline) error {
// started is a pipeline's pipeline-started (§746): its key, branch, source, call, revision and movers, and kept, every
// catalog revision its movers are kept at (design 47 H2 H-A-496), so the indexer pins each while the pipeline runs.
func started(p seat.Pipeline, at time.Time, kept []int64) seat.PipelineStarted {
// Each mover carries what the readers of pipeline-started read, and no more (design 47 H2 H-A-709 (3)): published, widens, tests,
// unplaced, revision and over-budget stay in the pipeline's record, read by show.
movers := make([]seat.StartedMover, 0, len(p.Movers))
for _, m := range p.Movers {
movers = append(movers, seat.StartedMover{Module: m.Module, Commit: m.Commit, Fingerprint: m.Fingerprint, Repository: m.Repository, Tier: m.Tier, Version: m.Version})
}
return seat.PipelineStarted{V: 1, At: &at, Pipeline: p.Pipeline, Branch: p.Branch, Source: p.Source, Call: p.Call,
Revision: p.Revision, Movers: p.Movers, Published: p.Published, Run: p.Run, Kept: kept}
Revision: p.Revision, Movers: movers, Published: p.Published, Run: p.Run, Kept: kept}
}
// keptList is every distinct revision of kept-revisions, in order (H-A-496).
@@ -1,6 +1,7 @@
package pipeline
import (
"bytes"
"encoding/json"
"errors"
"fmt"
@@ -30,7 +31,13 @@ func (c created) Create(key string, value []byte) error {
// refused.
func TestStarts(t *testing.T) {
store := created{}
s := &Starter{Pipelines: store, Say: func(string, any) error { return nil }}
var said []seat.PipelineStarted
s := &Starter{Pipelines: store, Say: func(_ string, body any) error {
if ev, ok := body.(seat.PipelineStarted); ok {
said = append(said, ev)
}
return nil
}}
key := Key("main", 41)
if ok, err := s.Start(Begin{Branch: "main", Source: 41, Movers: []seat.Mover{{Module: "app", Commit: "c1"}}}); !ok || err != nil {
t.Fatalf("start = %v, %v", ok, err)
@@ -51,6 +58,20 @@ func TestStarts(t *testing.T) {
if _, err := s.Start(Begin{Branch: "main", Source: 6}); err == nil {
t.Error("a start with no mover is refused")
}
// H2 H-A-709 (3): pipeline-started of 100 movers carries StartedMover's fields alone and stays under 32 KB
many := make([]seat.Mover, 100)
for i := range many {
many[i] = seat.Mover{Module: fmt.Sprintf("module-%03d", i), Commit: strings.Repeat("c", 40), Fingerprint: "src2:" + strings.Repeat("f", 64), Repository: "novox/mesh-delivery", Tier: 3,
Published: []string{"module:artifact", "module:other"}, Widens: []seat.Widening{{}}, OverBudget: true, Unplaced: seat.MoverUnplacedKeptRevisionUnread, Revision: 9}
}
said = nil
if _, err := s.Start(Begin{Branch: "main", Source: 44, Movers: many}); err != nil || len(said) != 1 {
t.Fatalf("100 movers started %d events (%v)", len(said), err)
}
raw, _ := json.Marshal(said[0])
if len(said[0].Movers) != 100 || len(raw) > 32*1024 || bytes.Contains(raw, []byte("over-budget")) || bytes.Contains(raw, []byte("widens")) || bytes.Contains(raw, []byte("unplaced")) || bytes.Contains(raw, []byte(`"published":["`)) {
t.Errorf("pipeline-started of 100 movers is %d bytes: %.200s; want 100 StartedMovers under 32 KB without published, widens, unplaced or over-budget", len(raw), raw)
}
s.Pipelines = failing{}
if _, err := s.Start(Begin{Branch: "main", Source: 5, Movers: []seat.Mover{{Module: "app"}}}); err == nil {
t.Error("a write the bus refuses is an error")