R3 grants-withheld-away: grants_withheld asked before its first composition answers away naming that composition

Builds: design 47 H2 H-A-708 (2), H-A-736 (2)
This commit is contained in:
2026-11-25 17:26:11 +01:00
parent df890b8a7c
commit 61a6811cd5
2 changed files with 8 additions and 3 deletions
+4 -2
View File
@@ -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 {
+4 -1
View File
@@ -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)
}