CONFIG-1: mesh-config judges retirements on catalog-revision; #708 onto main

#708's six commits are taken onto main (the pull request path and A-490l's sweep go).
manifest-accepted goes in H1, so a retiring value is judged for every module a
catalog-revision names changed, and the resync tool's words no longer name the
indexer's config candidates, which retire too.

Builds: design 47 H §763 (G §654), §764 (mesh-config: its pull request path and A-490l's pull sweep; the indexer's manifest-accepted and config candidates); H-A-49, H-A-61

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
2026-11-20 02:42:16 +01:00
parent a1bc613702
commit d7dada57aa
6 changed files with 46 additions and 14 deletions
+18 -10
View File
@@ -328,7 +328,7 @@ func deciding(c *Config, rearm chan struct{}) {
// hearingDelivery takes the delivery parts' words that close a rename window or retire a value, each asked again until
// the runtime takes the subscription: the status view's `delivered`, the node-engine seat's `manifest-reads-changed`
// (a returning node-engine; design 32) and the seat mesh-catalog's `manifest-accepted`. At its start it judges the windows once,
// (a returning node-engine; design 32) and the seat mesh-catalog's `catalog-revision` (design 47 H §764, H-A-49). At its start it judges the windows once,
// since an event said while this module was down is not said again.
func hearingDelivery(c *Config) {
<-stdio.Served()
@@ -348,15 +348,7 @@ func hearingDelivery(c *Config) {
}
return c.Windows(b.Node)
}},
{"mesh-catalog.manifest-accepted", func(e stdio.Envelope) []string {
var b struct {
Module string `json:"module"`
}
if json.Unmarshal(e.Body, &b) != nil {
return nil
}
return c.Retirements(b.Module)
}},
{"mesh-catalog.catalog-revision.>", func(e stdio.Envelope) []string { return catalogRevisionRetirements(c, e.Body) }},
} {
go func(pattern string, handle func(stdio.Envelope) []string) {
for wait := 2 * time.Second; ; wait = min(wait*2, time.Minute) {
@@ -379,6 +371,22 @@ func hearingDelivery(c *Config) {
}
}
// catalogRevisionRetirements judges the retirements of every module a catalog revision names changed: the seat
// mesh-catalog's `catalog-revision` replaces `manifest-accepted`, which goes in H1 (design 47 H §764, H-A-49).
func catalogRevisionRetirements(c *Config, body []byte) []string {
var b struct {
Changed []string `json:"changed"`
}
if json.Unmarshal(body, &b) != nil {
return nil
}
var said []string
for _, m := range b.Changed {
said = append(said, c.Retirements(m)...)
}
return said
}
// seatRename is one open rename as the seat's definition answers it: module, from, to, at and the nodes holding it open.
type seatRename struct {
Module string `json:"module"`
@@ -6,6 +6,8 @@ package main
import (
"encoding/json"
"errors"
"os"
"path/filepath"
"strings"
"sync"
"testing"
@@ -351,3 +353,26 @@ func TestAWriteOfARenameWindowRearmsTheDeadlineTimer(t *testing.T) {
t.Error("a rename window written after start did not rearm the timer")
}
}
// CONFIG-1/AC1 (design 47 H §763, §764; H-A-49): mesh-config consumes no pull request event and no `manifest-accepted`,
// calls no `git.pull`, and judges the retirements of each module a `catalog-revision` names changed.
func TestARetirementIsJudgedOnACatalogRevisionAndNoPullIsHeard(t *testing.T) {
raw, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
if err != nil {
t.Fatal(err)
}
for _, gone := range []string{`"git.pull-merged"`, `"git.pull-closed"`, `"seat:git.pull"`, `"mesh-catalog.manifest-accepted"`} {
if strings.Contains(string(raw), gone) {
t.Errorf("the manifest still names %s", gone)
}
}
c, _, d, _, _, _ := retiringMesh(t)
d.known = false
said := catalogRevisionRetirements(c, []byte(`{"v":1,"revision":4,"kind":"trunk","branch":"main","changed":["player","radio"]}`))
if len(said) != 2 || !strings.Contains(said[0], "player") || !strings.Contains(said[1], "radio") {
t.Fatalf("a catalog revision naming player and radio judged %q", said)
}
if got := catalogRevisionRetirements(c, []byte(`{"v":1,"revision":5,"kind":"trunk","branch":"main"}`)); len(got) != 0 {
t.Fatalf("a revision naming no module judged %q", got)
}
}
@@ -3,7 +3,7 @@ package main
// A value no longer read (novox/hq ADR 0609, design 32 *A value no longer read*).
//
// A config value or secret that no manifest on any trunk reads any more is a **retiring value**. mesh-config learns it
// from the indexer's tool `indexer_config_readers`, asked on each of the indexer's `manifest-accepted` (Retirements);
// from the indexer's tool `indexer_config_readers`, asked for each module a `catalog-revision` names changed (Retirements);
// a tool the indexer does not serve yet answers "not known" and nothing retires. A value is marked retiring only once no
// node-engine reports applied a build that reads it (State draining until then, judged again on each `delivered`);
// mesh-config then says `retiring` and asks the operator once, through the operator channel, whether to remove it. It is
@@ -39,7 +39,7 @@ func ownSwitchTools(c *Config) []stdio.Tool {
}},
{Name: ResyncTool,
Description: "Read every source again and write what differs: the published list of predefined keys, the " +
"resolved values, declared, and the indexer's config candidates.",
"resolved values and declared.",
Run: func(map[string]any) (any, error) { return c.Resync() }},
{Name: RenamesTool,
Description: "Each config value renamed (renamed-from): from which name to which, when, the nodes its value " +
@@ -850,7 +850,7 @@ func TestConfigWholeRenamesAndRetiresAgainstTheBus(t *testing.T) {
p2.mu.Lock()
p2.readers = []ReaderRow{{Module: "radio", Key: "band", Kind: KindValue, Readers: []string{}}}
p2.mu.Unlock()
p2.event("mesh-catalog.manifest-accepted", map[string]any{"module": "radio"})
p2.event(catalog.Seat+"."+catalog.EventCatalogRevision+".main", map[string]any{"v": 1, "revision": p2.catRev, "kind": "trunk", "branch": "main", "changed": []string{"radio"}})
eventually(t, "the retirement waits on g14", func() bool {
raw, ok := p2.get(RetiringState, "radio.band")
return ok && strings.Contains(string(raw), RetireDraining)
-1
View File
@@ -21,7 +21,6 @@
"consumes": [
"mesh-delivery-view.delivered",
"node-engine.manifest-reads-changed",
"mesh-catalog.manifest-accepted",
"mesh-delivery-indexer.views.predefined",
"mesh-delivery-assigner.views.assignments",
"mesh-delivery-assigner.views.wants",