From 349a5774cd7ef2e786425f3c176a976d2882086e Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 1 Nov 2026 02:29:48 +0100 Subject: [PATCH] =?UTF-8?q?checks/credentialform=20stops=20judging=20crede?= =?UTF-8?q?ntial=20forms,=20the=20checker's=20judge=20runs=20that=20rule?= =?UTF-8?q?=20(ADR=200578=20=C2=A72)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL --- checks/credentialform/go.mod | 11 ++++++++++- checks/credentialform/go.sum | 14 ++++++++++++++ checks/credentialform/main.go | 16 +++++++++------- checks/credentialform/main_test.go | 16 ++++++++-------- checks/credentialform/reads-outside | 2 +- 5 files changed, 42 insertions(+), 17 deletions(-) diff --git a/checks/credentialform/go.mod b/checks/credentialform/go.mod index 1793672d..e2196d22 100644 --- a/checks/credentialform/go.mod +++ b/checks/credentialform/go.mod @@ -2,4 +2,13 @@ module checks/credentialform go 1.26.0 -require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261030001116-2da0de75c3f0 +require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101012031-7cab079e2ec3 + +require ( + github.com/klauspost/compress v1.20.0 // indirect + github.com/nats-io/nats.go v1.54.0 // indirect + github.com/nats-io/nkeys v0.4.16 // indirect + github.com/nats-io/nuid v1.0.1 // indirect + golang.org/x/crypto v0.57.0 // indirect + golang.org/x/sys v0.48.0 // indirect +) diff --git a/checks/credentialform/go.sum b/checks/credentialform/go.sum index f8bfbd2b..078bf3ee 100644 --- a/checks/credentialform/go.sum +++ b/checks/credentialform/go.sum @@ -1,2 +1,16 @@ git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261030001116-2da0de75c3f0 h1:lKU3HjNXGiVbLW2hUgFjU/TMTUYMlNnnmZxG5T7biQA= 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.20261101012031-7cab079e2ec3 h1:an2f0MLx9OhaDLu5i51OMPBbuGwX+aoTzqOkFLMpVfE= +git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261101012031-7cab079e2ec3/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY= +github.com/klauspost/compress v1.20.0 h1:a3C1ke2ohxFymNlb2HWAHjDeKCI90scRskErZkR0ezA= +github.com/klauspost/compress v1.20.0/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= +github.com/nats-io/nats.go v1.54.0 h1:vsXoOxjHp/GmPUN+EcI7uOf/uB+iAP+kEsAFNQN0yzA= +github.com/nats-io/nats.go v1.54.0/go.mod h1:y+DZoD1oBOYfZTU681eTUiUjI0vbqYGixNVFHcjHJ0k= +github.com/nats-io/nkeys v0.4.16 h1:rd5oAuLOb8mnAycB0xleuEBNS1pVVnN0fv/FF34Eypg= +github.com/nats-io/nkeys v0.4.16/go.mod h1:llLgWoI0o4z/Q57q2R1kHfmocyhGV6VG/U18Glg1Afs= +github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= +golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= +golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= +golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= diff --git a/checks/credentialform/main.go b/checks/credentialform/main.go index 324175e3..55892b0b 100644 --- a/checks/credentialform/main.go +++ b/checks/credentialform/main.go @@ -1,6 +1,8 @@ -// Package credentialform refuses an offer that does not say the form of its credential: an own secret, an issuer, or -// `form` pair or none (the lead, 2026-10-29). It reads every modules/*/module.json through mesh-sdk's -// CredentialFormProblems. +// Package credentialform refuses what the catalogue's tree holds about credentials and routes that no manifest judge +// sees: a module that provides and keeps a `bound` state the provisioner does not read, and a route received as a file. +// It judges no offer's credential form: that rule (an own secret, an issuer, or `form` pair or none; the lead, +// 2026-10-29) is part of the catalogue's rules, which the checker's judge runs on every change (CatalogueProblems, +// novox/hq ADR 0578 ยง2); this package called it itself until 2026-11. // // It refuses a route received as a file too (issue 774, research 072 row 34, the operator on 2026-10-31: "there is only // 1 path, the other is simply deprecated/invalid"): a route is a provision, served from the seat mesh-provisioner's @@ -20,7 +22,8 @@ import ( "git.novox.be/novox/mesh-sdk/go/catalogue" ) -// Problems is every offer of the manifests under root/modules that says no credential form, one line each. +// Problems is every module of the manifests under root/modules that keeps a `bound` state the provisioner does not read, +// and every route received as a file, one line each. func Problems(root string) ([]string, error) { files, err := filepath.Glob(filepath.Join(root, "modules", "*", "module.json")) if err != nil { @@ -36,11 +39,10 @@ func Problems(root string) ([]string, error) { if err != nil { return nil, err } - var m catalogue.Manifest - if err := json.Unmarshal(raw, &m); err != nil { + m, err := catalogue.Decode(raw) + if err != nil { return nil, fmt.Errorf("%s: %w", f, err) } - out = append(out, catalogue.CredentialFormProblems(m)...) if _, received := m.Receives["route"]; received { receiving = append(receiving, m.Module) } else if _, listed := stillReceivingRoutes[m.Module]; listed { diff --git a/checks/credentialform/main_test.go b/checks/credentialform/main_test.go index aebbb6b3..08734aa7 100644 --- a/checks/credentialform/main_test.go +++ b/checks/credentialform/main_test.go @@ -22,9 +22,10 @@ func aCatalogue(t *testing.T, manifests map[string]string) string { return root } -// An offer that says no form is refused and named; one that says pair, none or an own secret passes; a route received -// as a file is refused but for the module still moving off it; and the real catalogue is clean. -func TestEveryOfferSaysTheFormOfItsCredential(t *testing.T) { +// A binder the provisioner does not read is refused and named; an offer that says no form is the judge's to refuse, not +// this check's; a route received as a file is refused but for the module still moving off it; and the real catalogue is +// clean. +func TestNoBinderIsUnreadAndNoRouteIsReceivedAsAFile(t *testing.T) { root := aCatalogue(t, map[string]string{ "silent": `{"module":"silent","provides":[{"name":"thing","scope":"mesh"}]}`, "binder": `{"module":"binder","provides":[{"name":"d","credential":{"form":"pair"}}],"state":["bound"]}`, @@ -39,16 +40,15 @@ func TestEveryOfferSaysTheFormOfItsCredential(t *testing.T) { if err != nil { t.Fatal(err) } - if len(got) != 3 || !strings.Contains(got[0], `silent provides "thing"`) || - !strings.Contains(got[1], "binder") || !strings.Contains(got[1], "mesh-provisioner") || - !strings.HasPrefix(got[2], "old-proxy receives route") || !strings.Contains(got[2], "old-proxy, route-adapter") { - t.Fatalf("refused %v, wanted the silent offer, the binder the provisioner does not read and the received route", got) + if len(got) != 2 || !strings.Contains(got[0], "binder") || !strings.Contains(got[0], "mesh-provisioner") || + !strings.HasPrefix(got[1], "old-proxy receives route") || !strings.Contains(got[1], "old-proxy, route-adapter") { + t.Fatalf("refused %v, wanted the binder the provisioner does not read and the received route", got) } real, err := Problems(filepath.Join("..", "..")) if err != nil { t.Fatal(err) } if len(real) != 0 { - t.Fatalf("the catalogue has offers with no credential form:\n%s", strings.Join(real, "\n")) + t.Fatalf("the catalogue has binders or routes it must not:\n%s", strings.Join(real, "\n")) } } diff --git a/checks/credentialform/reads-outside b/checks/credentialform/reads-outside index 8ff16290..865fe6ac 100644 --- a/checks/credentialform/reads-outside +++ b/checks/credentialform/reads-outside @@ -1,3 +1,3 @@ # What these tests read outside their package, as paths from the repository's root (issue 1936). -# every manifest, for what each offer says of its credential's form. +# every manifest, for its bound state and its received routes. modules/*/module.json