Files
multica/server/internal
XuSt 77907db1e3 MUL-5406: propagate non-ErrNoRows scope DB errors (#6057)
* fix(scope_authorizer): propagate non-ErrNoRows DB errors instead of swallowing them

dbScopeAuthorizer.AuthorizeScope returned (false, nil) on every query
error at all four lookup points (GetAgentTask, GetIssue, GetChatSession x2),
masking transient DB failures as plain 'forbidden' denials. This made the
'lookup_failed' branch in realtime/hub.go handleSubscribe unreachable and
hid database outages from users and operators.

Now only pgx.ErrNoRows (a legitimate missing resource) yields (false, nil);
any other error propagates as (false, err) so handleSubscribe reports
'lookup_failed'. Updated fakeScopeQuerier to return pgx.ErrNoRows for
misses, and added tests pinning both the error-propagation and the
not-found-is-plain-denial semantics.

Closes #6037

* test(realtime): cover scope lookup failures

Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: Eve <eve@multica-ai.local>
Co-authored-by: multica-agent <github@multica.ai>
2026-07-29 13:22:12 +08:00
..