Decode manifests in tests and pin the mesh-sdk that no longer holds the judge

Issue 1585, S18/S19: the judge's tests live in mesh-delivery now, so an assertion that only tested judging goes
and every test that builds a manifest decodes it.

Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
This commit is contained in:
2026-11-01 02:40:39 +01:00
parent b51105908a
commit a6386ff23a
31 changed files with 36 additions and 108 deletions
+1 -52
View File
@@ -105,11 +105,7 @@ func theCataloguesEvents(t *testing.T) ([]AnEmitter, []AConsumer, []DeclaredSeat
emitters = append(emitters, *emitter)
}
if consumer != nil {
kept, setAside := setAsideRetiredSeats(*consumer)
for _, note := range setAside {
t.Log(note)
}
consumers = append(consumers, kept)
consumers = append(consumers, *consumer)
}
seats = append(seats, declared...)
}
@@ -119,53 +115,6 @@ func theCataloguesEvents(t *testing.T) ([]AnEmitter, []AConsumer, []DeclaredSeat
return emitters, consumers, seats
}
// setAsideRetiredSeats takes out of a consumer the events of a seat the mesh has retired, and says each one.
// The check judges against the catalogue's trunk (ADR 0484 clause 4), and a group that retires a seat while
// its catalogue pull request drops the consume (ADR 0524 section 5) meets the trunk still holding it: against
// that catalogue the seat is gone and the subscription falls back to a module subject nobody owns. It is set
// aside and logged, never silently dropped; an unknown seat that is not retired is still judged.
func setAsideRetiredSeats(c AConsumer) (AConsumer, []string) {
kept := AConsumer{Module: c.Module}
var notes []string
for _, want := range c.Consumes {
seat, event, named := strings.Cut(want, ".")
if replacement, retired := catalogue.RetiredSeats[seat]; named && retired {
notes = append(notes, c.Module+" still consumes "+seat+"."+event+"; the seat is retired (its work is "+
replacement+"); the catalogue drops it in the same change (ADR 0524 §5), and the check judges against the catalogue's trunk (ADR 0484 clause 4)")
continue
}
kept.Consumes = append(kept.Consumes, want)
}
return kept, notes
}
func TestARetiredSeatsConsumeIsSetAsideAndAnUnknownOneIsNot(t *testing.T) {
var retired string
for name := range catalogue.RetiredSeats {
retired = name
break
}
if retired == "" {
t.Skip("no seat is retired")
}
kept, notes := setAsideRetiredSeats(AConsumer{Module: "m",
Consumes: []string{retired + ".built", "no-such-seat.built", "plain"}})
if len(notes) != 1 || !strings.Contains(notes[0], retired+".built") {
t.Fatalf("the retired seat's consume was not set aside and said: %v", notes)
}
if strings.Join(kept.Consumes, ",") != "no-such-seat.built,plain" {
t.Fatalf("what stays to be judged is wrong: %v", kept.Consumes)
}
if bad := Disagreements([]AnEmitter{{Module: "other", Emits: []string{"x"}}},
[]AConsumer{kept}, nil); len(bad) != 0 {
t.Fatalf("unexpected: %v", bad)
}
if bad := Disagreements([]AnEmitter{{Module: "no-such-seat", Emits: []string{"x"}}},
[]AConsumer{kept}, nil); len(bad) != 1 {
t.Fatalf("an unknown, non-retired consume no longer fails: %v", bad)
}
}
// **Do the derived subjects meet, not just the names?**
//
// The check above compares what a consumer asks for against what an emitter says it emits, by name. It
+1 -1
View File
@@ -108,7 +108,7 @@ func (s ModuleStream) Stream() Stream {
// QueueOwner is the one process of a module that is the durable consumer of one of its own work-queue
// streams (novox/hq ADR 0436 §1, §2, §6): named in that process's bus.queues, and checked at registration
// to be the only one (catalogue.WorkQueueStreamProblems).
// to be the only one (the indexer's judge).
type QueueOwner struct {
// Process is the process resource's id — its bus account's name, with the node and module (novox/hq ADR
// 0436 §2).
+1 -1
View File
@@ -60,7 +60,7 @@ func TestTheAsksLabBus(t *testing.T) {
}
var manifests []catalogue.Manifest
read := func(raw []byte, from string) {
m, err := catalogue.ParseManifest(raw)
m, err := catalogue.Decode(raw)
if err != nil {
t.Fatalf("%s: %v", from, err)
}
+1 -1
View File
@@ -476,7 +476,7 @@ func streamsOf(m catalogue.Manifest) []broker.ModuleStream {
// queueOwnersOf is every work-queue stream of a module's own that one of its processes names in bus.queues,
// with that process's id and the stream's declared max-deliveries (novox/hq ADR 0436 §1, §2, §6). In
// resource order, so composition is repeatable; a queue naming a stream the module does not own, or one two
// processes name, is caught at registration (catalogue.WorkQueueStreamProblems) and never reaches here.
// processes name, is caught at registration (the indexer's judge) and never reaches here.
func queueOwnersOf(m catalogue.Manifest) []broker.QueueOwner {
buses := m.ProcessBuses()
if len(buses) == 0 {
+1 -1
View File
@@ -15,7 +15,7 @@ import (
// configured is a module in the config form: one value a mergeable file takes, and a directory to place.
func configured(t *testing.T, name string) catalogue.Manifest {
t.Helper()
m, err := catalogue.ParseManifest([]byte(`{"module": "` + name + `", "version": "1",
m, err := catalogue.Decode([]byte(`{"module": "` + name + `", "version": "1",
"config": {"level": {"type": "string", "description": "how much it says", "default": "info"}},
"resources": [{"id": "data", "type": "directory", "mode": "0750"}, {"id": "conf", "type": "file", "path": "/etc/` + name + `.json", "mode": "0640",
"content": "{\"level\": \"info\"}", "merge": "json", "takes-config": ["level"]}]}`))
+2 -2
View File
@@ -44,12 +44,12 @@ func TestOnlyTheServingControllerMayAnswerRootFree(t *testing.T) {
if err != nil {
t.Fatal(err)
}
controller, err := catalogue.ParseManifest(raw)
controller, err := catalogue.Decode(raw)
if err != nil {
t.Fatal(err)
}
parse := func(s string) catalogue.Manifest {
m, err := catalogue.ParseManifest([]byte(s))
m, err := catalogue.Decode([]byte(s))
if err != nil {
t.Fatal(err)
}
@@ -47,13 +47,10 @@ func TestAStoredBuildWithASilentMergeableFileIsStillReadAndComposed(t *testing.T
if err != nil || len(raw) == 0 {
t.Fatalf("the stored build is not read again: %d bytes, %v", len(raw), err)
}
m, err := catalogue.ParseManifest(raw)
m, err := catalogue.Decode(raw)
if err != nil {
t.Fatalf("the stored manifest is not read again: %v", err)
}
if written := catalogue.WrittenSettingsProblems(m); len(written) != 1 {
t.Fatalf("the rule this build predates should name its accounts file where it is written: %v", written)
}
// And composed, in today's form: the accounts file still takes its layer's keys.
with := catalogue.Rendering{Settings: catalogue.SettingsBy{"mail-client": {{From: "workstation",
+1 -1
View File
@@ -22,7 +22,7 @@ var adr0367Families = []string{`"mesh-knowledge.reviewed"`, `"mesh-delivery.tran
func composeWaits(t *testing.T, families []string, people map[string][]string) (granted, issued []string) {
t.Helper()
parse := func(s string) catalogue.Manifest {
m, err := catalogue.ParseManifest([]byte(s))
m, err := catalogue.Decode([]byte(s))
if err != nil {
t.Fatal(err)
}
@@ -18,7 +18,7 @@ func TestTheControllerIsAProcessAndNoContainer(t *testing.T) {
if err != nil {
t.Fatal(err)
}
m, err := ParseManifest(raw)
m, err := Decode(raw)
if err != nil {
t.Fatalf("the controller's own manifest does not parse:\n%v", err)
}
+2 -2
View File
@@ -18,7 +18,7 @@ func TestTheControllersOwnManifestClaimsItsSeat(t *testing.T) {
if err != nil {
t.Fatalf("the controller's own manifest is unreadable: %v", err)
}
m, err := ParseManifest(raw)
m, err := Decode(raw)
if err != nil {
t.Fatalf("the controller's own manifest does not parse: %v", err)
}
@@ -41,7 +41,7 @@ func TestTheControlPlanesOwnAddressesFollowTheNodesPorts(t *testing.T) {
if err != nil {
t.Fatal(err)
}
m, err := ParseManifest(raw)
m, err := Decode(raw)
if err != nil {
t.Fatalf("the control plane's own manifest does not parse:\n%v", err)
}
+1 -1
View File
@@ -34,7 +34,7 @@ func TestEveryManifestInUseClaimsASeatTheMeshDefines(t *testing.T) {
if raw, err = os.ReadFile(path); err != nil {
t.Fatal(err)
}
m, err = catalogue.ParseManifest(raw)
m, err = catalogue.Decode(raw)
} else {
m, err = catalogue.ReadTreeManifest(root, filepath.Dir(path))
}