From bf642c45b7d6e4c3f81f77c7f8acb200bc175543 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 19 Nov 2026 23:05:21 +0100 Subject: [PATCH] =?UTF-8?q?mesh-delivery:=20the=20old=20hand-kept=20mesh-c?= =?UTF-8?q?atalog=20contract=20copy=20loses=20the=20config-candidates=20la?= =?UTF-8?q?yout=20(issue=201982;=20ADR=200681=20=C2=A72)=20The=20copy=20un?= =?UTF-8?q?der=20contracts/go/seats/meshcatalog=20still=20held=20the=20lay?= =?UTF-8?q?out,=20its=20key=20helpers,=20its=20constant=20and=20two=20fixt?= =?UTF-8?q?ure=20cases;=20nothing=20in=20contracts/=20or=20sdk/=20uses=20t?= =?UTF-8?q?hem,=20and=20ADR=200681=20=C2=A77's=20check=20greps=20the=20tru?= =?UTF-8?q?nk=20for=20the=20name.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: ADR 0681 §2 (mesh-sdk keeps no config-candidate layout; the contract keeps none), §7. --- contracts/go/seats/meshcatalog/contract.go | 77 ++----------------- .../go/seats/meshcatalog/contract_test.go | 12 --- 2 files changed, 6 insertions(+), 83 deletions(-) diff --git a/contracts/go/seats/meshcatalog/contract.go b/contracts/go/seats/meshcatalog/contract.go index 32870c7c..4c98ac35 100644 --- a/contracts/go/seats/meshcatalog/contract.go +++ b/contracts/go/seats/meshcatalog/contract.go @@ -58,13 +58,12 @@ const SubjectManifestAccepted = "mesh.seat.mesh-catalog.event.manifest-accepted" const SubjectManifestRefused = "mesh.seat.mesh-catalog.event.manifest-refused" const ( - StateManifests = "manifests" - StateModules = "modules" - StateCandidates = "candidates" - StateVerdicts = "verdicts" - StatePredefined = "predefined" - StateConfigCandidates = "config-candidates" - StatePackages = "packages" + StateManifests = "manifests" + StateModules = "modules" + StateCandidates = "candidates" + StateVerdicts = "verdicts" + StatePredefined = "predefined" + StatePackages = "packages" ) // ManifestsByDigestKey is the key of one value of the state manifests under the form "". @@ -221,37 +220,6 @@ func DecodePredefinedByListValue(raw []byte) (PredefinedByListValue, error) { return v, nil } -// ConfigCandidatesByPullKey is the key of one value of the state config-candidates under the form "". -func ConfigCandidatesByPullKey(pull string) string { return pull } - -// ParseConfigCandidatesByPullKey reads the parts of a key of the form "", in the order of the form; the last result is false for a key of another form. -func ParseConfigCandidatesByPullKey(key string) (string, bool) { - rest := key - if rest == "" { - return "", false - } - v0 := rest - rest = "" - if rest != "" { - return "", false - } - return v0, true -} - -// DecodeConfigCandidatesByPullValue reads one value of the state config-candidates under the form "", refusing a field ConfigCandidatesByPullValue does not know and any text after the value. -func DecodeConfigCandidatesByPullValue(raw []byte) (ConfigCandidatesByPullValue, error) { - var v ConfigCandidatesByPullValue - dec := json.NewDecoder(bytes.NewReader(raw)) - dec.DisallowUnknownFields() - if err := dec.Decode(&v); err != nil { - return v, err - } - if dec.More() { - return v, errors.New("text after the value") - } - return v, nil -} - // PackagesByModuleKey is the key of one value of the state packages under the form "". func PackagesByModuleKey(module string) string { return module } @@ -584,39 +552,6 @@ type PredefinedByListValue struct { V int64 `json:"v,omitempty"` } -// ConfigCandidatesByPullValueDeclaresValueValue is a type of the contract. -type ConfigCandidatesByPullValueDeclaresValueValue struct { - // the default - Default any `json:"default"` - Description string `json:"description,omitempty"` - // the allowed values - Enum any `json:"enum,omitempty"` - Kind string `json:"kind"` - // a declared bound; 0 is a bound, absent is none - Maximum *float64 `json:"maximum,omitempty"` - // a declared bound; 0 is a bound, absent is none - Minimum *float64 `json:"minimum,omitempty"` - Pattern string `json:"pattern,omitempty"` - Predefined string `json:"predefined,omitempty"` - Required bool `json:"required,omitempty"` - Runtime bool `json:"runtime,omitempty"` - Trusted bool `json:"trusted,omitempty"` - Type string `json:"type,omitempty"` - Why string `json:"why"` -} - -// ConfigCandidatesByPullValue is one value of the state config-candidates under the key . -type ConfigCandidatesByPullValue struct { - // when (RFC 3339 time) - At *time.Time `json:"at,omitempty"` - // module to key to declaration - Declares map[string]map[string]ConfigCandidatesByPullValueDeclaresValueValue `json:"declares"` - Head string `json:"head"` - Pull string `json:"pull"` - // the layout version - V int64 `json:"v,omitempty"` -} - // PackagesByModuleValuePackagesItem is a type of the contract. type PackagesByModuleValuePackagesItem struct { Digest string `json:"digest"` diff --git a/contracts/go/seats/meshcatalog/contract_test.go b/contracts/go/seats/meshcatalog/contract_test.go index b6d95b15..8c962d92 100644 --- a/contracts/go/seats/meshcatalog/contract_test.go +++ b/contracts/go/seats/meshcatalog/contract_test.go @@ -27,18 +27,6 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v VerdictsByDigestValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "the predefined list", subject: "", given: "{\"commit\":\"cccccccccccccccccccccccccccccccccccccccc\",\"list\":{\"streams\":[]},\"v\":1}", wire: "{\"commit\":\"cccccccccccccccccccccccccccccccccccccccc\",\"list\":{\"streams\":[]},\"v\":1}", decode: func(b []byte) (any, error) { var v PredefinedByListValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, - {name: "a pull request's configuration", subject: "", given: "{\"declares\":{\"nats\":{\"limit\":{\"default\":1,\"kind\":\"setting\",\"why\":\"a bound\"}}},\"head\":\"cccccccccccccccccccccccccccccccccccccccc\",\"pull\":\"novox/mesh-catalog#1\",\"v\":1}", wire: "{\"declares\":{\"nats\":{\"limit\":{\"default\":1,\"kind\":\"setting\",\"why\":\"a bound\"}}},\"head\":\"cccccccccccccccccccccccccccccccccccccccc\",\"pull\":\"novox/mesh-catalog#1\",\"v\":1}", - decode: func(b []byte) (any, error) { - var v ConfigCandidatesByPullValue - err := json.Unmarshal(b, &v) - return v, err - }, subjectIs: nil}, - {name: "a pull request's configuration state whose bounds are declared 0 (a zero is a bound, not none)", subject: "", given: "{\"declares\":{\"nats\":{\"limit\":{\"default\":0,\"kind\":\"setting\",\"maximum\":0,\"minimum\":0,\"why\":\"a bound\"}}},\"head\":\"cccccccccccccccccccccccccccccccccccccccc\",\"pull\":\"novox/mesh-catalog#1\",\"v\":1}", wire: "{\"declares\":{\"nats\":{\"limit\":{\"default\":0,\"kind\":\"setting\",\"maximum\":0,\"minimum\":0,\"why\":\"a bound\"}}},\"head\":\"cccccccccccccccccccccccccccccccccccccccc\",\"pull\":\"novox/mesh-catalog#1\",\"v\":1}", - decode: func(b []byte) (any, error) { - var v ConfigCandidatesByPullValue - err := json.Unmarshal(b, &v) - return v, err - }, subjectIs: nil}, {name: "a published Go module", subject: "", given: "{\"commit\":\"cccccccccccccccccccccccccccccccccccccccc\",\"module\":\"git.novox.be/novox/mesh-sdk/go\",\"packages\":[{\"digest\":\"ab\",\"package\":\"git.novox.be/novox/mesh-sdk/go/keys\"}],\"repository\":\"novox/mesh-sdk\",\"v\":1}", wire: "{\"commit\":\"cccccccccccccccccccccccccccccccccccccccc\",\"module\":\"git.novox.be/novox/mesh-sdk/go\",\"packages\":[{\"digest\":\"ab\",\"package\":\"git.novox.be/novox/mesh-sdk/go/keys\"}],\"repository\":\"novox/mesh-sdk\",\"v\":1}", decode: func(b []byte) (any, error) { var v PackagesByModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, {name: "a package series", subject: "", given: "{\"name\":\"go-keys\",\"series\":\"0.1\",\"v\":1}", wire: "{\"name\":\"go-keys\",\"series\":\"0.1\",\"v\":1}",