Repository navigation
fix(#6573): isEdgeVariableReferenced has no CREATE/MERGE case - #6689
Conversation
The top-level switch in CypherVariableUsage.isEdgeVariableReferenced
had no case for CREATE/MERGE, so a top-level CREATE/MERGE clause fell
to default and was never inspected. An edge read only inside a
CREATE/MERGE inline property (e.g. CREATE (c {prop: r.x})) was
therefore anonymized and silently evaluated to null instead of the
real value.
Mirror foreachReferencesVariable's existing conservative handling of
nested CREATE/MERGE: keep the edge binding whenever a top-level
CREATE/MERGE clause is present, since enumerating its inline property
expressions cheaply is awkward.
|
Warning Review limit reachedNext included review available in 26 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
ReviewSmall, well-scoped fix — a Correctness
Performance
Tests
Docs
SecurityNo concerns — this is a pure control-flow fix in query-plan analysis, no new I/O, parsing, or trust boundary involved. Overall: correct, minimal, well-tested fix for a real silent-data-loss bug. The performance note above is the only thing I'd want acknowledged (even just in the PR discussion) before merging, not a required change. |
|
Tick the box to add this pull request to the merge queue (same as
|
|
@claude review |
|
Claude finished @robfrank's task in 1m 2s —— View job Review
Re-reviewed the current state of the branch (not just the diff) directly from the checked-out files. Correctness
Tests
Docs
Performance note (non-blocking, already raised in-thread)Every top-level CREATE/MERGE after a MATCH-bound edge now skips the CSR/GAV fast path unconditionally, even when the new pattern doesn't actually reference the edge (e.g. VerdictSmall, correct, well-tested fix for a genuine silent-data-loss bug (relationship property silently reading as |
Closes #6573
Summary
CypherVariableUsage.isEdgeVariableReferenceddecides whether a MATCH-bound relationship variablekeeps its real binding (vs. being anonymized for the CSR/GAV fast path) by walking every clause type
in
statement.getClausesInOrder(). The top-level switch handledRETURN,WITH,UNWIND,SET,REMOVE,DELETE,FOREACH,SUBQUERY- but had nocase CREATE/case MERGE, so a top-levelCREATE/MERGE clause fell to
defaultand was never inspected.Contrast with
foreachReferencesVariable's own inner switch (same file), which already treats anested
CREATE/MERGEconservatively:The top-level switch never got the same treatment.
Reproduction
Expected:
s = 2001. Actual (before fix):s = null- the relationship step boundrunder aninternal anonymous name (nothing else in the query appeared, to this check, to reference it), so the
CREATE clause's
r.sinceread a missing binding and silently evaluated tonull.Fix
Added a
case CREATE: case MERGE:arm to the top-level switch inisEdgeVariableReferenced,mirroring
foreachReferencesVariable's conservativereturn true. A false positive there onlyforgoes the CSR/GAV fast path; a false negative silently drops a still-referenced edge, which is the
failure class this whole method exists to prevent (same reasoning that motivated #6567's fix).
File:
engine/src/main/java/com/arcadedb/query/opencypher/executor/CypherVariableUsage.javaTest plan
CypherVariableUsageTest.createReadsItInAnInlineProperty/.mergeReadsItInAnInlineProperty-unit-level checks parallel to the existing cases in that file (
setReadsItAsTargetAndAsValue,removeReadsIt, etc.). Verified to fail (asserttrue, gotfalse) without the fix.Issue6573CreateMergeEdgeVariableTest- new end-to-end regression test running the issue's ownreproducer through the real Cypher engine. Verified to fail with a
nullresult (matching theissue's reported symptom exactly) without the fix, via a temporary stash of the production
change.
com.arcadedb.query.opencypher.**package (excluding benchmark/slow/vector lanes): 8906tests, 0 failures, 0 errors, 98 skipped (pre-existing, unrelated).
🤖 Generated with Claude Code