From a2f4e8b49909997b7714b1275a9347ebdd6ff6fc Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 12:11:38 +0100 Subject: [PATCH] assigner: the running builds whose manifest is not read are said once per change of their set The assigner said the same list of about 100 modules every two or three seconds, once per pass (live on the stable node since 2026-11-17 11:02 CET, the second meeting); it now says the list once each time it changes. Why their manifests cannot be read is the builder's stream of build ends, which holds no end of a build made before 2026-11-11, said apart. Builds: design 47 G G-23 (the assigner's long line, met a second time) --- .../cmd/mesh-delivery-assigner/pass.go | 4 +++- .../cmd/mesh-delivery-assigner/pass_test.go | 11 +++++++++ .../cmd/mesh-delivery-assigner/verbs.go | 23 ++++++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) 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 5911577a..092877ec 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go @@ -45,7 +45,9 @@ type passer struct { kvs kvSet w *world logf func(string, ...any) - sdk string + // unread is the set of modules whose running build's manifest served last could not read, said once per change of it. + unread saidSet + sdk string // say publishes a condition to the operator; said is, by condition key and state, what this process has said, so a // pass says a condition once and a restart says it again (the router keeps one per key). say func(oc.Condition) error diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass_test.go index 2e2631c1..76e97147 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass_test.go @@ -1434,6 +1434,17 @@ func aWantWaitsOnTheVerbEdgesTheGraphKeeps(t *testing.T) { t.Errorf("served(%s) = %v, want %v: the running server's manifest serves w alone, late's is not read", v, served(v), want) } } + // The modules whose running build's manifest is not read are said once per change of their set (G-23). + var said []string + p.logf = func(f string, a ...any) { said = append(said, fmt.Sprintf(f, a...)) } + lateOnly := assign.Nodes{Haves: map[string]map[string]nodeengine.HaveByNodeModuleValue{"g14": {"server": at(fp("f")), "late": at(fp("2"))}}} + p.served(g, lateOnly) + p.served(g, lateOnly) + p.served(g, assign.Nodes{Haves: map[string]map[string]nodeengine.HaveByNodeModuleValue{"g14": {"late": at(fp("2")), "loop": at(fp("1"))}}}) + p.served(g, lateOnly) + if len(said) != 2 || !strings.Contains(said[0], "[loop late]") && !strings.Contains(said[0], "[late loop]") || !strings.Contains(said[1], "[late]") { + t.Errorf("the unread manifests were said %q, want once per change of the set", said) + } // A-426a: a healthy build held (no catalog entry of it) or waiting for a yes serves what it serves, said once; one held unhealthy, // or whose running statement says it stopped, does not. held := at(fp("2")) diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/verbs.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/verbs.go index ac6766de..9a4dec05 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/verbs.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/verbs.go @@ -2,6 +2,8 @@ package main import ( "slices" + "strings" + "sync" "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient" "git.novox.be/novox/mesh-contracts/go/seats/nodeengine" @@ -53,12 +55,31 @@ func (p *passer) served(g graph.Graph, n assign.Nodes) func(string) bool { } served, unread := graph.Served(servingHaves(n, p.countedServing), func(module, fp string) ([]string, bool) { return p.servesOf(module, fp) }, func(module string) []string { return g[module].Serves }) - if len(unread) > 0 { + if p.unread.changed(unread) && len(unread) > 0 { p.logf("the manifest of the running build of %v cannot be read, so what the module graph says they serve is counted as served", unread) } return served } +// saidSet is the last set of names said, so a pass says a set again only when it changed. +type saidSet struct { + mu sync.Mutex + last string +} + +// changed keeps names as the set said last and says whether it differs from the one before. +func (s *saidSet) changed(names []string) bool { + sorted := slices.Sorted(slices.Values(names)) + key := strings.Join(sorted, " ") + s.mu.Lock() + defer s.mu.Unlock() + if key == s.last { + return false + } + s.last = key + return true +} + // offering is, for this pass, whether a build whose manifest offers a provision runs healthy on a node present (ADR 0603 // §5, ADR 0614 §5): every running healthy have on an online node, its build's manifest read as servesOf reads it. A have // waiting for a person's yes on a newer build counts too: it names the build that still runs and that build's health, and