From 671dc5a9630ec84f0abb5bbe09390c9f9a50c1c7 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 00:17:55 +0100 Subject: [PATCH] Design 47 H1 (5c): the runner takes a publish into the pipeline of the revision it names One source now has several catalog revisions, so the publishing pipeline is found by the branch and revision the package-published names. A publish naming no revision, from a reservation made before the field, goes to its source's lowest-numbered revision, the take-in's. The seat mesh-builds' package-published gains its optional revision here too, identical to the builder branch's, so this branch compiles alone. Builds: design 47 H H-A-218, H-A-220 --- .../go/seats/meshbuilds/contract.go | 2 ++ .../seats/mesh-builds/seat.json | 4 ++++ .../ts/seats/meshbuilds/index.d.ts | 2 ++ .../internal/pipeline/start.go | 12 ++++++---- .../internal/pipeline/start_test.go | 24 +++++++++++++++++++ 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/modules/mesh-delivery-contracts/go/seats/meshbuilds/contract.go b/modules/mesh-delivery-contracts/go/seats/meshbuilds/contract.go index 4cc3285b..179a6890 100644 --- a/modules/mesh-delivery-contracts/go/seats/meshbuilds/contract.go +++ b/modules/mesh-delivery-contracts/go/seats/meshbuilds/contract.go @@ -95,6 +95,8 @@ type PackagePublished struct { Digest string `json:"digest"` // the module Module string `json:"module"` + // the catalog revision number of that branch the build was made from, the indexer's count (design 47 H-A-218, H-A-220); absent from a reservation made before the field + Revision int64 `json:"revision,omitempty"` // the source revision of that branch the build was made from Source int64 `json:"source"` V int64 `json:"v"` diff --git a/modules/mesh-delivery-contracts/seats/mesh-builds/seat.json b/modules/mesh-delivery-contracts/seats/mesh-builds/seat.json index fc3d717d..e100e48c 100644 --- a/modules/mesh-delivery-contracts/seats/mesh-builds/seat.json +++ b/modules/mesh-delivery-contracts/seats/mesh-builds/seat.json @@ -180,6 +180,10 @@ "type": "integer", "description": "the source revision of that branch the build was made from" }, + "revision": { + "type": "integer", + "description": "the catalog revision number of that branch the build was made from, the indexer's count (design 47 H-A-218, H-A-220); absent from a reservation made before the field" + }, "dependencies": { "type": "array", "items": { diff --git a/modules/mesh-delivery-contracts/ts/seats/meshbuilds/index.d.ts b/modules/mesh-delivery-contracts/ts/seats/meshbuilds/index.d.ts index 947f2e52..bf8e68c7 100644 --- a/modules/mesh-delivery-contracts/ts/seats/meshbuilds/index.d.ts +++ b/modules/mesh-delivery-contracts/ts/seats/meshbuilds/index.d.ts @@ -69,6 +69,8 @@ export interface PackagePublished { "digest": string; /** the module */ "module": string; + /** the catalog revision number of that branch the build was made from, the indexer's count (design 47 H-A-218, H-A-220); absent from a reservation made before the field */ + "revision"?: number; /** the source revision of that branch the build was made from */ "source": number; "v": number; diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/start.go b/modules/mesh-delivery-pipeline/internal/pipeline/start.go index 7d1a50ea..41f92321 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/start.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/start.go @@ -893,14 +893,18 @@ func (s *Starter) Release(store Updater, key string, view func(branch string) (H }, s.Registration, view, "the publishes its movers waited for") } -// heardPublished writes a package-published into the publishing mover's published, in the running pipeline of the source -// revision that published it, and places the movers that waited for it (design 47 H §746, H-A-84). It answers that -// source's pipeline, read, and whether one is held. +// heardPublished writes a package-published into the publishing mover's published, in the running pipeline of the catalog +// revision that published it, found by the branch and revision the publish names (H-A-218), and places the movers that +// waited for it (design 47 H §746, H-A-84). It answers that pipeline, read, and whether one is held. func (s *Starter) heardPublished(ev builds.PackagePublished, view func(branch string) (Half, bool)) (seat.Pipeline, bool, error) { if s.Store == nil { return seat.Pipeline{}, false, nil } - key, ok := s.sourcePipeline(ev.Branch, ev.Source) + key, ok := Key(ev.Branch, ev.Revision), true + if ev.Revision <= 0 { + // A publish of an older builder names no revision: its source's lowest-numbered revision, the take-in's (H-A-218). + key, ok = s.sourcePipeline(ev.Branch, ev.Source) + } if !ok { return seat.Pipeline{}, false, nil } diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go b/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go index 7baa680c..3c5cbfe0 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/start_test.go @@ -339,3 +339,27 @@ func TestATakeInOfTheOldFormIsRefused(t *testing.T) { t.Errorf("the new form = %+v (%v)", ev, err) } } + +// H-A-218: a package-published is taken into the pipeline of the branch and revision it names; one naming no revision (an +// older builder) into its source's lowest-numbered revision, the take-in's. +func TestAPublishIsTakenIntoThePipelineOfItsRevision(t *testing.T) { + mem := memStore{} + for _, r := range []int64{7, 8} { + mem[Key("main", r)] = struct { + p seat.Pipeline + rev uint64 + }{seat.Pipeline{Pipeline: Key("main", r), Branch: "main", Source: 4, Revision: r, Outcome: seat.PipelineOutcomeRunning, + Movers: []seat.Mover{{Module: "mesh-sdk"}}}, 1} + } + s := &Starter{Pipelines: memCreated{mem}, Store: mem, Say: func(string, any) error { return nil }} + view := func(string) (Half, bool) { return Half{Revision: 8}, true } + published := func(key string) []string { m, _ := MoverOf(mem[key].p, "mesh-sdk"); return m.Published } + ev := builds.PackagePublished{Artifact: "mesh-sdk:go", Module: "mesh-sdk", Branch: "main", Source: 4, Revision: 8, Version: "0.1.18"} + if err := s.Published(ev, view); err != nil || len(published("main.8")) != 1 || len(published("main.7")) != 0 { + t.Fatalf("a publish of revision 8 (%v): main.8 %v, main.7 %v; want main.8's mover alone", err, published("main.8"), published("main.7")) + } + ev.Revision, ev.Artifact = 0, "mesh-sdk:ts" + if err := s.Published(ev, view); err != nil || len(published("main.7")) != 1 || len(published("main.8")) != 1 { + t.Errorf("a publish naming no revision (%v): main.7 %v, main.8 %v; want main.7's, the source's lowest", err, published("main.7"), published("main.8")) + } +}