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:
@@ -38,6 +38,10 @@ func Offers() map[string]provider.Offer {
|
||||
}}
|
||||
}
|
||||
|
||||
// Provisioner is the module holding the seat mesh-provisioner, whose provisions and plans the helper reads: named from this
|
||||
// module's manifest (`reads`; TestTheOfferServesThePortTheManifestServes), since no client names a holder (novox/hq ADR 0625 §4).
|
||||
const Provisioner = "mesh-provisioner"
|
||||
|
||||
// busOf is the helper's bus over the runtime's own state: the provider's bucket is its state `bound`, and the
|
||||
// provisions and plans of the seat mesh-provisioner are the states it reads, by mesh-sdk's names (novox/hq ADR 0570,
|
||||
// issue 1954 L6-T1). The old assignments are read no more (mesh-sdk 692dbf9, L6-P3).
|
||||
@@ -47,10 +51,10 @@ func (b busOf) state(bucket string) (string, error) {
|
||||
switch bucket {
|
||||
case provider.BucketOf(Module):
|
||||
return "bound", nil
|
||||
case provisions.ProvisionsBucket:
|
||||
return provisions.ProvisionsRead, nil
|
||||
case provisions.PlansBucket:
|
||||
return provisions.PlansRead, nil
|
||||
case provisions.ProvisionsBucketOf(Provisioner):
|
||||
return provisions.ProvisionsReadOf(Provisioner), nil
|
||||
case provisions.PlansBucketOf(Provisioner):
|
||||
return provisions.PlansReadOf(Provisioner), nil
|
||||
}
|
||||
return "", fmt.Errorf("%s is not a bucket this provider keeps or reads", bucket)
|
||||
}
|
||||
@@ -97,7 +101,7 @@ func (b busOf) Delete(_ context.Context, bucket, key string) error {
|
||||
func New(conn *bus.Conn, node string, every time.Duration, logf func(string, ...any)) *provider.Provider {
|
||||
return provider.New(provider.Options{
|
||||
Node: node,
|
||||
Module: Module,
|
||||
Module: Module, Provisioner: Provisioner,
|
||||
Offers: Offers(),
|
||||
Bus: busOf{conn: conn},
|
||||
Every: every,
|
||||
|
||||
@@ -45,14 +45,14 @@ func fill(t *testing.T, template string, entry map[string]any) string {
|
||||
func TestTheRuntimeAnswersAHandedConsumersMcpEndpointThroughTheHelper(t *testing.T) {
|
||||
mesh := mt.New(t)
|
||||
bound := mesh.Bucket(t, "node-tools_bound")
|
||||
plans := mesh.Bucket(t, provisions.PlansBucket)
|
||||
provs := mesh.Bucket(t, provisions.ProvisionsBucket)
|
||||
plans := mesh.Bucket(t, provisions.PlansBucketOf(Provisioner))
|
||||
provs := mesh.Bucket(t, provisions.ProvisionsBucketOf(Provisioner))
|
||||
|
||||
mem := mt.MembershipOf("node-tools", "anchor", false, nil)
|
||||
mem.State = []bus.StateIssued{
|
||||
{Name: "bound", Bucket: "node-tools_bound", Writes: true},
|
||||
{Name: provisions.PlansRead, Bucket: provisions.PlansBucket},
|
||||
{Name: provisions.ProvisionsRead, Bucket: provisions.ProvisionsBucket},
|
||||
{Name: provisions.PlansReadOf(Provisioner), Bucket: provisions.PlansBucketOf(Provisioner)},
|
||||
{Name: provisions.ProvisionsReadOf(Provisioner), Bucket: provisions.ProvisionsBucketOf(Provisioner)},
|
||||
}
|
||||
mesh.Issue(t, mem)
|
||||
|
||||
@@ -176,9 +176,9 @@ func TestTheOfferServesThePortTheManifestServes(t *testing.T) {
|
||||
declared[n] = true
|
||||
}
|
||||
for bucket, want := range map[string]string{
|
||||
provider.BucketOf(Module): "bound",
|
||||
provisions.ProvisionsBucket: "mesh-provisioner.provisions",
|
||||
provisions.PlansBucket: "mesh-provisioner.plans",
|
||||
provider.BucketOf(Module): "bound",
|
||||
provisions.ProvisionsBucketOf(Provisioner): "mesh-provisioner.provisions",
|
||||
provisions.PlansBucketOf(Provisioner): "mesh-provisioner.plans",
|
||||
} {
|
||||
got, err := (busOf{}).state(bucket)
|
||||
if err != nil || got != want || !declared[got] {
|
||||
|
||||
Reference in New Issue
Block a user