Repository navigation
feat(dir): enforce a policy version only once its verdicts cover the records - #2249
Merged
muscariello merged 1 commit intoOct 2, 2026
Merged
Conversation
This was referenced Oct 1, 2026
Closed
muscariello
force-pushed
the
feat/policy-enforcement-backfill
branch
from
October 1, 2026 07:11
1d69842 to
aa9de30
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
muscariello
added a commit
that referenced
this pull request
Oct 1, 2026
…t-bypass Brings in #2249's tests for how backfill bookkeeping fails. One of them calls servedDatabase, which this branch changed to also return what it enforces, so the merge updates that call to take three results. Signed-off-by: Luca Muscariello <[email protected]>
Contributor
|
As I mentioned in the previous PR, it would be much simpler to ignore policy version when enforcing, that's what I would recommend: #2235 (comment) |
muscariello
force-pushed
the
feat/policy-enforcement-backfill
branch
from
October 1, 2026 15:12
8af657f to
2c17da4
Compare
Member
Author
|
@csirmazbendeguz It is simpler, and I considered it. We kept strict enforcement: a verdict under another version doesn't count, because content already delivered can't be recalled and policies are usually tightened after something harmful is found. This PR limits the cost: versions are followed automatically, a new policy isn't enforced until every record has a verdict, and |
muscariello
force-pushed
the
feat/policy-enforcement-backfill
branch
from
October 1, 2026 15:45
2c17da4 to
0593488
Compare
muscariello
force-pushed
the
feat/policy-enforcement-backfill
branch
from
October 1, 2026 15:52
0593488 to
929e2ff
Compare
muscariello
force-pushed
the
feat/policy-enforcement-backfill
branch
from
October 1, 2026 17:51
929e2ff to
0156b49
Compare
This was referenced Oct 2, 2026
muscariello
force-pushed
the
feat/policy-enforcement-backfill
branch
from
October 2, 2026 07:34
0156b49 to
2412c9c
Compare
csirmazbendeguz
previously approved these changes
Oct 2, 2026
muscariello
dismissed
csirmazbendeguz’s stale review
October 2, 2026 12:05
The merge-base changed after approval.
muscariello
force-pushed
the
feat/policy-enforcement-backfill
branch
from
October 2, 2026 12:05
2412c9c to
0ed87b3
Compare
muscariello
force-pushed
the
feat/policy-enforcement-backfill
branch
from
October 2, 2026 12:33
0ed87b3 to
2dfccb8
Compare
Enforcing a policy the moment it is added hides every record not yet evaluated under it: adding a policy would empty search until the reconciler had caught up. A policy is now enforced for the first time only once no indexed record lacks a verdict under its current version. The server records that the first time it holds and never goes back: records indexed later have no verdict until evaluated, and are hidden until they do, which is what the filter already does. Until then reads are as they were without the policy, and the policy is reported as pending. Editing a policy that was already enforced is not a first rollout. The new version is enforced at once, strictly, and records stay hidden until they are evaluated under it, so nothing the new rule rejects is served in the meantime. dir_policy_gate_records_unevaluated reports, per policy, how many records have no verdict yet under its current version: what remains before a new policy is enforced, and the size of the blackout after an edit. Refs #2209 Signed-off-by: Luca Muscariello <[email protected]>
muscariello
force-pushed
the
feat/policy-enforcement-backfill
branch
from
October 2, 2026 12:59
2dfccb8 to
3f74f1e
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.
Part of #2209 (second PR: stage 2, and what an edit does). Part of #2205. Stacked on #2248:
main← #2226 ← #2229 ← #2235 ← #2237 ← #2238 ← #2241 ← #2246 ← #2248 ← this.Why
The gate fails closed: a record with no verdict under the current version is excluded. Enforcing a policy the moment it is added would therefore hide every record not yet evaluated, and empty search until the reconciler caught up.
What this adds
policy_backfillstable the first time it holds. Until then reads are as they were without the policy, and the policy is reported as pending.dir_policy_gate_records_unevaluated{policy_id, version}reports, per policy, how many records have no verdict yet under its current version: what remains before a new policy is enforced, and the size of the blackout after an edit.Testing
server,reconciler,cliandtestsvet clean.