From ef26fa19f713ad519e2c52d3031c1a4f08331b34 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 3 Nov 2026 22:03:32 +0000 Subject: [PATCH] feat(addons): let a caller ask whether the grants store is usable View hides a closed or doubtful store behind an empty document, which would drop the deny rules kept in it. A caller that must fail closed asks Usable first. Assisted-by: Claude:claude-sonnet-5-5 go --- core/services/addons/hostgrants/store.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/services/addons/hostgrants/store.go b/core/services/addons/hostgrants/store.go index f34762c9a7..3f5494c0a3 100644 --- a/core/services/addons/hostgrants/store.go +++ b/core/services/addons/hostgrants/store.go @@ -130,6 +130,15 @@ func (s *Store) usable() error { return nil } +// Usable reports whether the store answers: it is neither closed nor in doubt +// about its last write. A caller that must fail closed asks it before it +// trusts View, which hides the failure behind an empty document. +func (s *Store) Usable() error { + s.mu.Lock() + defer s.mu.Unlock() + return s.usable() +} + // Snapshot returns a copy of the current document. func (s *Store) Snapshot(ctx context.Context) (Snapshot, error) { s.mu.Lock()