diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go index 511d18a8..952f0af1 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go @@ -339,6 +339,7 @@ func (p *passer) wants(ctx context.Context) { none := assign.Outcome{Rules: noPipelineRules(g.nodes, name, fp, branches)} p.sayNoWant(name, g.nodes, wantedOf[name], none) p.sayWhy(ctx, name, g.nodes, wantWhy{Branch: g.branch, Fp: fp, Step: whyNoPipeline}, wantedOf[name], &none, nil) + p.nameHeldBuilds(ctx, name, fp, g.nodes, nodes, wantedOf[name], p.namedBuild(name, fp, trunk[name].FpSrc)) return } // The first start of the pipeline runner (design 47 G A-428): no runner runs to pass its pipeline, so its want is @@ -1601,3 +1602,20 @@ func (p *passer) sayParts(name string, m assign.Module, n assign.Nodes, out assi p.logf("the want of %s on %s names no version and no parts: %s", name, node, why) } } + +// nameHeldBuilds rewrites, for a module the trunk's newer fingerprint of which passed no pipeline, each want held at an older build +// that names no version: with the release whose parts are exactly what that build made, and its parts where the node's engine reads +// them, everything else of the want as it stands (novox 2026-11-16: mesh-hand-acts held at 4eb3cf48, released 0.1.13, after the +// mesh-sdk merge moved its fingerprint). No want is written for the unpassed fingerprint, nor for a build with no release. +func (p *passer) nameHeldBuilds(ctx context.Context, name, trunkFP string, group []string, n assign.Nodes, held map[string]mwc.Want, named func(fp string) (assign.KeptBuild, bool)) { + for _, node := range group { + w, ok := held[node] + if !ok || w.Removed || w.Fp == "" || w.Fp == trunkFP || w.Version != "" { + continue + } + if k, found := named(w.Fp); !found || k.Version == "" { + continue + } + p.putWant(ctx, node, name, n.NameKept(assign.Module{KeptBuilds: named}, node, w)) + } +} diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pipelines_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pipelines_test.go index b29ba21d..37533c01 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pipelines_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pipelines_test.go @@ -28,6 +28,7 @@ import ( "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient" "git.novox.be/novox/mesh-contracts/go/seats/nodeengine" + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds" "mesh-delivery-assigner/internal/assigngraph" "mesh-delivery-assigner/internal/buckets" @@ -410,3 +411,40 @@ func TestTheCatalogHalfIsTakenInPerBranch(t *testing.T) { t.Error("a module taken out of beta's half leaves main's") } } + +// Design 47 G §379, §526: a want held at an older build, the trunk's newer fingerprint having passed no pipeline, is rewritten +// with that build's released version (and parts for an engine that reads them), the rest of the want kept; no want names the +// unpassed fingerprint (novox 2026-11-16, mesh-hand-acts 0.1.13 at 4eb3cf48). +func TestAWantHeldAtAnOlderBuildNamesItsReleaseWithoutAPassedPipeline(t *testing.T) { + old := meshcatalogclient.SourcePrefix2 + strings.Repeat("4", 64) + fp := meshcatalogclient.SourcePrefix2 + strings.Repeat("9", 64) + wantsKV := &memKV{values: map[string][]byte{}} + p := newPasser(kvSet{buckets.Wants(): wantsKV, buckets.Asks(): &memKV{values: map[string][]byte{}}}, time.Now()) + p.say = func(oc.Condition) error { return nil } + mdigest := strings.Repeat("e", 64) + mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: fp, Manifest: mdigest, Repository: "novox/web", Commit: strings.Repeat("1", 40), Path: meshcatalogclient.RootPath}) + putModuleRaw(p.w, trunkBranch, "web", mod) + p.w.manifests[mdigest] = parsed{module: "web", manifest: catalogue.Manifest{Module: "web"}} + endRaw, _ := json.Marshal(builds.BuildEnded{Module: "web", Fingerprint: old, Outcome: builds.BuildDone, Manifest: mdigest, Made: map[string]string{"tools": "sha256:1c"}}) + if err := p.w.ends.put(endRaw); err != nil { + t.Fatal(err) + } + rel, _ := json.Marshal(meshcatalog.VersionReleasedEvent{Module: "web", Source: 962, Version: "0.1.13", Artifacts: []meshcatalog.VersionArtifact{{Artifact: "tools", Digest: "sha256:1c"}}}) + if err := p.w.released.put(rel); err != nil { + t.Fatal(err) + } + placeOn(t, p.w, "g14", "web") + key, _ := mwc.WantKey("g14", "web") + held, _ := mwc.EncodeWant(mwc.Want{Fp: old, Self: true}) + wantsKV.values[key] = held + p.w.put(buckets.Wants(), key, held) + p.w.heardPresence("g14", false, time.Now()) + p.ends = newPipelineEnds(newMemEnds(), func() {}, t.Logf) + p.ends.trunk = p.w.trunkName + p.ends.on.Store(true) + p.wants(context.Background()) + got, err := mwc.DecodeWant(wantsKV.values[key]) + if err != nil || got.Fp != old || got.Version != "0.1.13" || !got.Self { + t.Errorf("the held want = %+v, %v; want %s at 0.1.13, self kept", got, err, old) + } +} diff --git a/modules/mesh-delivery-assigner/internal/assign/wants.go b/modules/mesh-delivery-assigner/internal/assign/wants.go index ebefa460..c8091c54 100644 --- a/modules/mesh-delivery-assigner/internal/assign/wants.go +++ b/modules/mesh-delivery-assigner/internal/assign/wants.go @@ -185,6 +185,9 @@ func (n Nodes) withKept(m Module, node string, w mwc.Want) mwc.Want { return w } +// NameKept is w naming the build at its fingerprint as the want of a module does (withKept), for a want held as it stands. +func (n Nodes) NameKept(m Module, node string, w mwc.Want) mwc.Want { return n.withKept(m, node, w) } + func (m Module) selfOn(node string) bool { return m.Self != nil && m.Self(node) } func (m Module) composition(node, fp string) (ComposedDigest, bool) {