From 0254fdaf8d50bb40607d2c97836ad84b857e9567 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sat, 26 Sep 2026 15:30:19 +1000 Subject: [PATCH] fix(archied): extract accessDeps to bring stateStoreDeps under the complexity limit The equivalent fix was made in the crew/qc8p worktree but never committed there before the merge, so the merge silently carried the pre-fix version through despite a clean, no-conflict merge. Re-applied directly on main; task check clean. --- internal/app/archied/state_store.go | 30 ++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/internal/app/archied/state_store.go b/internal/app/archied/state_store.go index 32e8a3118..66ae01e8e 100644 --- a/internal/app/archied/state_store.go +++ b/internal/app/archied/state_store.go @@ -338,19 +338,7 @@ func (b *boot) stateStoreDeps(grants *staterpc.TaskGrants) staterpc.Deps { if wc, ok := b.st.(storecontract.WorkflowCaller); ok { deps.WorkflowCalls = wc } - // The policy chain and its denial records are served from the same store - // (docs/prds/orgs-and-access.md). A store without them -- one that owns - // no tenant boundary yet -- degrades the access RPCs rather than failing - // the boot, the same pattern the other optional surfaces use. - if ps, ok := b.st.(access.PrincipalSource); ok { - deps.Principals = ps - } - if ps, ok := b.st.(access.PolicyStore); ok { - deps.Policies = ps - } - if ds, ok := b.st.(access.DenialStore); ok { - deps.Denials = ds - } + b.accessDeps(&deps) if css, ok := b.st.(storecontract.ConfigSnapshotStore); ok { deps.ConfigSnapshots = css } @@ -363,6 +351,22 @@ func (b *boot) stateStoreDeps(grants *staterpc.TaskGrants) staterpc.Deps { return deps } +// accessDeps wires the policy chain and its denial records from the same +// store (docs/prds/orgs-and-access.md). A store without them -- one that owns +// no tenant boundary yet -- degrades the access RPCs rather than failing the +// boot, the same pattern the other optional surfaces use. +func (b *boot) accessDeps(deps *staterpc.Deps) { + if ps, ok := b.st.(access.PrincipalSource); ok { + deps.Principals = ps + } + if ps, ok := b.st.(access.PolicyStore); ok { + deps.Policies = ps + } + if ds, ok := b.st.(access.DenialStore); ok { + deps.Denials = ds + } +} + // serveStateStore registers the StateStore gRPC service and serves it until // ctx ends, draining in-flight calls before returning (mirroring serveGateway // in gateway.go, minus the gateway's session-store argument).