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
This commit is contained in:
2026-11-21 00:17:55 +01:00
parent 4af1ba99cf
commit 671dc5a963
5 changed files with 40 additions and 4 deletions
@@ -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"`
@@ -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": {
@@ -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;
@@ -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
}
@@ -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"))
}
}