Repository navigation
test(dir): check that a node serves a record only once its policy passes it - #2267
Merged
Merged
Conversation
Contributor
|
The latest Buf updates on your PR. Results from workflow Buf CI / verify-proto (pull_request).
|
muscariello
force-pushed
the
feat/policy-e2e
branch
from
October 2, 2026 07:34
2c428b1 to
9644ac2
Compare
muscariello
added a commit
that referenced
this pull request
Oct 2, 2026
dupword flags "records records" in NewValidatorEvaluator's comment. The same change is on #2266, whose commit this branch still carries; it drops out when this branch is rebased onto it. Fixes the Lint job failure on #2267. Signed-off-by: Luca Muscariello <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
muscariello
force-pushed
the
feat/policy-e2e
branch
from
October 2, 2026 10:44
aad1459 to
24e6852
Compare
muscariello
force-pushed
the
feat/policy-e2e
branch
from
October 2, 2026 12:05
24e6852 to
865ced5
Compare
muscariello
force-pushed
the
feat/policy-e2e
branch
from
October 2, 2026 12:33
865ced5 to
e738ce9
Compare
…ses it A node that enforces a content policy must withhold a record until the reconciler has evaluated it, serve it once the policy passes it, and keep it from callers when the policy rejects it. Nothing tested that across the indexer, the policy task and the read gate together. This adds a suite, policy, with a daemon environment of its own. A node that enforces withholds every record until it is evaluated, so the daemon suite's specs, which read back what they push, could not run on it. The environment defines a CEL policy, cel:has-description, enforces it on search and fetch, and runs the indexer and the policy task every 5s. The specs: a record just pushed is refused with PermissionDenied, though the policy would pass it; once evaluated it is served by pull, lookup and search; a record the policy rejects stays refused, and out of search, through another round of the reconciler; a refusal names no policy; and a CID that was never pushed is refused the same way, so an enforcing node does not say which CIDs it holds. The first spec waits for the policy to be enforced by pushing a record it rejects and waiting for it to be refused. The indexer adds a pushed record and a record copied in by registry sync the same way, with no verdict, so this covers what a synced record goes through after the copy. The copy itself is not touched by the gate. Closes #2244. Refs #2205 Signed-off-by: Luca Muscariello <[email protected]>
muscariello
force-pushed
the
feat/policy-e2e
branch
from
October 2, 2026 12:59
e738ce9 to
4dfaba5
Compare
csirmazbendeguz
approved these changes
Oct 2, 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.
Closes #2244. Part of #2205. Stacked on #2266:
main← #2226 ← #2229 ← #2235 ← #2237 ← #2238 ← #2241 ← #2246 ← #2248 ← #2249 ← #2253 ← #2266 ← this. Based onfeat/policy-evaluator-validators; retargets as the PRs below it merge.What this adds
The last piece of #2205: an end-to-end test of the whole path. A node that enforces a content policy must withhold a record until the reconciler has evaluated it, serve it once the policy passes it, and keep it from callers when the policy rejects it. Until #2266 no node could produce a verdict, so none of this could run.
A new suite,
tests/e2e/policy, with a daemon environment of its own (no cluster). It is not a second environment of the daemon suite: a node that enforces withholds every record until it is evaluated, so the daemon suite's specs, which push a record and read it straight back, could not run on it.The environment defines a CEL policy,
cel:has-description(a record needs a description), enforces it on search and fetch, and runs the indexer and the policy task every 5s with the server following the policy registry every 2s.Specs, in order:
PermissionDenied.Every refusal is checked to say the record is not available under the node's content policy, and not to name the policy. The first spec waits for the policy to be enforced by pushing a record it rejects and waiting for it to be refused: a policy is enforced once the reconciler has registered it and its verdicts cover the records, and until then the node serves as it did.
The suite is registered in
tests/Taskfile.yml(task e2e:test:policy:default) and in the E2E CI matrix, and described in the E2E README.Scope
#2244 asked for the scenario with records received from a peer. The indexer adds a pushed record and a record copied in by registry sync the same way, with no verdict, so this covers what a synced record goes through after the copy; the copy itself (regsync) is not touched by the gate. A two-node version would exercise regsync, not enforcement, and needs Helm/kind changes to enforce a policy on the receiving node.
Testing
BeforeAlltimes out reporting that a rejected record was never refused; with the policy gate removed fromLookuponly, the first spec fails at theLookupassertion while pull is still gated.task e2e:list, a dry run ofe2e:testenv:policy:default:up).testsvets clean.