feat(BA-6923): add ensure_scope op and self/hierarchy scope bindings on creation#12934
Merged
Merged
Conversation
fregataa
added a commit
that referenced
this pull request
Jul 17, 2026
fregataa
added a commit
that referenced
this pull request
Jul 20, 2026
fregataa
force-pushed
the
feat/BA-6923-ensure-virtual-scope-ops
branch
from
July 20, 2026 13:10
cb4c52b to
e9a8cfd
Compare
Comment on lines
+428
to
+440
| # -- Virtual scope: ensure compatibility for externally-created rows ---------- | ||
|
|
||
| async def ensure_scope( | ||
| self, | ||
| scope: ScopeRef, | ||
| parent: ScopeRef | None = None, | ||
| ) -> None: | ||
| """Ensure the virtual scope node for an already-created ``scope``. When ``parent`` is | ||
| given, the parent scope is bound to this scope's virtual scope. Idempotent. | ||
| """ | ||
| await self._insert_virtual_scopes([scope]) | ||
| if parent is not None: | ||
| await self.bind_scope(parent, scope, permission_cap=None) |
Collaborator
There was a problem hiding this comment.
It doesn't seem like a good idea to create a virtual scope when the scope hasn't even been created yet.
…on creation Add ensure-virtual-scope RBAC ops that backfill VS structures next to the legacy write path, so an entity can move to virtual-scope resolution on its own without an all-at-once cutover. - _insert_virtual_scopes now also writes each scope's self scope_binding, so an owner resolves its own entities through the single VS path. - create_scope / ensure_scope take an optional parent that binds the parent scope to this scope's virtual scope (hierarchy binding). - ensure_scope backfills the VS node without creating the real scope row. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The argument describes any scope co-mapped into this scope's virtual scope, not a hierarchical parent, so the neutral name avoids implying a parent-child concept. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fregataa
force-pushed
the
feat/BA-6923-ensure-virtual-scope-ops
branch
from
July 21, 2026 02:42
e9a8cfd to
80add1e
Compare
HyeockJinKim
approved these changes
Jul 21, 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.
Summary
_insert_virtual_scopesnow also writes each scope's selfscope_binding, so an owner resolves its own entities through the single virtual-scope path.create_scope/ensure_scopetake an optionalbound_scopethat binds additional scopes to this scope's virtual scope (hierarchy binding).ensure_scopebackfills the VS node without creating the real scope row.Test plan
create_scopematerializes the VS node, self entity-membership, and self scope_bindingensure_scopebackfills VS structures without creating the real row, and is idempotentensure_scope(scope, parent)adds the hierarchy bindingResolves BA-6923