Skip to content

Pin ADR-059 embedding-access-boundary invariant with a regression test (closes #1737) - #1891

Merged
mstomar125 merged 1 commit into
mainfrom
issue-1737-embedding-access-boundary
Aug 1, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-1737-embedding-access-boundary

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

#1737 asked for runtime access-filtering in the embedding aggregation walk plus an access-change requeue trigger. ADR-059 (the governing decision, §2/§6/§7) supersedes that: the boundary is made unreachable by construction, not filtered. Per §7, "aggregation needs no access filtering and re-embedding needs no access-change trigger," because two load-bearing invariants already prevent a boundary from appearing inside an embeddable root's aggregate:

  1. Content member_of is root-only (§2) — enforced by assert_root_only_membership at every member_of insert site, so an embeddable has_child descendant cannot carry its own restriction.
  2. The aggregation walk follows has_child only (get_children), never member_of — so content filed into a restricted collection via member_of is never pulled into an unrelated open root's vector; collections / non-embeddable types contribute nothing.

The issue's runtime-filter + requeue approach was the rejected alternative.

Change

No production change — the fix is the already-enforced structural invariant. This adds the missing regression test that pins it (verified passing): an open embeddable root's aggregate includes its own has_child subtree but excludes a restricted-collection member's content, and add_to_collection on a has_child descendant is rejected (member_of is root-only). Neither invariant — nor a reintroduced runtime-filter — can silently reopen the leak.

Closes #1737. Full pre-push gate green.

Co-Authored-By: Claude Opus 4.8 [email protected]

closes #1737)

#1737 asked for runtime access-filtering in the aggregation walk plus an
access-change requeue trigger. ADR-059 (the governing decision, §2/§6/§7)
supersedes that: the boundary is made UNREACHABLE BY CONSTRUCTION, not filtered.
Per §7, aggregation needs no access filtering and re-embedding needs no
access-change trigger, because the two load-bearing invariants already prevent a
boundary from ever appearing inside an embeddable root's aggregate:

  1. Content member_of is root-only (§2) — enforced by assert_root_only_membership
     at every member_of insert site, so an embeddable has_child descendant cannot
     carry its own restriction.
  2. The aggregation walk follows has_child only (get_children), never member_of —
     so content filed into a restricted collection via member_of is never pulled
     into an unrelated open root's vector; collections/non-embeddable types
     contribute nothing.

Verified empirically and pinned so neither invariant (nor the rejected
'filter at runtime' alternative) can silently reopen the leak: an open embeddable
root's aggregate includes its own has_child subtree but excludes a
restricted-collection member's content, and add_to_collection on a has_child
descendant is rejected (member_of is root-only).

No production code change — the fix is the already-enforced structural invariant;
this adds the missing regression test that pins it.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE (self-review; test-only change, no production logic — cannot add a bug). Grounded in ADR-059 §2/§6/§7 (fetched from nodespace-docs): the leak is unreachable by construction via the root-only member_of constraint (§2, enforced) + the has_child-only aggregation walk. The regression test verifies both invariants empirically. Gate green.

@mstomar125
mstomar125 merged commit a8d62c6 into main Aug 1, 2026
2 checks passed
@mstomar125
mstomar125 deleted the issue-1737-embedding-access-boundary branch August 1, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subtree embedding aggregation must stop at access boundaries; restricted descendants become their own embedding roots

1 participant