diff --git a/modules/mesh-delivery-contracts/go/clients/meshwantsclient/wants.go b/modules/mesh-delivery-contracts/go/clients/meshwantsclient/wants.go index 700a2eb3..5d7f8e6b 100644 --- a/modules/mesh-delivery-contracts/go/clients/meshwantsclient/wants.go +++ b/modules/mesh-delivery-contracts/go/clients/meshwantsclient/wants.go @@ -52,6 +52,10 @@ const ( // nothing restored (design 47 G §710). const RevertLive = seat.WantsByWantNodeModuleValueRevertLive +// HoldAwaitsHandPlacement is the words of a want the assigner holds for a node whose node-engine does not state +// want:version: it awaits its hand placement (design 47 H §772, H-A-73). Beside a put it is the one held want. +const HoldAwaitsHandPlacement = "awaits-hand-placement" + // NodeWord is the last part of a node's own key. const NodeWord = "node" @@ -178,8 +182,8 @@ func checkWant(w Want) error { } return nil } - if w.Hold && !w.Put { - return fmt.Errorf("wants: only a put holds a want") + if w.Hold && !w.Put && w.Words != HoldAwaitsHandPlacement { + return fmt.Errorf("wants: only a put, or a want awaiting its hand placement (%s), holds a want", HoldAwaitsHandPlacement) } if err := checkFingerprint(w.Fp, "a want's fingerprint"); err != nil { return err diff --git a/modules/mesh-delivery-contracts/go/clients/meshwantsclient/wants_test.go b/modules/mesh-delivery-contracts/go/clients/meshwantsclient/wants_test.go index 76038e62..c967aace 100644 --- a/modules/mesh-delivery-contracts/go/clients/meshwantsclient/wants_test.go +++ b/modules/mesh-delivery-contracts/go/clients/meshwantsclient/wants_test.go @@ -43,6 +43,8 @@ func TestWantsAreWhatTheEarlierCodecWrote(t *testing.T) { "revert": {Want{Fp: a, Self: true, Revert: RevertLive, Words: "live"}, `{"v":1,"fp":"` + a + `","revert":"live","words":"live","self":true}`}, "removed": {Want{Removed: true, Words: "gone"}, `{"v":1,"removed":true,"words":"gone"}`}, "a placement's build": {Want{Fp: a, Version: "0.1.14"}, `{"v":1,"fp":"` + a + `","version":"0.1.14"}`}, + // design 47 H §772, H-A-73: a node whose node-engine reads no want by version is held, awaiting its hand placement. + "awaits its hand placement": {Want{Fp: a, Version: "0.1.15", Pipeline: "main.3589", Rank: 1, Hold: true, Words: HoldAwaitsHandPlacement}, `{"v":1,"fp":"` + a + `","version":"0.1.15","pipeline":"main.3589","rank":1,"hold":true,"words":"awaits-hand-placement"}`}, } { t.Run(name, func(t *testing.T) { raw, err := EncodeWant(row.w) @@ -61,6 +63,7 @@ func TestWantsAreWhatTheEarlierCodecWrote(t *testing.T) { for name, w := range map[string]Want{ "old fingerprint": {Fp: "src1:abc"}, "hold without put": {Fp: a, Self: true, Hold: true}, + "hold with other words": {Fp: a, Hold: true, Words: "awaits"}, "rank without pipeline": {Fp: a, Rank: 1}, "pipeline without rank": {Fp: a, Pipeline: "main.3589"}, "rank below 1": {Fp: a, Pipeline: "main.3589", Rank: -1},