Fix relation direction creation with merge and create, fixes #3326#3353
Fix relation direction creation with merge and create, fixes #3326#3353robfrank merged 1 commit intoArcadeData:mainfrom
Conversation
Summary of ChangesHello @ExtReMLapin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request fixes a bug where relationship direction was not correctly handled during Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses issue #3326 by handling relationship direction in CREATE and MERGE operations. The logic for swapping from and to vertices for incoming relationships is correct.
However, I have two suggestions for improvement:
- Testing: As you noted in the description, tests are missing. It is important to add regression tests to
OpenCypherCreateTest.javaandOpenCypherMergeTest.javato verify the fix for incoming relationship directions and prevent future regressions. A test case could involve creating/merging a pattern like(a)<-[:REL]-(b)and asserting that the edge is created frombtoa. - Code Duplication: The logic to determine the
fromandtovertices is duplicated acrossCreateStep.javaandMergeStep.java. I've left a comment with a suggestion to refactor this.
Addressing these points will make the contribution even stronger.
| final Vertex fromVertex; | ||
| final Vertex toVertex; | ||
|
|
||
| if (relPattern.getDirection() == Direction.IN) { | ||
| fromVertex = vertices.get(i + 1); | ||
| toVertex = vertices.get(i); | ||
| } else { | ||
| fromVertex = vertices.get(i); | ||
| toVertex = vertices.get(i + 1); | ||
| } |
There was a problem hiding this comment.
This logic for determining fromVertex and toVertex is duplicated in MergeStep.java (lines 282-291). To adhere to the DRY (Don't Repeat Yourself) principle and improve maintainability, please consider extracting this logic into a common helper method that can be used by both CreateStep and MergeStep.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3353 +/- ##
==========================================
- Coverage 56.97% 56.94% -0.03%
==========================================
Files 1368 1368
Lines 100624 100630 +6
Branches 20490 20492 +2
==========================================
- Hits 57326 57303 -23
- Misses 34205 34223 +18
- Partials 9093 9104 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🧪 CI InsightsHere's what we observed from your CI run for 3bbc685. 🟢 All jobs passed!But CI Insights is watching 👀 |
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.9 to 4.31.10. Release notes *Sourced from [github/codeql-action's releases](https://github.com/github/codeql-action/releases).* > v4.31.10 > -------- > > CodeQL Action Changelog > ======================= > > See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs. > > 4.31.10 - 12 Jan 2026 > --------------------- > > * Update default CodeQL bundle version to 2.23.9. [ArcadeData#3393](https://redirect.github.com/github/codeql-action/pull/3393) > > See the full [CHANGELOG.md](https://github.com/github/codeql-action/blob/v4.31.10/CHANGELOG.md) for more information. Changelog *Sourced from [github/codeql-action's changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md).* > CodeQL Action Changelog > ======================= > > See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs. > > [UNRELEASED] > ------------ > > No user facing changes. > > 4.31.10 - 12 Jan 2026 > --------------------- > > * Update default CodeQL bundle version to 2.23.9. [ArcadeData#3393](https://redirect.github.com/github/codeql-action/pull/3393) > > 4.31.9 - 16 Dec 2025 > -------------------- > > No user facing changes. > > 4.31.8 - 11 Dec 2025 > -------------------- > > * Update default CodeQL bundle version to 2.23.8. [ArcadeData#3354](https://redirect.github.com/github/codeql-action/pull/3354) > > 4.31.7 - 05 Dec 2025 > -------------------- > > * Update default CodeQL bundle version to 2.23.7. [ArcadeData#3343](https://redirect.github.com/github/codeql-action/pull/3343) > > 4.31.6 - 01 Dec 2025 > -------------------- > > No user facing changes. > > 4.31.5 - 24 Nov 2025 > -------------------- > > * Update default CodeQL bundle version to 2.23.6. [ArcadeData#3321](https://redirect.github.com/github/codeql-action/pull/3321) > > 4.31.4 - 18 Nov 2025 > -------------------- > > No user facing changes. > > 4.31.3 - 13 Nov 2025 > -------------------- > > * CodeQL Action v3 will be deprecated in December 2026. The Action now logs a warning for customers who are running v3 but could be running v4. For more information, see [Upcoming deprecation of CodeQL Action v3](https://github.blog/changelog/2025-10-28-upcoming-deprecation-of-codeql-action-v3/). > * Update default CodeQL bundle version to 2.23.5. [ArcadeData#3288](https://redirect.github.com/github/codeql-action/pull/3288) > > 4.31.2 - 30 Oct 2025 > -------------------- > > No user facing changes. > > 4.31.1 - 30 Oct 2025 > -------------------- > > * The `add-snippets` input has been removed from the `analyze` action. This input has been deprecated since CodeQL Action 3.26.4 in August 2024 when this removal was announced. > > 4.31.0 - 24 Oct 2025 > -------------------- ... (truncated) Commits * [`cdefb33`](github/codeql-action@cdefb33) Merge pull request [ArcadeData#3394](https://redirect.github.com/github/codeql-action/issues/3394) from github/update-v4.31.10-0fa411efd * [`cfa77c6`](github/codeql-action@cfa77c6) Update changelog for v4.31.10 * [`0fa411e`](github/codeql-action@0fa411e) Merge pull request [ArcadeData#3393](https://redirect.github.com/github/codeql-action/issues/3393) from github/update-bundle/codeql-bundle-v2.23.9 * [`c284324`](github/codeql-action@c284324) Add changelog note * [`83e7d00`](github/codeql-action@83e7d00) Update default bundle to codeql-bundle-v2.23.9 * [`f6a16be`](github/codeql-action@f6a16be) Merge pull request [ArcadeData#3391](https://redirect.github.com/github/codeql-action/issues/3391) from github/dependabot/npm\_and\_yarn/npm-minor-f1cdf5... * [`c1f5f1a`](github/codeql-action@c1f5f1a) Rebuild * [`1805d8d`](github/codeql-action@1805d8d) Bump the npm-minor group with 2 updates * [`b2951d2`](github/codeql-action@b2951d2) Merge pull request [ArcadeData#3353](https://redirect.github.com/github/codeql-action/issues/3353) from github/kaspersv/bump-min-cli-v-for-overlay * [`41448d9`](github/codeql-action@41448d9) Merge pull request [ArcadeData#3287](https://redirect.github.com/github/codeql-action/issues/3287) from github/henrymercer/generate-mergeback-last * Additional commits viewable in [compare view](github/codeql-action@5d4e8d1...cdefb33) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
fixes #3326
All cypher tests passes, didn't write any test for them, feel free to add them