control-plane-api: extract Authority on every route - #3405
Open
bbartman wants to merge 4 commits into
Open
Conversation
bbartman
force-pushed
the
bmb/3376-stack-4-authority-migration
branch
from
August 27, 2026 10:50
c69f919 to
6a57e7a
Compare
bbartman
force-pushed
the
bmb/3376-stack-4-authority-migration
branch
from
August 27, 2026 12:12
6a57e7a to
8327516
Compare
bbartman
force-pushed
the
bmb/3376-stack-4-authority-migration
branch
2 times, most recently
from
August 28, 2026 12:17
9de5b8a to
d8c9f47
Compare
bbartman
force-pushed
the
bmb/3376-stack-4-authority-migration
branch
from
August 28, 2026 16:59
d8c9f47 to
f3d4380
Compare
bbartman
force-pushed
the
bmb/3376-stack-4-authority-migration
branch
from
August 31, 2026 12:45
f3d4380 to
07e7aba
Compare
Mechanical call-site migration with zero behavior change (task 3b of #3376): every REST handler signature and GraphQL resolver pull swaps Envelope for Authority, decomposed structurally in the manner of axum's State to grab the envelope member — binding `env` so handler and resolver bodies are unchanged. graphql_handler injects the whole Authority into request data, and the agent GraphQL harness assembles one via Authority::from_envelope, the same evaluation HTTP extraction performs. Envelope keeps its FromRequestParts impl as the inner extraction that Authority composes over (now in axum's async fn style), and the authorization chokepoint helpers keep their &Envelope parameters: the extractor carries the bearer's mask on every request, but nothing consumes it yet — live mask threading is the next stacked PR.
from_envelope already returns Result<Self, Rejection>, so the Ok(...?) round trip was a no-op.
…L data Rather than putting Authority itself into the GraphQL context, the handler decomposes it and injects the Envelope and the bearer's capability mask as separate context data: resolvers read the Envelope exactly as before (their ~52 pulls revert unchanged), while authorization chokepoints will consume the mask on their own, without every resolver having to care that it exists. The agent harness mirrors the same decomposition.
The /admin endpoints authorize via SQL internal.user_roles rather than the snapshot walk, so the bearer's capability mask has no effect there until their authorization is refactored onto the snapshot — say so on each handler. Also rewrite two migration-era comments to state what is rather than what was: the Authority type doc's handler rule, and graphql_handler's rationale for injecting Envelope and mask as separate context data.
bbartman
force-pushed
the
bmb/3376-stack-4-authority-migration
branch
from
September 1, 2026 13:08
07e7aba to
520f432
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #3376 (task 3b). Stacked on #3404 (task 3a); review only the last three commits.
The mechanical call-site migration, with zero behavior change:
EnvelopeforAuthority, decomposed structurally in the manner of axum'sState—crate::Authority { envelope: env, .. }bindsenv, so handler bodies are unchanged.graphql_handlerdecomposes the extractedAuthorityand injects theEnvelopeand the bearer'sCapabilityMaskas separate context data: resolvers read theEnvelopeexactly as before (their ~52 pulls are untouched), while authorization chokepoints will consume the mask on their own in the next PR, without every resolver having to care that it exists. The agent GraphQL test harness mirrors the same decomposition viaAuthority::from_envelope, the same evaluation HTTP extraction performs.Envelopekeeps itsFromRequestPartsimpl as the inner extractionAuthoritycomposes over (now written in axum'sasync fnstyle).verify_authorization, storage-mappings') keep their&Envelopeparameters: the extractor carries the bearer's mask on every request, but nothing consumes it yet — every chokepoint stays pinned toALL_CAPABILITIESfrom tables: capability-mask-aware user grant walk #3397. Live mask threading is the next stacked PR (task 3c).Every route now evaluates its
Requirementat extraction (all routes areNoRequirementtoday, which is vacuous), so response behavior is byte-identical — pinned by the existing route-level test suites, which pass unchanged.