From 4af59636c3f2ced500e1ed38061c9a2a6858227a Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 3 Oct 2026 23:22:56 +0200 Subject: [PATCH] A mesh seat's holder answers for the machine it runs on (hq ADR 0197) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The controller announces the mesh-controller seat without a machine — the seat is the mesh's — and the console then reported it as not answering on the machine it is assigned to. An announcement that names no machine now answers for wherever its module is assigned. --- node-tools/internal/console/address.go | 4 +++- node-tools/internal/console/address_test.go | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/node-tools/internal/console/address.go b/node-tools/internal/console/address.go index f8b2cb4..8374936 100644 --- a/node-tools/internal/console/address.go +++ b/node-tools/internal/console/address.go @@ -299,7 +299,9 @@ func indexOn(conn *bus.Conn) (*index, error) { continue } for _, n := range m.On { - if !announced[m.Module][n] { + // A holder of a seat held once for the mesh announces no machine — the seat is the mesh's, + // not a machine's — so what it announced without one answers for wherever it is assigned. + if !announced[m.Module][n] && !announced[m.Module][""] { l.NotAnswering = append(l.NotAnswering, m.Module+" on "+n) } } diff --git a/node-tools/internal/console/address_test.go b/node-tools/internal/console/address_test.go index f2a3208..43a0886 100644 --- a/node-tools/internal/console/address_test.go +++ b/node-tools/internal/console/address_test.go @@ -91,11 +91,12 @@ func TestTheMeshsToolsAreFoundByAddress(t *testing.T) { serve("modules", func() any { return out(fmt.Sprintf(`[{"module":"alpha","on":["desk"],"tools":true},{"module":"beta","on":["desk"],"tools":true},`+ `{"module":"gamma","on":%s,"tools":true},{"module":"delta","on":["desk"],"tools":false},`+ - `{"module":"epsilon","on":["bench"],"tools":true}]`, gammaOn.Load().(string))) + `{"module":"epsilon","on":["bench"],"tools":true},{"module":"mesh-controller","on":["bench"],"tools":true}]`, gammaOn.Load().(string))) }) stopAnn, err := announce.Serve(controller, announce.Service{Name: "mesh-controller", ID: "bench"}, func() []announce.Endpoint { return []announce.Endpoint{{Kind: announce.KindSeat, Module: "mesh-controller", Seat: "mesh-controller", Scope: "mesh", - Tool: "nodes", Node: "bench", Description: "Every machine the mesh knows.", Schema: json.RawMessage(`{}`), + // As the live controller announces: a mesh seat's holder names no machine. + Tool: "nodes", Node: "", Description: "Every machine the mesh knows.", Schema: json.RawMessage(`{}`), Subject: "mesh.seat.mesh-controller.tool.nodes"}} }) if err != nil { @@ -136,6 +137,9 @@ func TestTheMeshsToolsAreFoundByAddress(t *testing.T) { } // Silence is named only where tools should have answered: epsilon declares tools on bench and // nothing there announced it; delta declares none and is never a name. + if strings.Contains(overview, "mesh-controller on bench") { + t.Errorf("a mesh seat's holder that announced no machine is called silent on its machine:\n%s", overview) + } if !strings.Contains(overview, "epsilon on bench") || strings.Contains(overview, "delta") { t.Errorf("not answering: %s", overview) } -- 2.54.0