From e7c05c5370dc0cf3f8b6d5e4031d04a05ddc3b83 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 16 Nov 2026 10:36:19 +0100 Subject: [PATCH] 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 --- .../go/seats/meshpipelinerunner/contract.go | 7 ++----- .../seats/mesh-pipeline-runner/seat.json | 18 +++--------------- .../ts/seats/meshpipelinerunner/index.d.ts | 8 +++----- .../internal/pipeline/start.go | 18 +++++++++++++++++- .../internal/pipeline/start_test.go | 8 ++++++-- 5 files changed, 31 insertions(+), 28 deletions(-) diff --git a/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go b/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go index 9eb79ad6..f1cbb799 100644 --- a/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner/contract.go @@ -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). diff --git a/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json b/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json index 4a178f8f..41b0d914 100644 --- a/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json +++ b/modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json @@ -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)", diff --git a/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts b/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts index f785f657..5f8b49b3 100644 --- a/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/meshpipelinerunner/index.d.ts @@ -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; diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/start.go b/modules/mesh-delivery-pipeline/internal/pipeline/start.go index 23afc3b4..775552a9 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/start.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/start.go @@ -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 +} diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go b/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go index 619310c0..ac247826 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go @@ -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) }