pipeline runner: say pipeline-started when placing a pipeline never asked; drop the runner version wait's leftovers

Placing the steps of a pipeline that has none says its pipeline-started, a
set-aside one included. The seat's acts entry for step `pipeline`, the wait step
value `pipeline` and the wait's `clock-from` go.

Builds: design 47 G A-446, A-446a
This commit is contained in:
2026-11-16 10:36:19 +01:00
parent 070a5dd35b
commit e7c05c5370
5 changed files with 31 additions and 28 deletions
@@ -710,15 +710,13 @@ type Wait struct {
Artifact string `json:"artifact,omitempty"`
// the watched branch, or the branch of a run on request
Branch string `json:"branch"`
// the time the bound counts from (design 47 G section 266, section 269, section 498)
ClockFrom *time.Time `json:"clock-from,omitempty"`
// the commit the module's entry was last changed at
Commit string `json:"commit,omitempty"`
// the module's build-input fingerprint at the commit
Fingerprint string `json:"fingerprint,omitempty"`
// the gathered group, when the pipeline is its
Group string `json:"group,omitempty"`
// for its end, how it ended: answered, ran, released, superseded
// for its end, how it ended: answered, ran, superseded
How string `json:"how,omitempty"`
Module string `json:"module"`
// what the step waits on (design 47 *Health and going back*)
@@ -732,7 +730,7 @@ type Wait struct {
Since time.Time `json:"since"`
// the source revision of the watched branch; the pipeline is keyed by it (ADR 0666 section 9)
Source int64 `json:"source,omitempty"`
// a pipeline step a wait inside a pipeline is in; pipeline is the acting step of design 47 G 203, for a wait of the entries the runner holds for its new version (design 47 G 534)
// a pipeline step a wait inside a pipeline is in
Step string `json:"step"`
V int64 `json:"v"`
// for a wait on a person, who: the operator, a reviewer
@@ -755,7 +753,6 @@ const (
WaitStepComposition = "composition"
WaitStepReview = "review"
WaitStepApproval = "approval"
WaitStepPipeline = "pipeline"
)
// Widening is a part serving a step the change alters, or an acting rule, a grant or a credential it widens, computed by the running runner (ADR 0666 section 23).
@@ -6,12 +6,6 @@
"domain": "Delivery",
"decision": "novox/hq ADR 0666",
"description": "The pipeline runner: it runs each module's pipeline on each of its watched branches, asking each step of the seat that serves it and hearing its end, and says each pipeline's and each step's start and end (design 47 *Pipelines per module*). Held once for the mesh; a foundation part.",
"acts": [
{
"step": "pipeline",
"bound": "30m"
}
],
"verbs": [
{
"name": "run",
@@ -1473,10 +1467,9 @@
"integration",
"composition",
"review",
"approval",
"pipeline"
"approval"
],
"description": "a pipeline step a wait inside a pipeline is in; pipeline is the acting step of design 47 G 203, for a wait of the entries the runner holds for its new version (design 47 G 534)"
"description": "a pipeline step a wait inside a pipeline is in"
},
"artifact": {
"type": "string"
@@ -1500,12 +1493,7 @@
},
"how": {
"type": "string",
"description": "for its end, how it ended: answered, ran, released, superseded"
},
"clock-from": {
"type": "string",
"format": "date-time",
"description": "the time the bound counts from (design 47 G section 266, section 269, section 498)"
"description": "for its end, how it ended: answered, ran, superseded"
}
},
"description": "a step's wait, held and ended; a wait on a person is said as waiting on that person, never a stall (ADR 0283)",
@@ -393,15 +393,13 @@ export interface Wait {
"artifact"?: string;
/** the watched branch, or the branch of a run on request */
"branch": string;
/** the time the bound counts from (design 47 G section 266, section 269, section 498) */
"clock-from"?: string;
/** the commit the module's entry was last changed at */
"commit"?: string;
/** the module's build-input fingerprint at the commit */
"fingerprint"?: string;
/** the gathered group, when the pipeline is its */
"group"?: string;
/** for its end, how it ended: answered, ran, released, superseded */
/** for its end, how it ended: answered, ran, superseded */
"how"?: string;
"module": string;
/** what the step waits on (design 47 *Health and going back*) */
@@ -415,8 +413,8 @@ export interface Wait {
"since": string;
/** the source revision of the watched branch; the pipeline is keyed by it (ADR 0666 section 9) */
"source"?: number;
/** a pipeline step a wait inside a pipeline is in; pipeline is the acting step of design 47 G 203, for a wait of the entries the runner holds for its new version (design 47 G 534) */
"step": "build" | "lint" | "unit" | "integration" | "composition" | "review" | "approval" | "pipeline";
/** a pipeline step a wait inside a pipeline is in */
"step": "build" | "lint" | "unit" | "integration" | "composition" | "review" | "approval";
"v": number;
/** for a wait on a person, who: the operator, a reviewer */
"who"?: string;
@@ -240,7 +240,7 @@ func (s *Starter) Waiting(store Updater, branch string, view func(branch string)
}, view, "the registration held when its branch's half or the registrations became held")
}
// placeWaiting places the steps of each running pipeline under pattern that has none, is neither held nor a run on request,
// placeWaiting places the steps of each running pipeline under pattern that has none and is not a run on request,
// and whose registration reg names, from that registration and its branch's catalog half (Registered, Waiting).
func (s *Starter) placeWaiting(store Updater, pattern string, reg func(seat.Pipeline) (catalog.Registration, bool), view func(branch string) (Half, bool), from string) (int, error) {
pkeys, err := store.Keys(pattern)
@@ -284,6 +284,15 @@ func (s *Starter) placeWaiting(store Updater, pattern string, reg func(seat.Pipe
}
placed++
s.logf("%s: %d steps placed from %s (A-327)", key, len(p.Steps), from)
// A pipeline whose steps were never asked is started by this placing, one a runner before this one set aside included
// (A-446a); the pipeline-started of its start, said already, is said again harmlessly.
if s.Say != nil {
ev := seat.PipelineStarted{V: 1, At: &now, Pipeline: key, Branch: p.Branch, Source: p.Source, Module: p.Module,
Commit: p.Commit, Fingerprint: p.Fingerprint, Group: p.Group, Revision: p.Revision, Published: p.Published}
if err := s.Say(runnerclient.Subject(seat.EventPipelineStarted, p.Module, p.Branch, commitOrGroup(p)), ev); err != nil {
s.logf("pipeline-started of %s is not said: %v", key, err)
}
}
if s.Steps != nil && len(asks) > 0 {
s.carry(key, asks)
if err := askAll(s.Steps, s.Arm, key, asks, s.recovered(key, p.Commit)); err != nil {
@@ -436,3 +445,10 @@ func (s *Starter) TakenIn(ev catalog.TakeInTaken, view func(branch string) (Half
}
return started, first
}
func commitOrGroup(p seat.Pipeline) string {
if p.Group != "" {
return p.Group
}
return p.Commit
}
@@ -152,7 +152,8 @@ func TestAPipelineStartedBeforeItsRegistrationIsPlacedWhenItArrives(t *testing.T
store := memCreated{memStore{}}
asks := &stepAsks{}
registered := false
s := &Starter{Pipelines: store, Steps: asks, Name: "the-runner", Say: func(string, any) error { return nil },
var said []string
s := &Starter{Pipelines: store, Steps: asks, Name: "the-runner", Say: func(subject string, _ any) error { said = append(said, subject); return nil },
Registration: func(m string) (catalog.Registration, bool) { return reg, registered && m == "app" }}
view := func(string) (Half, bool) { return Half{Entries: entries}, true }
taken := catalog.TakeInTaken{Key: "m.1", Branch: "main", Source: 4, Entries: []catalog.TakeInEntry{{Module: "app", Commit: "c1", Fingerprint: "src2:aa"}}}
@@ -246,9 +247,12 @@ func TestAPipelineStartedBeforeItsRegistrationIsPlacedWhenItArrives(t *testing.T
p seat.Pipeline
rev uint64
}{old, 1}
before = len(asks.asks)
before, saidBefore := len(asks.asks), len(said)
n, err = s.Waiting(store.memStore, "main", late)
p, _, _ = store.Get("main.940.app")
if len(said) != saidBefore+1 || !strings.HasPrefix(said[saidBefore], "mesh.seat.mesh-pipeline-runner.event.pipeline-started.app.main.c9") {
t.Errorf("placing the set-aside pipeline said %v, want its pipeline-started (A-446a)", said[saidBefore:])
}
if n != 1 || err != nil || len(p.Steps) == 0 || len(asks.asks) == before {
t.Errorf("the pipeline a runner before this one set aside: placed %d (%v), %d steps, %d asks more, want it started as a newly started one", n, err, len(p.Steps), len(asks.asks)-before)
}