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
@@ -85,7 +85,7 @@ func TestTheControlPlaneIsToldWhereTheNodePutTheStoreAndTheBroker(t *testing.T)
if err != nil {
t.Fatal(err)
}
m, err := catalogue.ParseManifest(raw)
m, err := catalogue.Decode(raw)
if err != nil {
t.Fatal(err)
}
@@ -11,7 +11,7 @@ import (
// configForm is a module in the config form, shaped as a real one (inventory's config_move_test).
func configForm(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": "conf", "type": "file", "path": "/etc/` + name + `.json", "mode": "0640",
"content": "{\"level\": \"info\"}", "merge": "json", "takes-config": ["level"]}]}`))
@@ -78,7 +78,7 @@ func aConfiguredMesh(t *testing.T) (*stores, configuredMesh, map[string]map[stri
if err != nil {
t.Fatal(err)
}
m, err := catalogue.ParseManifest(text)
m, err := catalogue.Decode(text)
if err != nil {
t.Fatalf("%s: %v", name, err)
}
+1 -1
View File
@@ -17,7 +17,7 @@ const n8nWithAGroup = `{"module":"n8n","version":"1",
// 1638/AC1: a node that reports the capability gets the module; one that does not has it held, the capability named.
func TestAModuleWithGroupsIsHeldOnANodeThatDoesNotReportTheCapability(t *testing.T) {
m, err := catalogue.ParseManifest([]byte(n8nWithAGroup))
m, err := catalogue.Decode([]byte(n8nWithAGroup))
if err != nil {
t.Fatal(err)
}
+1 -1
View File
@@ -62,7 +62,7 @@ func TestNatsUnassigningIrreplaceableDataRetiresItAndAnEmptyReplacementIsUrgent(
Claims: []catalogue.Claim{{Name: catalogue.BackupSeat, Scope: catalogue.ScopeNode, Serves: []string{"backed-up", "now", "restore"}}}}, built); err != nil {
t.Fatal(err)
}
house, err := catalogue.ParseManifest([]byte(houseManifest))
house, err := catalogue.Decode([]byte(houseManifest))
if err != nil {
t.Fatal(err)
}
+1 -1
View File
@@ -24,7 +24,7 @@ func shelfFor(t *testing.T, manifests ...string) map[string]catalogue.Manifest {
t.Helper()
out := map[string]catalogue.Manifest{}
for _, raw := range manifests {
m, err := catalogue.ParseManifest([]byte(raw))
m, err := catalogue.Decode([]byte(raw))
if err != nil {
t.Fatal(err)
}
+1 -1
View File
@@ -246,7 +246,7 @@ func TestATemplatedModulesTextsAreReadFromItsArchive(t *testing.T) {
// The launchers a key's bundle is resolved with are mesh-sdk's one rule (buildstep.Launchers), the names
// mesh-build-node writes: a TypeScript bundle's entrypoint x.js runs as x.serve.mjs, a Go bundle has none.
func TestALaunchersRuleIsTheBuildModules(t *testing.T) {
m, err := catalogue.ParseManifest([]byte(tsBundle))
m, err := catalogue.Decode([]byte(tsBundle))
if err != nil {
t.Fatal(err)
}
+1 -1
View File
@@ -23,7 +23,7 @@ func leftOutNFS(t *testing.T) catalogue.Resolution {
if err != nil {
t.Fatal(err)
}
m, err := catalogue.ParseManifest(raw)
m, err := catalogue.Decode(raw)
if err != nil {
t.Fatal(err)
}
@@ -73,10 +73,8 @@ func buildFrom(result link.BuildResult) inventory.Build {
kept.Manifest = recordedManifest(result.Manifest, announced)
// The module name comes from the manifest, which only exists when the build got that far.
if len(kept.Manifest) > 0 {
if list, err := judgedWith(result); err == nil {
if m, err := catalogue.ParseManifestWith(kept.Manifest, list); err == nil {
kept.Module = m.Module
}
if m, err := catalogue.Decode(kept.Manifest); err == nil {
kept.Module = m.Module
}
}
return kept
@@ -130,15 +128,7 @@ func takeIn(ctx context.Context, inv *inventory.Inventory, result link.BuildResu
return catalogue.Manifest{}, kept, fmt.Errorf("%s could not build %s:\n%s",
result.On, result.Repository, result.Failed)
}
// Judged first against the list the build was judged against: the catalogue's at the commit built (novox/hq
// ADR 0348 §7), so a module naming a key its own commit adds is read; and again below against the list the
// mesh publishes, before it is registered.
list, err := judgedWith(result)
if err != nil {
return catalogue.Manifest{}, kept, fmt.Errorf("%s built %s (%s), recorded and not registered: %w", result.On,
result.Repository, short(result.Commit), err)
}
manifest, err := catalogue.ParseManifestWith(kept.Manifest, list)
manifest, err := catalogue.Decode(kept.Manifest)
if err != nil {
return catalogue.Manifest{}, kept, fmt.Errorf("%s built %s and what came back is not a manifest: %w",
result.On, result.Repository, err)
@@ -268,16 +258,6 @@ func carriedList(result link.BuildResult) (catalogue.PredefinedList, error) {
return list, nil
}
// judgedWith is the list a build's manifest is first judged against at registration: the catalogue's own at the
// commit built, which its build judged it against, where it carried one; the list kept otherwise.
func judgedWith(result link.BuildResult) (catalogue.PredefinedList, error) {
list, err := carriedList(result)
if err != nil || list != nil {
return list, err
}
return catalogue.PublishedPredefined(), nil
}
// publishPredefined keeps a trunk build's list when it is newer than the one kept, says so, and loads what the
// store keeps then — this build's, or a newer one another controller process kept.
func publishPredefined(ctx context.Context, inv *inventory.Inventory, result link.BuildResult,
+1 -1
View File
@@ -11,7 +11,7 @@ import (
// paths and its manifest alone. mesh-sdk's TypeScript package at its repository's root: a change to its go/ touches no
// module, one to its src/ or its package.json touches it. A module with an artifact naming no paths reads its directory.
func TestAModuleNamingItsPathsIsReadFromThemAlone(t *testing.T) {
m, err := catalogue.ParseManifest([]byte(`{"module":"mesh-sdk","version":"1","build":{"artifacts":[{"name":"lib",
m, err := catalogue.Decode([]byte(`{"module":"mesh-sdk","version":"1","build":{"artifacts":[{"name":"lib",
"kind":"package","language":"typescript","paths":["src","package.json","package-lock.json","tsconfig.json"]}]},
"resources":[]}`))
if err != nil {
@@ -21,7 +21,7 @@ func aMeshWithTheWordsInItsLayers(t *testing.T) (*stores, wordedMesh) {
register(t, open, catalogue.Manifest{Module: "proxy", Version: "1", Provides: catalogue.FromAnywhere("route"),
Receives: map[string]string{"route": "/var/lib/proxy/routes.json"}})
for _, text := range w.Modules {
m, err := catalogue.ParseManifest([]byte(strings.ReplaceAll(string(text), "IMAGE", image)))
m, err := catalogue.Decode([]byte(strings.ReplaceAll(string(text), "IMAGE", image)))
if err != nil {
t.Fatal(err)
}
@@ -20,7 +20,7 @@ import (
func gainedAndPlain(t *testing.T) (plain, gained catalogue.Manifest) {
t.Helper()
plain, err := catalogue.ParseManifest([]byte(`{"module":"mesh-mail","version":"1",
plain, err := catalogue.Decode([]byte(`{"module":"mesh-mail","version":"1",
"own-secrets":{"broker-send":{"path":"/var/lib/mesh-mail/broker-send","owner":"mesh-mail-send"}},
"resources":[{"id":"account","type":"user","name":"mesh-mail-send"}]}`))
if err != nil {
+1 -1
View File
@@ -11,7 +11,7 @@ import (
// declares bus, whose own secret broker-send is where module issue delivers its account (ADR 0436 §2),
// owned by mesh-mail-send, the user resource the process declares, at mode 0600 as every own secret is.
func mailSenderWithProcess() catalogue.Manifest {
m, err := catalogue.ParseManifest([]byte(`{"module":"mesh-mail","version":"1","emits":["mail.send.sent"],
m, err := catalogue.Decode([]byte(`{"module":"mesh-mail","version":"1","emits":["mail.send.sent"],
"own-secrets":{"broker-send":{"path":"/var/lib/mesh-mail/broker-send","owner":"mesh-mail-send"}},
"resources":[{"id":"account","type":"user","name":"mesh-mail-send"},
{"id":"send","type":"process","run":["./mesh-mail","send"],"user":"mesh-mail-send",
+1 -1
View File
@@ -23,7 +23,7 @@ import (
// invoked seat verb), so the account module issue delivers for it can be put through every grant at once.
func mailSenderLiveManifest(t *testing.T) catalogue.Manifest {
t.Helper()
m, err := catalogue.ParseManifest([]byte(`{"module":"mesh-mail","version":"1",
m, err := catalogue.Decode([]byte(`{"module":"mesh-mail","version":"1",
"emits":["mail.send.sent","mail.send.failed"],"state":["sends"],
"streams":[{"name":"mail-sends","events":["mail.send.approved"],"max-age-days":1,"max-mib":8,
"retention":"work-queue","max-deliveries":5}],
+1 -1
View File
@@ -33,7 +33,7 @@ func TestReplay239AModuleNameIsNotTakenOverByAnotherRepository(t *testing.T) {
register := func(raw, repository, path string) {
t.Helper()
m, err := catalogue.ParseManifest([]byte(raw))
m, err := catalogue.Decode([]byte(raw))
if err != nil {
t.Fatal(err)
}
+1 -1
View File
@@ -14,7 +14,7 @@ import (
func TestAProviderElsewhereServesItsOwnComposedName(t *testing.T) {
open := aMesh(t)
ctx := t.Context()
forge, err := catalogue.ParseManifest([]byte(`{"module":"forge","version":"1","requires":["route"],
forge, err := catalogue.Decode([]byte(`{"module":"forge","version":"1","requires":["route"],
"provides":[{"name":"npm-package-registry","scope":"mesh"}],
"contributes":{"route":{"web":{"label":"git","port":3000}}},
"serves":{"npm-package-registry":{"scheme":"http","port":3000,"npm-path":"/api/packages/novox/npm/",
+1 -1
View File
@@ -37,7 +37,7 @@ func TestTheProvidersMachineReceivesTheSharesOfAnS3BucketRequirement(t *testing.
if err := json.Unmarshal(raw, &overlayModule); err != nil {
t.Fatal(err)
}
consumer, err := catalogue.ParseManifest([]byte(filesRequiringShares))
consumer, err := catalogue.Decode([]byte(filesRequiringShares))
if err != nil {
t.Fatal(err)
}
+1 -1
View File
@@ -3,7 +3,7 @@ module github.com/novox/mesh-controller
go 1.26.0
require (
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101005736-7b09de1e5502
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101013805-4dfc11b42431
github.com/jackc/pgx/v5 v5.10.0
github.com/nats-io/nats-server/v2 v2.11.17
github.com/nats-io/nats.go v1.54.0
+2
View File
@@ -4,6 +4,8 @@ git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261030001116-2da0de75c3f0 h1:lKU3HjNX
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261030001116-2da0de75c3f0/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101005736-7b09de1e5502 h1:XndvkzyAFNde/821lEfYObqMTURzmve/w9Ks+QrBBJ8=
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101005736-7b09de1e5502/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101013805-4dfc11b42431 h1:3Yv1Jx+/g6xTIKGywYsp6ZWJB4w2oYG/qQSb5ARmmm8=
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101013805-4dfc11b42431/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0=
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+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))
}
+1 -1
View File
@@ -9,7 +9,7 @@ a second place to clean besides the catalogue itself.
mesh-catalog f3a57dcc56fb6c198095cafd11d0decff9f720c4 modules/*/module.json, modules/*/files, modules/*/templates, predefined.json
mesh-host 9d9e3a46c4f5943cfffb413d962ce48b75e2fd39 examples/foundation-first-node.lock
mesh-sdk 7b09de1e5502231fcd7e41a61086b44f5d7ad545 conformance/events/module-event.json
mesh-sdk 4dfc11b42431627d19ed4e1643dff7860084fbbd conformance/events/module-event.json
To move them, from this repository's root, with the two repositories checked out beside it: