You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reject reparenting a node that holds a member_of edge into a non-root position (ADR-059 §2 criterion 8) #1765
Follow-up split out of #1742. The store-level guard from #1742 enforces root-only content membership at member_ofwrite time. It does not cover the reverse transition: a node that is already a valid root member of a collection can be made interior by an outline move (move_node), which gives it a has_child parent while it still holds its member_of edge. No member_of write happens, so no guard fires, and the invariant (ADR-059 §2: a content node may be a member of a collection only when it is a root) is silently violated through ordinary UX.
Where
packages/core/src/services/node_service/hierarchy.rs — move_node (the indent/reparent path) never re-checks membership after assigning a new has_child parent.
Reject the move, do not silently drop the membership. A node can hold multiple member_of grants, each an independent access path; dropping them on an indent would silently revoke access with no record. Promotion is also wrong (it moves classification to a node the user didn't file).
Acceptance
move_node that would give a node a has_child parent while it holds one or more member_of edges is rejected with an actionable error naming the node and the collection(s) it is a member of
Moving a node that holds no membership is unaffected
Person/collection nodes are unaffected (they are exempt from the root-only rule)
Test: file a root content node into a collection, then attempt to indent it under another node → rejected, membership intact
The reparent side of ADR-059 §2 (issue #1742's criterion 8) is now enforced at the store's two has_child attach-an-existing-node sites — SqliteStore::move_node (covers the service move_node outline-edit path and the upsert_node_with_parent gRPC / save_node_with_parent path) and SqliteStore::bulk_create_has_child (the sync-apply cold sweep) — symmetric with #1742's forward guard on member_of inserts. A node holding a member_of edge cannot be given a has_child parent; the move is rejected (not silently dropped — a node may hold several grants, each an independent access path) with an error naming the collections. Collection and person nodes are exempt; moving a member to root stays allowed.
Adversarial review was decisive here — three passes caught, in turn, the upsert_node_with_parent bypass and the bulk_create_has_child cold-sweep bypass that a service-only guard would have shipped. 980 lib + integration + doctests green.
Follow-up: the cold-sweep now produces permanent root-only rejections on the has_child batch as well as member_of; nodespace-sync#378 is updated to classify both as permanent (skip + advance the cursor) so a contradicting incoming edge can't wedge the sweep.
Activity
mstomar125 commentedon Jul 28, 2026
Resolved by #1772 (squash-merged
fd5b417c).The reparent side of ADR-059 §2 (issue #1742's criterion 8) is now enforced at the store's two
has_childattach-an-existing-node sites —SqliteStore::move_node(covers the servicemove_nodeoutline-edit path and theupsert_node_with_parentgRPC /save_node_with_parentpath) andSqliteStore::bulk_create_has_child(the sync-apply cold sweep) — symmetric with #1742's forward guard onmember_ofinserts. A node holding amember_ofedge cannot be given ahas_childparent; the move is rejected (not silently dropped — a node may hold several grants, each an independent access path) with an error naming the collections. Collection and person nodes are exempt; moving a member to root stays allowed.Adversarial review was decisive here — three passes caught, in turn, the
upsert_node_with_parentbypass and thebulk_create_has_childcold-sweep bypass that a service-only guard would have shipped. 980 lib + integration + doctests green.Follow-up: the cold-sweep now produces permanent root-only rejections on the
has_childbatch as well asmember_of; nodespace-sync#378 is updated to classify both as permanent (skip + advance the cursor) so a contradicting incoming edge can't wedge the sweep.