feat(core): resolve and flat-merge PORC context via backend.GetContext - #72
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Adds the context (C) enrichment stage to Authorize, mirroring resource (R)
resolution. Backends resolve the request context for the ordered delegation-chain
subjects and the engine flat-merges the result into input[context].
- backend.Service: new GetContext(ctx, subs []string) (map, *PolicyError).
Local + mock backends return {} (no external resolver); the remote backend
(go-lib) will call the customer context resolver.
- Authorize: flattenSubs builds the ordered subs list from the principal --
current actor first (principal.act.sub), down the nested act chain, subject
(principal.sub) last -- then resolveContext calls GetContext and flat-merges
(resolved wins) into input[context]. A failed/empty resolve attaches nothing.
- new PORC keys: contextKey ("context", named to avoid shadowing the context
package) and Act ("act").
Standalone/local path works now (backend returns {}); the platform path lights
up once the remote backend implements GetContext (go-lib, issue C).
Tests: flattenSubs (subject-only, single/nested act chain ordering, empty, blank
skipping) and flatMergeContext (merge, collision precedence, nil-tolerance,
no-mutation). go build ./... + changed-package tests green.
NOTE: the principal.act shape (nested {sub, act}, current-actor outermost) has no
prior use in this repo -- the engine only read `sub` before. Encoded explicitly in
flattenSubs + its tests; confirm it matches how go-lib/sidecar builds the principal.
Signed-off-by: smuralidharan <smuralidharan@manetu.com>
muralisrini
force-pushed
the
feature/context-resolution
branch
from
August 8, 2026 22:54
80d67a6 to
e851834
Compare
ghaskins
reviewed
Aug 13, 2026
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.
Adds the context (C) enrichment stage to Authorize, mirroring resource (R) resolution. Backends resolve the request context for the ordered delegation-chain subjects and the engine flat-merges the result into input[context].
Standalone/local path works now (backend returns {}); the platform path lights up once the remote backend implements GetContext (go-lib, issue C).
Tests: flattenSubs (subject-only, single/nested act chain ordering, empty, blank skipping) and flatMergeContext (merge, collision precedence, nil-tolerance, no-mutation). go build ./... + changed-package tests green.
NOTE: the principal.act shape (nested {sub, act}, current-actor outermost) has no prior use in this repo -- the engine only read
subbefore. Encoded explicitly in flattenSubs + its tests; confirm it matches how go-lib/sidecar builds the principal.