Repository navigation
fix(schema): preserve annotations on unchanged definitions during schema writes - #3440
Merged
josephschorr merged 1 commit intoOct 30, 2026
Merged
Conversation
josephschorr
force-pushed
the
fix-schema-annotations-stripped
branch
from
October 29, 2026 16:47
4b85840 to
a711f1b
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…ema writes Schema writes passed every compiled definition to WriteSchema, but only annotated those with a semantic diff. Unchanged definitions were therefore written without their aliasing_relation and canonical_cache_key annotations, in both the legacy and unified schema storage paths. Annotate every definition before writing, which also restores annotations on datastores already affected. Size the BDD operation caches used for canonical cache keys to the expression, rather than the 10,000-entry default, so annotating every definition does not add significant allocation. Fixes authzed#3412
josephschorr
force-pushed
the
fix-schema-annotations-stripped
branch
from
October 30, 2026 16:30
a711f1b to
bd02550
Compare
josephschorr
enabled auto-merge (rebase)
October 30, 2026 16:30
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #3412
Description
Since v1.49.0, every schema write has stripped the
aliasing_relationandcanonical_cache_keyannotations from definitions that did not change. The write path annotated only definitions with a semantic diff, but then wrote every compiled definition, so unchanged ones replaced their stored, annotated copies. This happens in both the legacy and single-store schema modes.Without the annotations, permissions that alias a relation are dispatched as separate subproblems, and equivalent permissions stop sharing dispatch cache entries. Affected deployments see more dispatches, higher check latency and more datastore load, with no errors.
Changes
Testing
A new test writes a schema, then rewrites it, in all four schema modes, and checks that annotations survive an identical rewrite and a rewrite that adds a definition, that they are restored when starting from stripped definitions, and that recomputed keys match the originals. The test fails in every mode without the fix.