2536 reads of mesh-controller.lease were refused on 2026-10-30 (mesh-vault, mesh-grants, the assigner, artifact-store-tools, the watchman, mesh-config). The controller composed the bus's users with its own copy of a reader-less judgement (internal/broker ReadsAnnounced), which knows no named readers: the lease is announced readable by nobody and read by the parts named for it (ADR 0547 clause 9, ADR 0561 §3). The copy is deleted; BusRecords judges each read for its module with buscompose.ReadsAnnouncedBy. Each refusal was also printed on every composition, about 420 times a read; it is now said once per process. mesh-config's read of the lease stays refused: it reads the lease for its take-over (hand-back ends at the lease write, ADR 0561 §3) and is not among the named readers. That is mesh-sdk's NamedReaders, routed to the lead. Quick fix: mark the lease readable in the controller's announcement (tried and reverted: it would open the lease to every module and contradict ADR 0561 §3). Thorough fix: one judgement, the SDK's, for every composer. Chose thorough. Research 072 piece: 03-domains, mesh-grants (bus membership and grants leave the controller): the controller composes reads with the same SDK function the grants part uses.
44 lines
2.0 KiB
Go
44 lines
2.0 KiB
Go
package inventory
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/announce"
|
|
"github.com/novox/mesh-controller/internal/broker"
|
|
)
|
|
|
|
// Sweep 2026-10-30 (issue 774): a read is judged for its reader. The controller's lease, which its announcement marks
|
|
// readable by nobody, is granted to the parts named for it (ADR 0561 §3) and refused to every other; a state its owner
|
|
// announced readable is granted; one it keeps and did not is refused; an owner that announced nothing is read as before.
|
|
// Each refusal is said, and a refusal already said is not said again.
|
|
func TestAReadIsJudgedForItsReader(t *testing.T) {
|
|
announced := map[string]announce.States{
|
|
"mesh-controller": broker.ControllerAnnouncement("novox"),
|
|
"owner": {Module: "owner", States: []announce.State{{Name: "open", Readable: true}, {Name: "closed"}}},
|
|
}
|
|
for name, c := range map[string]struct {
|
|
reader, read string
|
|
granted bool
|
|
}{
|
|
"the lease, by the vault": {"mesh-vault", "mesh-controller.lease", true},
|
|
"the lease, by the grants part": {"mesh-grants", "mesh-controller.lease", true},
|
|
"the lease, by a module not named": {"mesh-config", "mesh-controller.lease", false},
|
|
"a readable state": {"reader", "owner.open", true},
|
|
"a state kept and not readable": {"reader", "owner.closed", false},
|
|
"an owner that announced nothing": {"reader", "quiet.any", true},
|
|
"a mirror the controller marks open": {"pacman", "mesh-controller.declared-packages", true},
|
|
} {
|
|
assigned := map[string][]broker.Declared{"novox": {{Module: c.reader, Reads: []string{c.read}}}}
|
|
var said []string
|
|
judgeReads(assigned, announced, func(module, node, read string) { said = append(said, read) })
|
|
d := assigned["novox"][0]
|
|
if slices.Contains(d.Reads, c.read) != c.granted || slices.Contains(d.ReadsRefused, c.read) == c.granted {
|
|
t.Errorf("%s: granted %v, refused %v", name, d.Reads, d.ReadsRefused)
|
|
}
|
|
if (len(said) == 1) == c.granted {
|
|
t.Errorf("%s: said %v", name, said)
|
|
}
|
|
}
|
|
}
|