From 226a0978116c7d0d638a10fff722198316a30dc0 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 02:29:04 +0100 Subject: [PATCH] contracts-placement-build: the verb placement shows each row's build beside its branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 47 H ยง750, H-A-39 --- go/seats/meshmoduleassigner/contract.go | 8 ++++--- go/seats/meshmoduleassigner/contract_test.go | 2 ++ .../mesh-module-assigner/fixtures/verbs.json | 23 +++++++++++++++++++ seats/mesh-module-assigner/seat.json | 6 ++++- ts/seats/meshmoduleassigner/index.d.ts | 4 +++- 5 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 seats/mesh-module-assigner/fixtures/verbs.json diff --git a/go/seats/meshmoduleassigner/contract.go b/go/seats/meshmoduleassigner/contract.go index c260a03..5a4e6c1 100644 --- a/go/seats/meshmoduleassigner/contract.go +++ b/go/seats/meshmoduleassigner/contract.go @@ -412,8 +412,10 @@ type Holding struct { // ModulePlacement is the nodes that run a module from one watched branch. type ModulePlacement struct { - Branch string `json:"branch"` - Nodes []string `json:"nodes"` + Branch string `json:"branch"` + // the fingerprint of the build these nodes run from the branch; absent, the newest delivered of the branch (design 47 H 750, H-A-39): one row per branch and build + Build string `json:"build,omitempty"` + Nodes []string `json:"nodes"` } // NodeDecided is what a person decides of a node; no secret and no key material. @@ -647,7 +649,7 @@ type PlacementInput struct { // PlacementAnswer is what placement answers. type PlacementAnswer struct { - // one per branch, the nodes that run the module from it + // one per branch and build, the nodes that run the module from it Placements []ModulePlacement `json:"placements"` } diff --git a/go/seats/meshmoduleassigner/contract_test.go b/go/seats/meshmoduleassigner/contract_test.go index b083e81..45a0fd4 100644 --- a/go/seats/meshmoduleassigner/contract_test.go +++ b/go/seats/meshmoduleassigner/contract_test.go @@ -79,6 +79,8 @@ func TestFixtures(t *testing.T) { err := json.Unmarshal(b, &v) return v, err }, subjectIs: nil}, + {name: "placement answers a row per branch and build, the build beside the branch", subject: "", given: "{\"placements\":[{\"branch\":\"main\",\"build\":\"0123456789ab\",\"nodes\":[\"workstation\"]},{\"branch\":\"main\",\"nodes\":[\"laptop\"]}]}", wire: "{\"placements\":[{\"branch\":\"main\",\"build\":\"0123456789ab\",\"nodes\":[\"workstation\"]},{\"branch\":\"main\",\"nodes\":[\"laptop\"]}]}", + decode: func(b []byte) (any, error) { var v PlacementAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil}, } for _, c := range cases { v, err := c.decode([]byte(c.given)) diff --git a/seats/mesh-module-assigner/fixtures/verbs.json b/seats/mesh-module-assigner/fixtures/verbs.json new file mode 100644 index 0000000..245cb44 --- /dev/null +++ b/seats/mesh-module-assigner/fixtures/verbs.json @@ -0,0 +1,23 @@ +[ + { + "name": "placement answers a row per branch and build, the build beside the branch", + "of": "verb:placement.answer", + "given": { + "placements": [ + { + "branch": "main", + "build": "0123456789ab", + "nodes": [ + "workstation" + ] + }, + { + "branch": "main", + "nodes": [ + "laptop" + ] + } + ] + } + } +] diff --git a/seats/mesh-module-assigner/seat.json b/seats/mesh-module-assigner/seat.json index 9529223..cd98e02 100644 --- a/seats/mesh-module-assigner/seat.json +++ b/seats/mesh-module-assigner/seat.json @@ -178,7 +178,7 @@ "items": { "$ref": "#/defs/ModulePlacement" }, - "description": "one per branch, the nodes that run the module from it" + "description": "one per branch and build, the nodes that run the module from it" } }, "required": [ @@ -1057,6 +1057,10 @@ "branch": { "type": "string" }, + "build": { + "type": "string", + "description": "the fingerprint of the build these nodes run from the branch; absent, the newest delivered of the branch (design 47 H 750, H-A-39): one row per branch and build" + }, "nodes": { "type": "array", "items": { diff --git a/ts/seats/meshmoduleassigner/index.d.ts b/ts/seats/meshmoduleassigner/index.d.ts index fb8994b..0246651 100644 --- a/ts/seats/meshmoduleassigner/index.d.ts +++ b/ts/seats/meshmoduleassigner/index.d.ts @@ -155,6 +155,8 @@ export interface Holding { /** the nodes that run a module from one watched branch */ export interface ModulePlacement { "branch": string; + /** the fingerprint of the build these nodes run from the branch; absent, the newest delivered of the branch (design 47 H 750, H-A-39): one row per branch and build */ + "build"?: string; "nodes": string[]; } @@ -376,7 +378,7 @@ export interface PlacementInput { /** is what placement answers. */ export interface PlacementAnswer { - /** one per branch, the nodes that run the module from it */ + /** one per branch and build, the nodes that run the module from it */ "placements": ModulePlacement[]; }