contracts-placement-build: the verb placement shows each row's build beside its branch

Builds: design 47 H §750, H-A-39
This commit is contained in:
2026-11-20 02:29:04 +01:00
parent f026a208a5
commit 226a097811
5 changed files with 38 additions and 5 deletions
+5 -3
View File
@@ -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"`
}
@@ -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))
@@ -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"
]
}
]
}
}
]
+5 -1
View File
@@ -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": {
+3 -1
View File
@@ -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[];
}