§717 (3), the teller: it follows the asks and the answers by their seats, at the holders the seat-holders view names

The teller followed mesh-delivery-assigner's asks and mesh-delivery-view's answers by module name. It now gains the catalog
half's reader (§614), whose claimant of mesh-module-assigner's seat-holders view is its holder function (A-298), and
follows mesh-wants' asks and mesh-delivery-view's answers through views.ProcessReader.FollowSeat, each apart (issue 1906):
started before any module holds a seat it waits, and follows the holder once it is placed and as it moves. Its code names
neither module; its manifest invokes the catalog half's revision and the gate's source, and consumes the seat-holders view,
catalog-revision and source-moved; the assigner's seat-holders first-view tool answers the teller (A-131's module form).

Builds: design 47 G §717, §614, A-298, A-295, A-296

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-12 19:55:29 +01:00
parent 8fa8289a6a
commit 2165b3b296
9 changed files with 126 additions and 25 deletions
@@ -115,7 +115,7 @@ func TestManifest(t *testing.T) {
// Design 47 G §717: the teller and the status view take their first views of the seat mesh-wants' asks and wants, and of
// the assignments, from the tools named for the states.
callers := map[string]string{"assignments": "mesh-grants,node-tools,mesh-delivery-indexer,mesh-delivery-builder,mesh-delivery-checker,mesh-delivery-view",
"seat-holders": "node-tools,mesh-delivery-builder,mesh-delivery-view", "wants": "mesh-grants,mesh-delivery-view", "asks": "mesh-delivery-teller,mesh-delivery-view"}
"seat-holders": "node-tools,mesh-delivery-builder,mesh-delivery-view,mesh-delivery-teller", "wants": "mesh-grants,mesh-delivery-view", "asks": "mesh-delivery-teller,mesh-delivery-view"}
env := m.Build.Artifacts[0].Env
for tool, list := range callers {
if env[views.CallersEnv(tool)] != list || views.ParseCallers(env[views.CallersEnv(tool)]).Allows("n1."+m.Module) {
+1 -1
View File
@@ -249,7 +249,7 @@
"env": {
"MESH_VIEW_CALLERS_ASKS": "mesh-delivery-teller,mesh-delivery-view",
"MESH_VIEW_CALLERS_ASSIGNMENTS": "mesh-grants,node-tools,mesh-delivery-indexer,mesh-delivery-builder,mesh-delivery-checker,mesh-delivery-view",
"MESH_VIEW_CALLERS_SEAT_HOLDERS": "node-tools,mesh-delivery-builder,mesh-delivery-view",
"MESH_VIEW_CALLERS_SEAT_HOLDERS": "node-tools,mesh-delivery-builder,mesh-delivery-view,mesh-delivery-teller",
"MESH_VIEW_CALLERS_WANTS": "mesh-grants,mesh-delivery-view"
}
}
@@ -22,7 +22,10 @@ import (
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshdeliveryclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-sdk/go/process"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-view/viewstate"
@@ -84,6 +87,9 @@ const (
assignerAsks = "mesh-delivery-assigner_asks"
viewAnswers = "mesh-delivery-view_" + viewstate.ViewAnswersState
tellerConsumer = "n1_mesh-delivery-teller"
// The stand-ins of the seats' holders: the teller's code names neither (design 47 G §717).
assignerModule = "mesh-delivery-assigner"
viewModule = "mesh-delivery-view"
seatAsk = "mesh.seat.operator-channel.accept.ask.mesh-delivery-teller"
seatCancel = "mesh.seat.operator-channel.accept.cancel.mesh-delivery-teller"
seatCondition = "mesh.seat.operator-channel.accept.condition.mesh-delivery-teller"
@@ -109,7 +115,11 @@ func fullConf(dir string) string {
teller = append(teller, keepsOf(bucketsOf(tellerModule).marks)...)
// The assigner's asks and the view's answers, each by its read tool and its views family (ADR 0615, DLV-M3; A-175), and the
// teller's own first-views and findings; the buckets themselves are no longer the teller's to read.
teller = append(append(append(teller, viewstest.Grants(assignerModule, assignerModule+"."+assignerAsksState, tellerConsumer)...), viewstest.Grants(viewModule, viewModule+"."+viewstate.ViewAnswersTool, tellerConsumer)...), keepsOf(bucketsOf(tellerModule).firstViews)...)
teller = append(append(append(teller, viewstest.Grants(assignerModule, assignerModule+"."+meshwants.StateAsks, tellerConsumer)...), viewstest.Grants(viewModule, viewModule+"."+viewstate.ViewAnswersTool, tellerConsumer)...), keepsOf(bucketsOf(tellerModule).firstViews)...)
// Design 47 G §717, §614: the catalog half's first views and the seat-holders view of the claimant it names.
teller = append(append(teller, viewstest.Grants(assignerModule, assignerModule+".seat-holders", tellerConsumer)...),
"mesh.seat.mesh-catalog.call.revision", "mesh.seat.mesh-catalog.call.revision.>", "mesh.seat.mesh-catalog.call.registrations",
"mesh.seat.mesh-catalog.call.registrations.>", "mesh.seat.mesh-delivery.call.source", "mesh.seat.mesh-delivery.call.source.>")
teller = append(teller, keepsOf(bucketsOf(tellerModule).findings)...)
view := append(append(readOf(tellerAnswers), readOf(assignerAsks)...), keepsOf(viewAnswers)...)
assigner := keepsOf(assignerAsks)
@@ -131,10 +141,11 @@ accounts {
}
type fullBed struct {
srv *server.Server
ctl *nats.Conn
js jetstream.JetStream
ctx context.Context
holders jetstream.KeyValue // the assigner's seat-holders (place)
srv *server.Server
ctl *nats.Conn
js jetstream.JetStream
ctx context.Context
}
// startFull starts the bus with the principals above and what the controller makes before any module starts: the buckets
@@ -192,10 +203,48 @@ func startFull(t *testing.T) *fullBed {
t.Fatal(err)
}
// The assigner as the owner of its asks: its read tool and its views family (ADR 0615).
viewstest.Serve(t, ctx, js, ctl, assignerModule, "asks", assignerModule+"."+assignerAsksState, tellerConsumer)
viewstest.Serve(t, ctx, js, ctl, assignerModule, "asks", assignerModule+"."+meshwants.StateAsks, tellerConsumer)
// The view as the owner of its answers, as the teller follows them (A-175, A-178).
viewstest.Serve(t, ctx, js, ctl, viewModule, viewstate.ViewAnswersState, viewModule+"."+viewstate.ViewAnswersTool, tellerConsumer)
return &fullBed{srv: srv, ctl: ctl, js: js, ctx: ctx}
// Design 47 G §717: the catalog half names the assigner the claimant of mesh-module-assigner, and its seat-holders view
// names no holder of mesh-wants or mesh-delivery-view until a test places them (place).
serveCatalogHalf(t, ctl)
holders := viewstest.Serve(t, ctx, js, ctl, assignerModule, "seat-holders", assignerModule+".seat-holders", tellerConsumer)
return &fullBed{srv: srv, ctl: ctl, js: js, ctx: ctx, holders: holders}
}
// place says the assigner and the view hold mesh-wants and mesh-delivery-view, on the seat-holders view.
func (b *fullBed) place(t *testing.T) {
t.Helper()
for seat, module := range map[string]string{"mesh-wants": assignerModule, "mesh-delivery-view": viewModule} {
if _, err := b.holders.Put(b.ctx, seat, []byte(`{"seat":"`+seat+`","holders":[{"module":"`+module+`","node":"n1"}]}`)); err != nil {
t.Fatal(err)
}
}
}
// serveCatalogHalf answers the catalog half's three first views (design 47 G §614): the gate's one source branch, the
// assigner registered on it, and its trunk revision whose entry of the assigner claims mesh-module-assigner.
func serveCatalogHalf(t *testing.T, nc *nats.Conn) {
t.Helper()
respond := func(a any) nats.MsgHandler {
raw, _ := json.Marshal(map[string]any{"result": a, "node": "n0"})
return func(m *nats.Msg) { _ = m.Respond(raw) }
}
revision := meshcatalog.RevisionAnswer{Revision: &meshcatalog.CatalogRevision{Revision: 1, Kind: meshcatalogclient.KindTrunk},
Entries: []meshcatalog.CatalogEntry{{Module: assignerModule, ManifestDigest: "d1", Manifest: map[string]any{"module": assignerModule,
"claims": []any{map[string]any{"name": "mesh-module-assigner", "scope": "mesh"}}}}}}
registrations := meshcatalog.RegistrationsAnswer{Registrations: []meshcatalog.Registration{{Module: assignerModule, Version: 1, Branches: []string{"release"}}}}
for subject, handle := range map[string]nats.MsgHandler{"mesh.seat.mesh-catalog.call.revision": respond(revision),
"mesh.seat.mesh-catalog.call.registrations": respond(registrations), "mesh.seat.mesh-delivery.call.source": respond(map[string]any{"branches": []string{"release"}})} {
for _, s := range []string{subject, subject + ".>"} {
sub, err := nc.Subscribe(s, handle)
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = sub.Unsubscribe() })
}
}
}
// listening waits until the program hears the router's warrants (its pull of the durable consumer is waiting on the bus),
@@ -326,6 +375,14 @@ func TestTellerCarriesAnAskAndWritesTheAnswer(t *testing.T) { // 1343/AC1, AC2
}
// The program hears warrants before it reads the asks; it has its subscription before the ask is written.
b.listening(t)
// Design 47 G §717: the teller started before any module held mesh-wants; once the holder is placed it follows it, and
// raises the ask the holder then writes.
b.place(t)
for deadline := time.Now().Add(10 * time.Second); !strings.Contains(logs.String(), "holds "+assignerModule+"'s asks, the holder of the seat mesh-wants"); time.Sleep(10 * time.Millisecond) {
if time.Now().After(deadline) {
t.Fatalf("the teller did not follow the placed holder of mesh-wants:\n%s", logs.String())
}
}
if _, err := kv.Put(b.ctx, key, value); err != nil {
t.Fatal(err)
}
@@ -426,6 +483,7 @@ func TestTellerCarriesAnAskAndWritesTheAnswer(t *testing.T) { // 1343/AC1, AC2
func TestTellerAsksAgainAnAskRefusedForWantOfRoom(t *testing.T) { // 1610/AC1
t.Cleanup(nowIs(time.Now().UTC()))
b := startFull(t)
b.place(t)
assigner := b.as(t, "n1.mesh-delivery-assigner")
broker := filepath.Join(t.TempDir(), "broker")
cred, _ := json.Marshal(process.Account{URL: b.srv.ClientURL(), Node: "n1", Module: "mesh-delivery-teller", User: "n1.mesh-delivery-teller", Password: "pw"})
@@ -497,6 +555,7 @@ func TestTellerAsksAgainAnAskRefusedForWantOfRoom(t *testing.T) { // 1610/AC1
func TestTellerFillsAnAskFromTheViewsAnswerOnce(t *testing.T) { // 1297/B10 AC
t.Cleanup(nowIs(time.Now().UTC()))
b := startFull(t)
b.place(t)
assigner, view := b.as(t, "n1.mesh-delivery-assigner"), b.as(t, "n1.mesh-delivery-view")
broker := filepath.Join(t.TempDir(), "broker")
cred, _ := json.Marshal(process.Account{URL: b.srv.ClientURL(), Node: "n1", Module: "mesh-delivery-teller", User: "n1.mesh-delivery-teller", Password: "pw"})
@@ -568,6 +627,7 @@ func TestTellerFillsAnAskFromTheViewsAnswerOnce(t *testing.T) { // 1297/B10 AC
func TestTellerTakesAChangedHoldAnswerFromTheView(t *testing.T) {
t.Cleanup(nowIs(time.Now().UTC()))
b := startFull(t)
b.place(t)
assigner, view := b.as(t, "n1.mesh-delivery-assigner"), b.as(t, "n1.mesh-delivery-view")
broker := filepath.Join(t.TempDir(), "broker")
cred, _ := json.Marshal(process.Account{URL: b.srv.ClientURL(), Node: "n1", Module: "mesh-delivery-teller", User: "n1.mesh-delivery-teller", Password: "pw"})
@@ -12,6 +12,9 @@ import (
"fmt"
"git.novox.be/novox/mesh-contracts/go/seats/meshbroker"
occ "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdeliveryview"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"io"
"log"
"os"
@@ -25,8 +28,6 @@ import (
"github.com/nats-io/nats.go"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-view/viewstate"
"mesh-delivery-teller/internal/ends"
)
@@ -122,13 +123,23 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
}
defer writer.Close()
reader.Findings = func() views.WireWriter { return writer }
asks, err := reader.Follow(assignerModule, assignerAsksState, assignerModule+"."+assignerAsksState)
// The assigner's asks and the view's answers are views of the seats mesh-wants and mesh-delivery-view, followed at the module
// holding each (design 47 G §717): the holder is heard from the seat-holders view of the claimant of mesh-module-assigner,
// which the catalog half names (§614, A-298), so no module is named here and a moved holder is followed as it moves.
branches, err := meshcatalogclient.FollowBranchesProcess(reader, calls.Call)
if err != nil {
return err
}
branches.Logf = logger.Printf
holders := branches.SeatHolders(ctx)
asks, err := reader.FollowSeat(meshwants.Seat, meshwants.StateAsks, holders)
if err != nil {
return err
}
assignerKV := jetstream.KeyValue(asks)
// The view's answers to the assigner's asks (issue 1297 B10, A-175): followed as the assigner's asks are, never its bucket.
answered, err := reader.Follow(viewModule, viewstate.ViewAnswersState, viewModule+"."+viewstate.ViewAnswersTool)
// The view's answers to the assigner's asks (issue 1297 B10, A-175), followed apart, so the asks are raised whether or not the
// answers are read (issue 1906).
answered, err := reader.FollowSeat(meshdeliveryview.Seat, meshdeliveryview.StateAnswers, holders)
if err != nil {
return err
}
@@ -173,6 +184,3 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
return nil
}
}
// assignerAsksState is the seat mesh-wants' state asks, which the assigner keeps, and its first-view tool's name (design 47 G §717).
const assignerAsksState = "asks"
@@ -10,9 +10,7 @@ import (
// consumes) and the states it keeps itself; a unit row checks them against it (TestTheNamesAreTheManifests). No contract
// names a holder (novox/hq ADR 0625 §4, ADR 0634 §1).
const (
tellerModule = "mesh-delivery-teller"
assignerModule = "mesh-delivery-assigner"
viewModule = "mesh-delivery-view"
tellerModule = "mesh-delivery-teller"
// answersState is the teller's own state answers, said as its views family views.answers, and marksState the state of
// what that family said it up to.
@@ -3,10 +3,12 @@ package main
import (
"encoding/json"
"os"
"path/filepath"
"slices"
"strings"
"testing"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-view/viewstate"
)
@@ -38,13 +40,38 @@ func TestTheNamesAreTheManifests(t *testing.T) {
t.Errorf("the teller reads no other module's state, its manifest's reads are %v", m.Reads)
}
// Design 47 G §717: the assigner's asks are the seat mesh-wants' view, followed in seat form; no invoke names its tool.
if want := "seat:mesh-wants.views." + assignerAsksState; !slices.Contains(m.Consumes, want) || slices.ContainsFunc(m.Invokes, func(e string) bool { return strings.HasPrefix(e, assignerModule+".") }) {
if want := "seat:mesh-wants.views." + meshwants.StateAsks; !slices.Contains(m.Consumes, want) || slices.ContainsFunc(m.Invokes, func(e string) bool { return strings.HasPrefix(e, "mesh-delivery-assigner.") }) {
t.Errorf("the teller follows %s and invokes nothing of the assigner's, its manifest's consumes are %v and invokes %v", want, m.Consumes, m.Invokes)
}
// Design 47 G §717: the view's answers are the seat mesh-delivery-view's view, followed in seat form; no invoke names its tool.
if want := "seat:mesh-delivery-view.views." + viewstate.ViewAnswersState; !slices.Contains(m.Consumes, want) || slices.ContainsFunc(m.Invokes, func(e string) bool { return strings.HasPrefix(e, viewModule+".") }) {
if want := "seat:mesh-delivery-view.views." + viewstate.ViewAnswersState; !slices.Contains(m.Consumes, want) || slices.ContainsFunc(m.Invokes, func(e string) bool { return strings.HasPrefix(e, "mesh-delivery-view.") }) {
t.Errorf("the teller follows %s and invokes nothing of the view's, its manifest's consumes are %v and invokes %v", want, m.Consumes, m.Invokes)
}
// Design 47 G §717, §614: the holders are heard from the seat-holders view of the claimant the catalog half names, so the
// manifest follows that view in seat form and the catalog half's first views and events, and no code names the assigner
// or the status view.
for _, want := range []string{"seat:mesh-module-assigner.views.seat-holders", "mesh-catalog.catalog-revision", "mesh-delivery.source-moved", "mesh-catalog.registration-changed"} {
if !slices.Contains(m.Consumes, want) {
t.Errorf("the teller follows %s, its manifest's consumes are %v", want, m.Consumes)
}
}
for _, want := range []string{"seat:mesh-catalog.revision", "seat:mesh-catalog.registrations", "seat:mesh-delivery.source"} {
if !slices.Contains(m.Invokes, want) {
t.Errorf("the teller asks %s, its manifest's invokes are %v", want, m.Invokes)
}
}
files, _ := filepath.Glob("*.go")
for _, f := range files {
if strings.HasSuffix(f, "_test.go") {
continue
}
code, _ := os.ReadFile(f)
for _, name := range []string{`"mesh-delivery-assigner`, `"mesh-delivery-view"`, `"mesh-delivery-view.`} {
if strings.Contains(string(code), name) {
t.Errorf("%s names the module %s", f, name)
}
}
}
if want := "views." + answersState; !slices.Contains(m.Emits, want) {
t.Errorf("the teller says %s, its manifest's emits are %v", want, m.Emits)
}
+3 -1
View File
@@ -47,7 +47,9 @@ require (
git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshhandacts v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/containerimageregistryclient v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdeliveryview v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/containerimageregistry v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/ociartifactregistry v0.0.0-00010101000000-000000000000 // indirect
@@ -104,14 +104,15 @@ func TestManifestDeclarations(t *testing.T) { // 1240/AC1
}
// Its own states answers and teller-marks are said as its views family views.answers, read by teller_read_answers (A-175, A-178).
// The join: its first view asked again by hand is a hand act, recorded through the seat (views.StatusTools).
if want := []string{ "seat:mesh-hand-acts.hand-act", "seat:mesh-catalog.registrations", "seat:mesh-broker.show", "seat:operator-channel.notify",
// Design 47 G §717, §614: the catalog half's first views, which name the claimant of mesh-module-assigner.
if want := []string{"seat:mesh-hand-acts.hand-act", "seat:mesh-catalog.registrations", "seat:mesh-catalog.revision", "seat:mesh-delivery.source", "seat:mesh-broker.show", "seat:operator-channel.notify",
// A-126: who holds the seat operator-channel, whose state asks holds the router's record of its asks (operatorask.Bucket).
"seat:mesh-module-assigner.assignments"}; !reflect.DeepEqual(m.Invokes, want) {
t.Errorf("invokes = %v, want %v", m.Invokes, want)
}
// design 47 G §335 (TL1): the widening of a pipeline end is told through the seat operator-channel and kept in widens-said.
// design 47 G §387: the keeper's ask for the findings is heard, and the finding stream is declared (§383).
if want := []string{"mesh-conditions.findings-asked", "seat:mesh-wants.views.asks", "seat:mesh-delivery-view.views.answers", "mesh-catalog.registration-changed", "mesh-pipeline-runner.pipeline-ended", "mesh-delivery.recovery-merged", "mesh-delivery.record-opened", "mesh-broker.recreated", "mesh-broker.dropped"}; !reflect.DeepEqual(m.Consumes, want) {
if want := []string{"mesh-conditions.findings-asked", "seat:mesh-wants.views.asks", "seat:mesh-delivery-view.views.answers", "seat:mesh-module-assigner.views.seat-holders", "mesh-catalog.catalog-revision", "mesh-delivery.source-moved", "mesh-catalog.registration-changed", "mesh-pipeline-runner.pipeline-ended", "mesh-delivery.recovery-merged", "mesh-delivery.record-opened", "mesh-broker.recreated", "mesh-broker.dropped"}; !reflect.DeepEqual(m.Consumes, want) {
t.Errorf("consumes = %v, want %v", m.Consumes, want)
}
if want := []string{"operator-channel"}; !reflect.DeepEqual(sorted(m.Uses), want) {
+5
View File
@@ -13,6 +13,8 @@
"invokes": [
"seat:mesh-hand-acts.hand-act",
"seat:mesh-catalog.registrations",
"seat:mesh-catalog.revision",
"seat:mesh-delivery.source",
"seat:mesh-broker.show",
"seat:operator-channel.notify",
"seat:mesh-module-assigner.assignments"
@@ -21,6 +23,9 @@
"mesh-conditions.findings-asked",
"seat:mesh-wants.views.asks",
"seat:mesh-delivery-view.views.answers",
"seat:mesh-module-assigner.views.seat-holders",
"mesh-catalog.catalog-revision",
"mesh-delivery.source-moved",
"mesh-catalog.registration-changed",
"mesh-pipeline-runner.pipeline-ended",
"mesh-delivery.recovery-merged",