mesh-watcher reads who holds a seat through the placement client and the seat's state name, not go/delivery (B5e; ADR 0634 §1, §4; issue 1966)

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-05 15:23:30 +01:00
parent 1d20825d69
commit 4923e44cf7
3 changed files with 14 additions and 6 deletions
+10 -5
View File
@@ -10,6 +10,8 @@ import (
"context"
"encoding/json"
"fmt"
assignerclient "git.novox.be/novox/mesh-contracts/placement/go/clients/meshmoduleassignerclient"
mesh "git.novox.be/novox/mesh-contracts/placement/go/seats/meshmoduleassigner"
"os"
"strings"
"sync"
@@ -19,7 +21,6 @@ import (
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
meshselfcheck "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshselfcheck"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/delivery"
"git.novox.be/novox/mesh-sdk/go/views"
)
@@ -76,7 +77,7 @@ func main() {
w := NewWatcher(tg, time.Now, logf, node)
l := &listening{now: "not yet: starting"}
placement := &views.Reader{Module: "mesh-watcher", Logf: logf, Findings: meshconditionsclient.FindingWriter{State: stdio.State("findings")}, Acts: meshhandactsclient.Recorder{Ask: stdio.Ask}}
placement.Follow(delivery.AssignerModule, delivery.SeatHoldersState, SeatHoldersTool)
placement.Follow(assignerModule, mesh.StateSeatHolders, SeatHoldersTool)
go run(w, l, node, placement)
if err := stdio.Serve("", append(tools(w, l), placement.Tools("watcher")...)); err != nil {
logf("%v", err)
@@ -155,12 +156,16 @@ func roundTrip(node string) error {
// SeatHoldersTool is the assigner's read tool of the state of who holds which seat, which the manifest invokes; the
// state is followed as a view (ADR 0615), named as the manifest named it before: SeatHoldersRead.
const SeatHoldersTool = delivery.AssignerModule + ".assigner_read_seat_holders"
// assignerModule is the holder of the seat mesh-module-assigner whose seat-holders view this module follows: the one name
// of it here, the same as its manifest's `consumes` and `invokes` carry (the manifest test holds them equal).
const assignerModule = "mesh-delivery-assigner"
const SeatHoldersTool = assignerModule + ".assigner_read_seat_holders"
// controlNodes reads which machines hold the bus, from the placement seat's state of who holds which seat (novox/hq
// ADR 0571 clause 4). The controller is not placed (ADR 0590), so the bus's machines are the control node.
func controlNodes(seats *views.Reader) ([]string, error) {
keys, err := seats.Values(delivery.SeatHoldersRead)
keys, err := seats.Values(assignerModule + "." + mesh.StateSeatHolders)
if err != nil {
return nil, err
}
@@ -172,7 +177,7 @@ func holderNodes(keys map[string][]byte, seats ...string) ([]string, error) {
var out []string
seen := map[string]bool{}
for _, seat := range seats {
holders, err := delivery.HoldersOf(keys, seat, "")
holders, err := assignerclient.HoldersOf(keys, seat, "")
if err != nil {
return nil, err
}
@@ -2,6 +2,7 @@ package main
import (
"encoding/json"
mesh "git.novox.be/novox/mesh-contracts/placement/go/seats/meshmoduleassigner"
"os"
"path/filepath"
"reflect"
@@ -38,7 +39,7 @@ func TestTheManifestSaysWhatTheCodeDoes(t *testing.T) {
t.Fatal(err)
}
// Where the bus runs is the assigner's seat-holders, asked once and followed by its events (ADR 0615), never read.
if !reflect.DeepEqual(m.Consumes, []string{"mesh-self-check.checked", "mesh-delivery-assigner.views.seat-holders"}) {
if !reflect.DeepEqual(m.Consumes, []string{"mesh-self-check.checked", assignerModule + ".views." + mesh.StateSeatHolders}) {
t.Fatalf("consumes %v", m.Consumes)
}
if !reflect.DeepEqual(m.Invokes, []string{SeatHoldersTool, m.Module + ".watcher_ping", "seat:mesh-hand-acts.hand-act"}) || len(m.Reads) != 0 {
+2
View File
@@ -5,6 +5,8 @@ go 1.26.0
require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261104174359-05b3e2e1b94f
require (
git.novox.be/novox/mesh-contracts/placement/go/clients/meshmoduleassignerclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/placement/go/seats/meshmoduleassigner v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/go v0.0.0-20261104174344-ae5266e77639 // indirect