Skip to content

Self-referencing entities related fixes. #605

@fractlrao

Description

@fractlrao
  1. Self-referencing relationship queries return wrong results — When both sides of a between relationship point to the same entity (e.g., relationship ReportsTo between(Employee @as manager, Employee @as reportee)), the system can't distinguish which side a given instance belongs to. Querying "who are Alice's reportees?" could return incorrect results because the runtime always treats the connected instance as being on the first side of the relationship.
  2. Self-referencing one-to-one relationships fail on entity creation — Declaring a one-to-one self-referencing relationship (e.g., relationship Spouse between(Person @as husband, Person @as wife) @one_one) causes entity creation to fail with a NOT NULL constraint error, making one-to-one self-ref unusable.
  3. Self-referencing one-to-one relationships don't enforce exclusivity — Even after fixing creation, a one-to-one self-referencing relationship silently allows re-pairing without unpairing first. For example, if Alice is married to Bob, marrying Alice to Carol succeeds without error instead of being rejected. The constraint is only enforced after an explicit unpair/divorce step.
  4. Potential infinite loop with self-referencing relationships — The internal relationship graph walker has no cycle detection, risking infinite recursion when processing self-referencing relationships.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions