Skip to content

feat: upgrade Apache Tinkerpop Gremlin from 3.7.5 to 3.8.0 - #3667

Merged
robfrank merged 1 commit into
mainfrom
imp/upgrade-gremlin
Mar 16, 2026
Merged

robfrank merged 1 commit into
mainfrom
imp/upgrade-gremlin

Conversation

@robfrank

Copy link
Copy Markdown
Collaborator

Summary

  • Upgrades gremlin.version from 3.7.5 to 3.8.0 in gremlin/pom.xml
  • Adapts GremlinValueComparator to 3.8.0 API changes: GremlinTypeErrorException removed (replaced with IllegalStateException), comparable() visibility changed from private to public
  • Updates longOverflow test to expect ArithmeticException (Gremlin 3.8.0 no longer silently wraps on long overflow in sum())

Test plan

  • Gremlin module compiles cleanly
  • All 236 gremlin tests pass (0 failures, 0 errors)
  • Full project builds successfully (22/22 modules)

🤖 Generated with Claude Code

Adapt to breaking changes in Tinkerpop 3.8.0:
- GremlinTypeErrorException removed, replaced with IllegalStateException
- GremlinValueComparator.comparable() changed from private to public
- sum() now throws ArithmeticException on long overflow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 focuses on upgrading the core Apache Tinkerpop Gremlin library to its latest stable version, 3.8.0. This upgrade necessitated several code adjustments to align with the updated API, primarily in how certain exceptions are handled and method visibilities. Additionally, a specific test case was modified to correctly reflect changes in how long integer overflows are managed within Gremlin's sum operations, ensuring continued correctness and compatibility with the new library version.

Highlights

  • Dependency Upgrade: Upgraded the Apache Tinkerpop Gremlin dependency from version 3.7.5 to 3.8.0.
  • API Adaptation: Adapted the GremlinValueComparator class to reflect API changes in Gremlin 3.8.0, specifically replacing GremlinTypeErrorException with IllegalStateException and changing the visibility of the comparable() method to public.
  • Test Update: Updated the longOverflow test in GremlinTest.java to account for Gremlin 3.8.0's new behavior where sum() throws an ArithmeticException on long overflow instead of silently wrapping.

🧠 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
  • gremlin/pom.xml
    • Updated the gremlin.version property from 3.7.5 to 3.8.0.
  • gremlin/src/main/java/org/apache/tinkerpop/gremlin/util/GremlinValueComparator.java
    • Removed the import for GremlinTypeErrorException.
    • Replaced GremlinTypeErrorException with IllegalStateException in exception handling blocks.
    • Changed the throwTypeError method to throw IllegalStateException instead of GremlinTypeErrorException.
    • Modified the comparable method's access modifier from private to public.
  • gremlin/src/test/java/com/arcadedb/gremlin/GremlinTest.java
    • Updated the longOverflow test to expect an ArithmeticException when sum() encounters a long overflow, aligning with Gremlin 3.8.0's behavior.
Activity
  • Gremlin module compiles cleanly.
  • All 236 gremlin tests pass (0 failures, 0 errors).
  • Full project builds successfully (22/22 modules).
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@robfrank robfrank added this to the 26.4.1 milestone Mar 16, 2026
@robfrank robfrank added the enhancement New feature or request label Mar 16, 2026
@claude

claude Bot commented Mar 16, 2026

Copy link
Copy Markdown

Code Review

Overall this is a clean, well-scoped upgrade. The diff is minimal and the test plan is solid. A few points worth considering:


IllegalStateException catch is semantically too broad

File: GremlinValueComparator.java:133

The old code caught GremlinTypeErrorException, a purpose-built exception with a single, well-defined cause. The replacement catches IllegalStateException, which is a standard Java runtime exception thrown by many unrelated things (iterators, concurrent modification, framework internals, etc.).

The risk: if an unrelated IllegalStateException is thrown deep inside comparator(type).compare(f, s) (e.g., inside a custom Comparator registered by a user type), it will be silently swallowed and equals() will return false — a hard-to-diagnose silent failure.

Suggestion: Consider wrapping the thrown exception with a sentinel message to narrow the catch:

// in throwTypeError():
throw new IllegalStateException("GremlinTypeError");

