perf(dashboard): memoize Galaxy summary by cache sequence; document scope-provider identity invariant

This commit is contained in:
Joseph Doherty
2026-06-25 11:48:27 -04:00
parent 8e196a7c83
commit 80bf4acc4f
2 changed files with 35 additions and 1 deletions
@@ -11,6 +11,13 @@ public sealed class GatewayBrowseScopeProvider(IGatewayRequestIdentityAccessor i
/// <inheritdoc />
public IReadOnlyList<string>? ResolveBrowseSubtrees(ServerCallContext context)
{
// Invariant: the caller identity is the ambient one pushed by
// GatewayGrpcAuthorizationInterceptor earlier in this same call. That interceptor is
// registered globally and therefore runs before the library's galaxy service, so
// Current is populated for any authenticated galaxy RPC. If it is somehow absent we
// return empty BrowseSubtrees, which the library treats as "no scoping" (full
// hierarchy) — safe only because the global interceptor has already authenticated and
// authorized the request first. Do not reorder the interceptor without revisiting this.
ApiKeyConstraints constraints = identityAccessor.Current?.EffectiveConstraints ?? ApiKeyConstraints.Empty;
return constraints.BrowseSubtrees;
}