diff --git a/contracts/go/seats/meshcatalog/contract.go b/contracts/go/seats/meshcatalog/contract.go index ce517dcb..9bbbb4b5 100644 --- a/contracts/go/seats/meshcatalog/contract.go +++ b/contracts/go/seats/meshcatalog/contract.go @@ -590,17 +590,19 @@ type ConfigCandidatesByPullValueDeclaresValueValue struct { Default any `json:"default"` Description string `json:"description,omitempty"` // the allowed values - Enum any `json:"enum,omitempty"` - Kind string `json:"kind"` - Maximum float64 `json:"maximum,omitempty"` - 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"` + Enum any `json:"enum,omitempty"` + Kind string `json:"kind"` + // a declared bound; 0 is a bound, absent is none + Maximum any `json:"maximum,omitempty"` + // a declared bound; 0 is a bound, absent is none + Minimum any `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 . diff --git a/contracts/go/seats/meshcatalog/contract_test.go b/contracts/go/seats/meshcatalog/contract_test.go index 22bea547..b6d95b15 100644 --- a/contracts/go/seats/meshcatalog/contract_test.go +++ b/contracts/go/seats/meshcatalog/contract_test.go @@ -33,6 +33,12 @@ func TestFixtures(t *testing.T) { 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}", diff --git a/contracts/seats/mesh-catalog/fixtures/states.json b/contracts/seats/mesh-catalog/fixtures/states.json index 0ad6086b..43af3306 100644 --- a/contracts/seats/mesh-catalog/fixtures/states.json +++ b/contracts/seats/mesh-catalog/fixtures/states.json @@ -81,6 +81,26 @@ } } }, + { + "name": "a pull request's configuration state whose bounds are declared 0 (a zero is a bound, not none)", + "of": "state:config-candidates/", + "given": { + "v": 1, + "pull": "novox/mesh-catalog#1", + "head": "cccccccccccccccccccccccccccccccccccccccc", + "declares": { + "nats": { + "limit": { + "kind": "setting", + "default": 0, + "why": "a bound", + "minimum": 0, + "maximum": 0 + } + } + } + } + }, { "name": "a published Go module", "of": "state:packages/", diff --git a/contracts/seats/mesh-catalog/seat.json b/contracts/seats/mesh-catalog/seat.json index 08301037..13f861f1 100644 --- a/contracts/seats/mesh-catalog/seat.json +++ b/contracts/seats/mesh-catalog/seat.json @@ -165,7 +165,7 @@ }, { "name": "seat-definitions", - "description": "The seat list (ADR 0636 \u00a74): with no seat, every trunk seat with its digest and the revision of the list; with a seat, that trunk definition resolved with the parts it includes. Reads only.", + "description": "The seat list (ADR 0636 §4): with no seat, every trunk seat with its digest and the revision of the list; with a seat, that trunk definition resolved with the parts it includes. Reads only.", "optional": true, "input": { "properties": { @@ -244,7 +244,7 @@ } } ], - "description": "The catalog of the mesh: every module the trunk holds with its manifest, fingerprint and verdict, the packages published, and the seat list (ADR 0636 \u00a71, \u00a74).", + "description": "The catalog of the mesh: every module the trunk holds with its manifest, fingerprint and verdict, the packages published, and the seat list (ADR 0636 §1, §4).", "family": { "name": "mesh-catalog.events", "max-age-days": 7 @@ -823,10 +823,18 @@ "description": "the allowed values" }, "minimum": { - "type": "number" + "type": [ + "number", + "null" + ], + "description": "a declared bound; 0 is a bound, absent is none" }, "maximum": { - "type": "number" + "type": [ + "number", + "null" + ], + "description": "a declared bound; 0 is a bound, absent is none" }, "pattern": { "type": "string" diff --git a/contracts/ts/seats/meshcatalog/src/index.ts b/contracts/ts/seats/meshcatalog/src/index.ts index 92b3b5a4..096581e6 100644 --- a/contracts/ts/seats/meshcatalog/src/index.ts +++ b/contracts/ts/seats/meshcatalog/src/index.ts @@ -426,8 +426,10 @@ export interface ConfigCandidatesByPullValueDeclaresValueValue { /** the allowed values */ "enum"?: unknown; "kind": string; - "maximum"?: number; - "minimum"?: number; + /** a declared bound; 0 is a bound, absent is none */ + "maximum"?: unknown; + /** a declared bound; 0 is a bound, absent is none */ + "minimum"?: unknown; "pattern"?: string; "predefined"?: string; "required"?: boolean;