Every module follows the assigner's new places: the contracts' go/ path, mesh-wants in the delivery contracts, the state and tool assignments (issue 1966)

The legacy key form placement.<node> is gone from the client, so the readers and their fixtures lose it. The check noplacement
now also refuses the assigner's retired names in a manifest.

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-05 22:29:07 +01:00
parent 2dc9e07e88
commit c9d8950fd0
109 changed files with 682 additions and 681 deletions
+20 -20
View File
@@ -7,7 +7,7 @@ package main
// Read from the bus at start and every few minutes (issue 1126 B13; the controller that answered this before is
// not placed, novox/hq ADR 0590): the seats' verbs from the seats' contract (mesh-contracts), the modules'
// own tools from the manifests the indexer keeps (`mesh-delivery-indexer.modules` and `.manifests`), and the
// machines and where each module runs from the seat mesh-module-assigner's `placement`. Kept in the module's state so
// machines and where each module runs from the seat mesh-module-assigner's `assignments`. Kept in the module's state so
// a render never waits for the bus, and rendered whenever it changes. Nothing here is written by hand: a verb
// that gains a `replaces` is in the next render's table and the guard's next refusal.
@@ -16,8 +16,8 @@ import (
"encoding/json"
"errors"
"fmt"
assignerclient "git.novox.be/novox/mesh-contracts/placement/go/clients/meshmoduleassignerclient"
mesh "git.novox.be/novox/mesh-contracts/placement/go/seats/meshmoduleassigner"
assignerclient "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
mesh "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
catalogclient "git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
catalog "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog"
"net"
@@ -92,9 +92,9 @@ func ReadMeshTools(p Paths) *MeshTools {
// The states read, each declared in the manifest's reads.
const (
PlacementRead = (assignerModule + "." + mesh.StatePlacement)
ModulesRead = indexerModule + "." + catalog.StateModules
ManifestsRead = indexerModule + "." + catalog.StateManifests
AssignmentsRead = (assignerModule + "." + mesh.StateAssignments)
ModulesRead = indexerModule + "." + catalog.StateModules
ManifestsRead = indexerModule + "." + catalog.StateManifests
)
// States reads the module states the manifest declares in its reads: a state's keys, and one key's value.
@@ -110,17 +110,17 @@ type ModuleTools struct {
Replaces map[string][]string
}
// placements is every node's placement, from the seat mesh-module-assigner's state.
func placements(st States) (map[string]mesh.Placement, error) {
keys, err := st.Keys(PlacementRead)
// assignments is every node's assignments, from the seat mesh-module-assigner's state.
func assignments(st States) (map[string]mesh.Assignments, error) {
keys, err := st.Keys(AssignmentsRead)
if err != nil {
return nil, fmt.Errorf("%s: %w", PlacementRead, err)
return nil, fmt.Errorf("%s: %w", AssignmentsRead, err)
}
read := assignerclient.NewKeys()
for _, k := range keys {
v, found, err := st.Get(PlacementRead, k)
v, found, err := st.Get(AssignmentsRead, k)
if err != nil {
return nil, fmt.Errorf("%s %s: %w", PlacementRead, k, err)
return nil, fmt.Errorf("%s %s: %w", AssignmentsRead, k, err)
}
if found {
_, _ = read.Put(k, v, 0, false) // a key that does not read places nothing
@@ -129,8 +129,8 @@ func placements(st States) (map[string]mesh.Placement, error) {
return read.All(), nil
}
// runsOn is, by module, the nodes placement puts it on, sorted.
func runsOn(placed map[string]mesh.Placement) map[string][]string {
// runsOn is, by module, the nodes assignments puts it on, sorted.
func runsOn(placed map[string]mesh.Assignments) map[string][]string {
out := map[string][]string{}
for node, p := range placed {
for _, m := range p.Modules {
@@ -143,9 +143,9 @@ func runsOn(placed map[string]mesh.Placement) map[string][]string {
return out
}
// NodesRunning is the nodes placement puts module on.
// NodesRunning is the nodes assignments puts module on.
func NodesRunning(st States, module string) ([]string, error) {
placed, err := placements(st)
placed, err := assignments(st)
if err != nil {
return nil, err
}
@@ -261,11 +261,11 @@ func lookup(name string) []string {
return addrs
}
// ReadMeshToolsFrom reads the bus now: the seats' verbs, the placed modules' own tools, and every node placement names
// ReadMeshToolsFrom reads the bus now: the seats' verbs, the placed modules' own tools, and every node assignments names
// with its domains and addresses. A part that cannot be read is left out and said in the error; what was read is kept.
func ReadMeshToolsFrom(st States, defined []seatdef.Definition, resolve func(string) []string) (MeshTools, error) {
var m MeshTools
placed, err := placements(st)
placed, err := assignments(st)
if err != nil {
m.Replacements = ReplacementsOf(defined, nil)
return m, err
@@ -340,7 +340,7 @@ func guardFiles(p Paths, m *MeshTools) *GuardFiles {
return &GuardFiles{Exe: exe, Data: GuardDataOf(p, m), WaitsDir: WaitsDirPath(p)}
}
// MeshToolsEvery is how often the machines' addresses are resolved again; the tools and the placement are read again
// MeshToolsEvery is how often the machines' addresses are resolved again; the tools and the assignments are read again
// when their followed states change (a views event), not on this timer.
const MeshToolsEvery = 10 * time.Minute
@@ -353,7 +353,7 @@ func refreshMeshTools(p Paths) {
select {
case <-meshViews.Ready():
case <-time.After(MeshToolsFirst):
say("the first views of the tools and the placement were not answered in %s; reading what is held", MeshToolsFirst)
say("the first views of the tools and the assignments were not answered in %s; reading what is held", MeshToolsFirst)
}
startSeatList(seatlist.StdioBus())
for {