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 }}
This repository was archived by the owner on Oct 30, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 30, 2026. It is now read-only.
fix: duplicate edges on re-ingestion — replace CREATE with MERGE in upsert_relations() and add_graph_documents() #21
Re-ingesting the same data creates duplicate edges. Every call to upsert_relations() (LlamaIndex) or add_graph_documents() (LangChain) creates new edges unconditionally:
# First ingeststore.upsert_relations([Relation(label="KNOWS", source_id="alice", target_id="bob")])
# Second ingest — creates a DUPLICATE edgestore.upsert_relations([Relation(label="KNOWS", source_id="alice", target_id="bob")])
This makes repeated indexing non-idempotent and bloats the graph.
Root cause
CoordiNode Cypher does not support MERGE for relationship patterns — only for node patterns (NodeScan). The adapters work around this with CREATE, accepting duplicate edges as a known limitation.
Tracked as G072 in CoordiNode DB repository: MERGE (src)-[r:TYPE]->(dst) fails with "MERGE create from non-NodeScan pattern".
test_add_graph_documents_idempotent: change assertion from cnt >= 1 to cnt == 1
Add similar idempotency test for LlamaIndex upsert_relations()
Acceptance criteria
Re-ingesting the same document creates exactly 1 edge (not N)
upsert_relations() is idempotent
add_graph_documents() is idempotent for both nodes and edges
All existing tests pass
Gate
Blocked by G072 — requires CoordiNode DB fix: MERGE clause for relationship patterns in Cypher executor.
Do not start SDK implementation until a CoordiNode release with G072 fixed is available.
Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.
Create Plan
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
💬 Have feedback or questions? Drop into our discord!
Implemented in commit 6d009a7 — CoordiNode 0.3.2 (0.4.0 SDK dep) resolved G072, so both adapters now use MERGE for relationships. Test added in 3316a69: test_upsert_relations_idempotent verifies exactly 1 edge after double upsert.
Activity
coderabbitai commentedon Apr 11, 2026
🔗 Related PRs
#15 - fix: CoordiNode Cypher compatibility — add_graph_documents, type/label, MATCH+CREATE [closed]
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
polaz commentedon Apr 12, 2026
Implemented in commit
6d009a7— CoordiNode 0.3.2 (0.4.0 SDK dep) resolved G072, so both adapters now useMERGEfor relationships. Test added in3316a69:test_upsert_relations_idempotentverifies exactly 1 edge after double upsert.test(llama-index): add upsert_relations() idempotency test