Skip to content

feat(BA-6923): add ensure_scope op and self/hierarchy scope bindings on creation#12934

Merged
HyeockJinKim merged 3 commits into
mainfrom
feat/BA-6923-ensure-virtual-scope-ops
Jul 21, 2026
Merged

feat(BA-6923): add ensure_scope op and self/hierarchy scope bindings on creation#12934
HyeockJinKim merged 3 commits into
mainfrom
feat/BA-6923-ensure-virtual-scope-ops

Conversation

@fregataa

@fregataa fregataa commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

  • Add ensure-virtual-scope RBAC ops that backfill VS structures next to the legacy write path, so an entity can adopt 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 virtual-scope path.
  • create_scope / ensure_scope take an optional bound_scope that binds additional scopes to this scope's virtual scope (hierarchy binding). ensure_scope backfills the VS node without creating the real scope row.

Test plan

  • create_scope materializes the VS node, self entity-membership, and self scope_binding
  • ensure_scope backfills VS structures without creating the real row, and is idempotent
  • ensure_scope(scope, parent) adds the hierarchy binding

Resolves BA-6923

Copilot AI review requested due to automatic review settings July 17, 2026 07:29
@fregataa
fregataa requested a review from a team as a code owner July 17, 2026 07:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added size:L 100~500 LoC comp:manager Related to Manager component labels Jul 17, 2026
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
fregataa force-pushed the feat/BA-6923-ensure-virtual-scope-ops branch from cb4c52b to e9a8cfd Compare July 20, 2026 13:10
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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem like a good idea to create a virtual scope when the scope hasn't even been created yet.

fregataa and others added 3 commits July 21, 2026 11:41
…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
fregataa force-pushed the feat/BA-6923-ensure-virtual-scope-ops branch from e9a8cfd to 80add1e Compare July 21, 2026 02:42
@fregataa
fregataa requested a review from a team July 21, 2026 03:36
@HyeockJinKim
HyeockJinKim merged commit a384005 into main Jul 21, 2026
34 checks passed
@HyeockJinKim
HyeockJinKim deleted the feat/BA-6923-ensure-virtual-scope-ops branch July 21, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:manager Related to Manager component size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants