diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go index 8a868938..88575bf5 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "errors" + "git.novox.be/novox/mesh-contracts/go/seats/nodeengine" "maps" "mesh-delivery-assigner/internal/buckets" "slices" @@ -287,7 +288,11 @@ func (p *passer) wants(ctx context.Context) { wantedOf := wantedHere(wanted[name], g.nodes, groups, gi == 0) target, ok := p.ends.target(name, g.branch) m := assign.Module{Name: name, Manifest: bv.manifests[name], Chosen: chosenOf(chosen, name), Nodes: g.nodes, Puts: puts[name], - Self: func(node string) bool { return placed[node] }, + Self: func(node string) bool { return placed[node] }, + // §772, H-A-45: a node-engine that does not state want:version gets its want held, awaiting its hand placement. + ReadsVersion: func(node string) bool { + return slices.Contains(nodes.Reads[node], nodeengine.ManifestReadWordWantVersion) + }, Target: func(string) (assign.Target, bool) { return target, ok }, Allowed: func(node, digest string) bool { key, err := asks.RecordAskKey(node, name, digest) diff --git a/modules/mesh-delivery-assigner/internal/assign/wants.go b/modules/mesh-delivery-assigner/internal/assign/wants.go index e4fca6f8..62a13f9d 100644 --- a/modules/mesh-delivery-assigner/internal/assign/wants.go +++ b/modules/mesh-delivery-assigner/internal/assign/wants.go @@ -50,6 +50,10 @@ type Module struct { // Self says whether node composes the module itself: the catalogue's assignments names the node (ADR 0547 §2). Nil: no // node does. Self func(node string) bool + // ReadsVersion says whether node's node-engine states that it reads a want by version (the word want:version of the seat + // node-engine, design 47 H §772, H-A-45); a node whose engine does not is written its want held, awaiting its hand placement + // (H-A-73). Nil: every node does. + ReadsVersion func(node string) bool } func (m Module) selfOn(node string) bool { return m.Self != nil && m.Self(node) } @@ -123,6 +127,10 @@ func Wants(m Module, wants map[string]mwc.Want) Outcome { // The answers the want carries stay while its build does: a failed backup's (ADR 0539 §16), a held revert's, the yes. next.Backup, next.Words, next.Revert, next.Yes, next.Release = before.Backup, before.Words, before.Revert, before.Yes, before.Release } + if m.ReadsVersion != nil && !m.ReadsVersion(node) { + // A node-engine that cannot read a want by version is placed by hand when its machine is back (design 47 H §772). + next.Hold, next.Words, next.Backup, next.Revert = true, mwc.HoldAwaitsHandPlacement, "", "" + } if !had || !mwc.SameWant(normal(before), normal(next)) { out.Wants[node] = next } diff --git a/modules/mesh-delivery-assigner/internal/assign/wants_test.go b/modules/mesh-delivery-assigner/internal/assign/wants_test.go index 510b8530..d41135b0 100644 --- a/modules/mesh-delivery-assigner/internal/assign/wants_test.go +++ b/modules/mesh-delivery-assigner/internal/assign/wants_test.go @@ -64,6 +64,11 @@ func TestAWantNamesTheNewestPassedVersion(t *testing.T) { {"the backup answer stays while the build does", released, map[string]mwc.Want{"ace": {Fp: fNew, Version: "1.2.3", Pipeline: "main.12", Rank: 2, Backup: mwc.BackupSkip, Words: BackupAnswerWords("skip", 0)}, "g14": want}, map[string]mwc.Want{}}, + {"A9/AC1 (§772, H-A-73): a node whose engine reads no want by version is held, awaiting its hand placement", func() Module { + m := released() + m.ReadsVersion = func(node string) bool { return node == "ace" } + return m + }, nil, map[string]mwc.Want{"ace": want, "g14": {Fp: fNew, Version: "1.2.3", Pipeline: "main.12", Rank: 2, Hold: true, Words: mwc.HoldAwaitsHandPlacement}}}, {"a node no longer assigned is removed", func() Module { m := released() m.Nodes = []string{"ace"}