diff --git a/modules/mesh-grants/grants_test.go b/modules/mesh-grants/grants_test.go index ad5640d7b..b269dbbae 100644 --- a/modules/mesh-grants/grants_test.go +++ b/modules/mesh-grants/grants_test.go @@ -1334,8 +1334,10 @@ func TestGrants(t *testing.T) { t.Fatalf("withheld by node = %+v", byNode) } p := partOn(newFakeBus()) - if _, err := p.WithheldOn("a"); err == nil { - t.Errorf("withheld before any composition answered no error") + // H-A-736 (2): asked before its first composition, withheld answers `away` naming that composition. + var away *busretry.Away + if _, err := p.WithheldOn("a"); !errors.As(err, &away) || away.Part != "the first composition" { + t.Errorf("withheld before any composition answered %v, not away naming the first composition", err) } raw, _ := json.Marshal(grants.UserListState{V: 1, Withheld: byNode}) if _, err := p.Store.Put(grants.StateUserList, grants.KeyList, raw); err != nil { diff --git a/modules/mesh-grants/internal/grants/part.go b/modules/mesh-grants/internal/grants/part.go index f1317e804..df001953b 100644 --- a/modules/mesh-grants/internal/grants/part.go +++ b/modules/mesh-grants/internal/grants/part.go @@ -19,6 +19,7 @@ import ( "git.novox.be/novox/mesh-contracts/identity-and-access/go/seats/meshgrants" oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel" "git.novox.be/novox/mesh-delivery/modules/mesh-grants/grantsstate" + "git.novox.be/novox/mesh-sdk/go/busretry" "git.novox.be/novox/mesh-sdk/go/membership" "mesh-grants/internal/buscompose" ) @@ -784,7 +785,9 @@ func (p *Part) WithheldOn(node string) (meshgrants.Withheld, error) { // Before the process kept the small key: the list's own, which only a reader that can open it reads. if raw, _, found, err = p.Store.Get(StateUserList, KeyList); err == nil { if !found { - return out, errors.New("nothing composed yet: grants_compose_now composes it") + // A read that cannot answer yet is `away` naming what it waits for, never a word a caller takes as a refusal (design + // 47 H2 H-A-708 (2), H-A-736 (2)). + return out, &busretry.Away{Part: "the first composition", Words: "nothing composed yet: grants_compose_now composes it"} } err = json.Unmarshal(raw, &st) }