Repository navigation
refactor(server): add OperationInput for operation policies - #2419
Merged
Merged
Conversation
Signed-off-by: Tibor Kircsi <[email protected]>
Contributor
|
The latest Buf updates on your PR. Results from workflow Buf CI / verify-proto (pull_request).
|
This was referenced Oct 27, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Signed-off-by: Tibor Kircsi <[email protected]>
tkircsi
marked this pull request as ready for review
October 27, 2026 14:01
csirmazbendeguz
approved these changes
Oct 27, 2026
This was referenced Oct 27, 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.
The counterpart of #2400. An operation policy received only the record's struct, so it could ask nothing about the operation it was deciding, and both layers compiled against the same CEL environment, so an operation policy could name
metaand read it as empty rather than be told it cannot have it.ValidateOperationnow takes anOperationInput.Decidebuilds it once per decision, so every policy deciding one operation reads the samenow, which is what the field is for.CEL compiles against one of two environments, chosen by the block the policy was configured in. An evaluation keeps
record,record_cid,indexed_atandmeta; an operation getsrecord,record_cid,contextandnow. Because the environment is chosen when the policy is loaded, an operation policy namingmetaorindexed_atfails at startup rather than deciding on an empty value once per record. That is why the layer travels from the config block down to the provider.OPA is given the same values as a nested input document, so
input.record.namemeans the same thing in both layers. This replaces the flat document an operation policy got before, where the record's fields sat at the document root. No.regofile ships in the repo or the charts, so no policy needed migrating. Two differences follow from the document being JSON: an enum arrives as its name, so the comparison isinput.context.operation == "OPERATION_PUSH", and an unsetsource_peer_idis absent rather than empty.verdictsandindexed_atare declared in neither the operation environment nor its Rego document, because reaching either needs a database read thatDecidedoes not have, and declaring them before they can be answered truthfully would compile policies that silently decide on nothing. They arrive with the verdict read in #2344, which is also what populatescontext.source_peer_id: the proto reserves it for autosync, nothing sets it yet, so a policy reads it as absent at every operation.Existing CEL policies are unaffected:
recordandrecord_cidread as they did, and the e2e policy suite's expressions are evaluation policies. The records validation documentation gains a section on what a policy can read, and the Helm values, daemon configuration and server README no longer say the record is the only thing bound.Refs #2341