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
create_relationship_in_tx's reverse-cardinality scoping (added in core#2804) resolves which existing edges belong to the same declaration being validated via type_satisfies(existing_source_type, declaring_type) — an ADR-078 ancestor-chain-membership check ("is declaring_type somewhere in existing_source_type's chain"), not an ownership-equality check ("does existing_source_type's own nearest-first resolution of this relationship name also land on declaring_type").
Why it can diverge
Those two checks normally agree, but diverge if a schema's own relationship declaration is ever set to shadow an inherited one via NodeService::set_schema_relationships called directly — a lower-level method that bypasses the cross-chain-collision validation create_schema/update_schema normally run. In that scenario, type_satisfies would still say an edge "belongs" to the ancestor's declaration by chain membership, even though the shadowing schema's own nearest-first resolution of the same relationship name now points at a different declaration.
Current reachability
Verified during core#2804 review: set_schema_relationships's only current callers are internal test helpers — it is not reachable through the CLI, agent tools, or the daemon RPC surface today. This is a real soundness gap in the data model/API surface, not a currently-exploitable bug through any real user path. Filed for tracking, not urgency.
Suggested fix (don't implement without discussion — bigger than a one-line change)
Replace the ancestor-membership check with an owners-map-equality check (resolve_relationships's existing owner map, compared for equality rather than membership), or
Better: persist the declaring schema id as a column on the relationship row itself at edge-creation time, so eviction/reverse-cardinality scoping becomes a correct-by-construction lookup regardless of future schema-graph shape changes — this is the more robust fix but is architecturally bigger (a schema/DDL change, which per this repo's greenfield rules means a create_schema DDL edit + database reset, not a migration).
Acceptance criteria
Decide which fix approach to take (equality-check patch vs. persisted-declaring-schema column)
set_schema_relationships's shadowing scenario no longer misattributes reverse-cardinality-one eviction scope
Test: a schema declaration that shadows an inherited relationship of the same name is scoped correctly by create_relationship's reverse-cardinality check
Activity
Scope reverse-cardinality eviction by ownership equality (#2909) (#3282)