BE-925: Reject links whose left and right entity are the same - #9898
claude[bot] wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9898 +/- ##
==========================================
+ Coverage 66.50% 66.53% +0.03%
==========================================
Files 1954 1954
Lines 215334 215408 +74
Branches 8420 8431 +11
==========================================
+ Hits 143200 143327 +127
+ Misses 70535 70477 -58
- Partials 1599 1604 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Both red integration checks come from this PR's check, not from main:
All three pass locally with the check reverted. Whether self-links should be rejected at all is being discussed in Slack, so I'm holding the fix until that's decided: either update these tests and skip Generated by Claude Code |
Requested by Tim Diekmann · Slack thread
🌟 Purpose
The Graph accepts a link entity whose left and right entity are the same entity, for example a friendship link from a person to that same person. We agreed to disallow these by default. This PR rejects link data whose left entity ID equals its right entity ID. Allowing self-links per link type is left for BE-926.
🔍 Changes
LinkDataStateError::SelfReferentialvariant ("selfReferential"in the API), whose error names the entity. It sits next to the existingmissingandunexpectedlink data errors, and the OpenAPI spec gains the matching variant.left_entity_idandright_entity_idas wholeEntityIds, so it includes the web ID and draft ID.--skip-link-validationalso skips it.POST /entities/validate, and entity patches all go through this validation.hash-graph-validationcover a self-link and a link between two entities.friendship.httpnow validates and then tries to insert a link from a person to itself, and expects both to be rejected.Patching an entity reruns link validation on its unchanged link data. So once this is merged, any patch to a self-link that already exists, archiving included, fails validation unless link validation is skipped.