From 9496c57d41ff6c80020b7efc53e8eb10bf5755e1 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 15 Nov 2026 00:32:20 +0100 Subject: [PATCH] mesh-grants: say how a want's newest build was read and which left-out modules' seat workers are not created (A-413, A-414) Builds: design 47 G A-413, A-414 --- modules/mesh-grants/grants_test.go | 5 +++ modules/mesh-grants/internal/grants/inputs.go | 30 +++++++++++----- modules/mesh-grants/internal/grants/part.go | 34 +++++++++++++++++-- 3 files changed, 58 insertions(+), 11 deletions(-) diff --git a/modules/mesh-grants/grants_test.go b/modules/mesh-grants/grants_test.go index 15c4a284..3b09d426 100644 --- a/modules/mesh-grants/grants_test.go +++ b/modules/mesh-grants/grants_test.go @@ -5264,6 +5264,11 @@ func TestPassBeforeTheCatalogHalfComposesFromTheTrunkToo(t *testing.T) { if in.CatalogUnread == "" { t.Fatal("the catalog half is not unread") } + if row.newest == "none" && !slices.ContainsFunc(in.Gaps, func(g grants.Gap) bool { + return g.Input == "wanted manifests" && strings.Contains(g.Why, "newest build is not held") + }) { + t.Errorf("no gap says why the want's newest build was not taken: %+v", in.Gaps) + } // An entry asked and not answered is no failed read while the catalog half is unread: the trunk's manifest composes the // account and the list is not held for it. if f := in.ReadFailed(); len(f) > 0 { diff --git a/modules/mesh-grants/internal/grants/inputs.go b/modules/mesh-grants/internal/grants/inputs.go index 1ec8adf1..b89dd5b5 100644 --- a/modules/mesh-grants/internal/grants/inputs.go +++ b/modules/mesh-grants/internal/grants/inputs.go @@ -601,7 +601,7 @@ func ReadInputs(r Reader, cache *Manifests) Inputs { in.Gaps = append(in.Gaps, Gap{Input: ReadWants, Why: "not read: the modules are placed by the node-engines' haves this pass, so what runs is composed from each have's fingerprint"}) fromTrunk = runningByHaves(r, &in, cache, in.Running) } - var viaNewest []string + var viaNewest, noNewest []string for key, raw := range wants { node, module, err := meshwantsclient.ParseWantKey(key) if err != nil || !slices.Contains(in.Assigned[node], module) { @@ -616,16 +616,30 @@ func ReadInputs(r Reader, cache *Manifests) Inputs { continue } // The manifest of the build the want names is the catalog graph's entry of its fingerprint (design 47 G §444, §614). - if m, _, err := cache.entryManifest(r, w.Fp); err == nil { + m, _, err := cache.entryManifest(r, w.Fp) + switch { + case err == nil: in.Running[node+"."+module] = m - } else if m, _, nerr := cache.entryManifest(r, w.Newest); w.Newest != "" && w.Newest != w.Fp && nerr == nil { - // A running build with no catalog entry (from before the catalog graph) is composed from the entry of the build its want - // says is being built, for its account's grants, membership and seat traffic alone (A-414, as A-407 does for the node). - in.Running[node+"."+module] = m - viaNewest = append(viaNewest, node+"."+module) - } else { + continue + case w.Newest == "" || w.Newest == w.Fp: fromTrunk = append(fromTrunk, node+"."+module) + noNewest = append(noNewest, node+"."+module+" (its want names no newer build; "+err.Error()+")") + continue } + // A running build with no catalog entry (from before the catalog graph) is composed from the entry of the build its want + // says is being built, for its account's grants, membership and seat traffic alone (A-414, as A-407 does for the node). + nm, _, nerr := cache.entryManifest(r, w.Newest) + if nerr != nil { + fromTrunk = append(fromTrunk, node+"."+module) + noNewest = append(noNewest, node+"."+module+" (the entry of its want's newest build is not held: "+nerr.Error()+"; "+err.Error()+")") + continue + } + in.Running[node+"."+module] = nm + viaNewest = append(viaNewest, node+"."+module) + } + if len(noNewest) > 0 { + sort.Strings(noNewest) + in.Gaps = append(in.Gaps, Gap{Input: "wanted manifests", Why: "the running build has no catalog entry and its want's newest build gave none: " + strings.Join(noNewest, ", ")}) } if len(viaNewest) > 0 { sort.Strings(viaNewest) diff --git a/modules/mesh-grants/internal/grants/part.go b/modules/mesh-grants/internal/grants/part.go index d02e56fc..daf0450c 100644 --- a/modules/mesh-grants/internal/grants/part.go +++ b/modules/mesh-grants/internal/grants/part.go @@ -207,9 +207,11 @@ type Part struct { // heldSaid is the reason of the held-list condition last said (empty: none raised); heldKnown is whether one was said // since the start, so the first pass after a start always says its state (a condition raised before a restart is cleared // by it). holdMu guards both. - holdMu sync.Mutex - heldSaid string - heldKnown bool + holdMu sync.Mutex + heldSaid string + // leftOutSaid is the left-out and wanted-manifest lines last logged, so each change is said once (sayLeftOut). + leftOutSaid string + heldKnown bool // differSaid is the account consumers' differences last said as a condition, once differKnown (consumers.go). differSaid string differKnown bool @@ -348,6 +350,7 @@ func (p *Part) Compose() Result { recs, _ := Records(in) listRecs, left := ListRecords(in) holdings := HoldingsOf(in) + p.sayLeftOut(in.Gaps, left) res.RootNotFree = WithRootFree(&listRecs, p.Call) recs.RootFree = listRecs.RootFree st := UserListState{V: 1, Mode: InForce, LeftOut: left, Loaded: in.Loaded, BusNode: in.BusNode, @@ -745,3 +748,28 @@ func (p *Part) WithheldOn(node string) (meshgrants.Withheld, error) { } return out, nil } + +// sayLeftOut logs, once per change, what the pass did for a module whose running build has no entry (A-413, A-414): how its want's +// newest build was read, and each module left out for want of a manifest, whose carried membership's seat workers are then not +// created, since the account consumers are made from the accounts composed alone (consumers.go). +func (p *Part) sayLeftOut(gaps, left []Gap) { + var lines []string + for _, g := range gaps { + if g.Input == "wanted manifests" { + lines = append(lines, g.Why) + } + } + for _, g := range left { + lines = append(lines, g.Input+" "+g.Why+": its carried membership stays as published and the consumers it names (its seat workers) are not created by this pass") + } + said := strings.Join(lines, "\n") + if said == p.leftOutSaid { + return + } + p.leftOutSaid = said + if p.Logf != nil { + for _, l := range lines { + p.Logf("%s", l) + } + } +}