No client names the holder of the seat mesh-provisioner: each reader keeps its own constant, held to its manifest (ADR 0625 section 4, issue 1966)

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-05 19:36:21 +01:00
parent d630635229
commit 625d627794
21 changed files with 186 additions and 29 deletions
@@ -49,11 +49,14 @@ const (
haveBucket = engineHolder + "_" + nodeengine.StateHave
)
// provisionerModule is the module holding the seat mesh-provisioner, whose plans the client reads.
const provisionerModule = "mesh-provisioner"
// The buckets the client reads and writes, and the subject it reports on.
const (
// PlansBucket is where each module's provisioning plan on each node is read: the seat mesh-provisioner's
// `plans` (novox/hq ADR 0570 clause 2), read as an assignment's value carried it (asAssignment).
PlansBucket = meshprovisionerclient.PlansBucket
PlansBucket = provisionerModule + "_" + meshprovisionerclient.PlansState
// PlacementBucket is the seat mesh-module-assigner's placement (novox/hq ADR 0567): a module it names on this node stays
// here while the seat mesh-provisioner holds no plan of it (nats on novox runs without a want), filled from its
// last plan, and leaves only when neither names it (issue 1126 B12; the controller's assignments mirror, read for
@@ -55,9 +55,9 @@ func (m *memBus) Delete(_ context.Context, bucket, key string) error {
// as the seat mesh-provisioner keeps it (ADR 0570 clause 2).
func routeEntryFor(t *testing.T, module, planEntry string) string {
t.Helper()
bus := &memBus{buckets: map[string]map[string][]byte{meshprovisionerclient.PlansBucket: {
bus := &memBus{buckets: map[string]map[string][]byte{meshprovisionerclient.PlansBucketOf(provisionerModule): {
node + "." + module: []byte(`{"v":1,"node":"` + node + `","module":"` + module + `","plan":{"provisions":[` +
planEntry + `]}}`)}, meshprovisionerclient.ProvisionsBucket: {}}}
planEntry + `]}}`)}, meshprovisionerclient.ProvisionsBucketOf(provisionerModule): {}}}
// The key the seat composed for that entry, provided-for: asked of route-proxy (ADR 0570 clause 3).
var b struct {
Provision string `json:"provision"`
@@ -76,8 +76,8 @@ func routeEntryFor(t *testing.T, module, planEntry string) string {
if err != nil {
t.Fatal(err)
}
bus.buckets[meshprovisionerclient.ProvisionsBucket][key] = raw
p := provider.New(provider.Options{Node: "novox", Module: "route-proxy", Bus: bus, Logf: t.Logf,
bus.buckets[meshprovisionerclient.ProvisionsBucketOf(provisionerModule)][key] = raw
p := provider.New(provider.Options{Provisioner: provisionerModule, Node: "novox", Module: "route-proxy", Bus: bus, Logf: t.Logf,
Offers: map[string]provider.Offer{"route": {Credential: provider.NoCredential, Serves: map[string]any{}}}})
out, err := p.Pass(context.Background())
if err != nil {
@@ -157,3 +157,11 @@ func TestNatsAModuleThatFailedOnAMissingNameIsFilledWhenTheNameArrives(t *testin
return e.read(t, "/etc/gitea/origins") == "https://git.example.org\n"
})
}
// The module holding the seat mesh-provisioner is this client's own word (the grants part grants the bucket whole; no client
// names a holder, novox/hq ADR 0625 §4), and the plans bucket is its state plans.
func TestThePlansBucketIsTheSeatsStatePlans(t *testing.T) {
if PlansBucket != "mesh-provisioner_plans" || provisionerModule != "mesh-provisioner" {
t.Errorf("the plans bucket is %q of %q", PlansBucket, provisionerModule)
}
}