// in the catch block:
} catch (IllegalStateException ex) {
    if (!"GremlinTypeError".equals(ex.getMessage()))
        throw ex;
    // type error -> false for equality
    return false;
}

This preserves the intent of the original GremlinTypeErrorException pattern without requiring the removed class.


throwTypeError() message is empty

File: GremlinValueComparator.java:161

throw new IllegalStateException() has no message, making stack traces and logs much harder to diagnose. At minimum, add a descriptive message:

throw new IllegalStateException("Gremlin type error: incompatible types for comparison");

comparable() visibility change to public

File: GremlinValueComparator.java:303

This is a necessary adaptation to Gremlin 3.8.0's API change (the upstream now calls this method externally). The change is correct. It does expose internal logic, but since this class lives in the org.apache.tinkerpop.gremlin.util package — already a Gremlin namespace — it aligns with the upstream's design intent.


Behavioral breaking change — long overflow

File: GremlinTest.java:438-440

The longOverflow test correctly reflects the new Gremlin 3.8.0 behavior. However, this is a user-visible breaking change: queries that previously relied on silent wrapping (e.g., g.inject(Long.MAX_VALUE, 1).sum() silently returning Long.MIN_VALUE) will now throw ArithmeticException. This should be called out in the release notes / CHANGELOG so users can update their queries to use BigInteger when overflow is possible.


Test coverage looks good

The three test scenarios (no-overflow path still works, overflow throws ArithmeticException, BigInteger path unaffected) provide adequate regression coverage for this change. The existing 236 gremlin tests passing gives good confidence. No additional tests needed.


Summary: The upgrade is correct and the test plan is well-executed. The main actionable item is the overly-broad IllegalStateException catch — worth addressing to prevent silent miscomparisons in edge cases.

@mergify

mergify Bot commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

🧪 CI Insights

Here's what we observed from your CI run for 51510a8.

🟢 All jobs passed!

But CI Insights is watching 👀

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request upgrades Apache Tinkerpop Gremlin from version 3.7.5 to 3.8.0. The changes correctly adapt the codebase to the API modifications in the new version, including replacing the deprecated GremlinTypeErrorException with IllegalStateException and adjusting method visibility. The test suite has also been updated to reflect behavior changes in Gremlin's sum() step. My review includes a suggestion to add a descriptive message to the thrown IllegalStateException to improve diagnostics and code robustness. Overall, the changes are well-aligned with the goal of the upgrade.


private static <T> T throwTypeError() {
throw new GremlinTypeErrorException();
throw new IllegalStateException();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a generic IllegalStateException without a message can make debugging difficult, as it might be caught and swallowed by handlers expecting a type error, even if it originates from a different issue. To improve robustness and diagnostics, I suggest adding a specific message to this exception. This makes it possible for catch blocks (like the one in equals()) to be more specific if needed, and helps clarify the exception's purpose when it's logged.

Suggested change
throw new IllegalStateException();
throw new IllegalStateException("Type error during Gremlin value comparison");

@robfrank
robfrank merged commit ba4ab12 into main Mar 16, 2026
23 of 27 checks passed
@codacy-production

codacy-production Bot commented Mar 16, 2026

Copy link
Copy Markdown

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-9.46% 50.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (c05883c) 109689 81919 74.68%
Head commit (51510a8) 140633 (+30944) 91725 (+9806) 65.22% (-9.46%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3667) 2 1 50.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@codecov

codecov Bot commented Mar 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 65.80%. Comparing base (cb5e508) to head (51510a8).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...tinkerpop/gremlin/util/GremlinValueComparator.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3667      +/-   ##
==========================================
- Coverage   65.86%   65.80%   -0.06%     
==========================================
  Files        1550     1550              
  Lines      109689   109689              
  Branches    22875    22875              
==========================================
- Hits        72245    72182      -63     
- Misses      27762    27818      +56     
- Partials     9682     9689       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

robfrank added a commit that referenced this pull request May 12, 2026
tae898 pushed a commit to humemai/arcadedb-embedded-python that referenced this pull request Jun 28, 2026
@lvca
lvca deleted the imp/upgrade-gremlin branch July 3, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant