Skip to content

Fix gremlin-python GremlinLang equality and submitAsync bugs#3520

Open
GumpacG wants to merge 2 commits into
apache:masterfrom
GumpacG:python-bugs
Open

Fix gremlin-python GremlinLang equality and submitAsync bugs#3520
GumpacG wants to merge 2 commits into
apache:masterfrom
GumpacG:python-bugs

Conversation

@GumpacG

@GumpacG GumpacG commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

gremlin-python bug fixes

Two bugs introduced in 4.0.0-beta.1 during the Bytecode-to-GremlinLang
migration.

1. GremlinLang.__eq__ ignores the query

File: gremlin_python/process/traversal.py

__eq__ compared self.gremlin to itself instead of to other.gremlin, so
equality depended only on the parameters and ignored the actual steps.

Problem use case

a = g.V().count().gremlin_lang
b = g.V().drop().gremlin_lang
a == b

Behaviour

Result
Before True - two completely different queries (with equal/empty parameters) compare equal
After False - equality now considers the query steps as well as the parameters

2. DriverRemoteConnection.submitAsync is broken (removed)

File: gremlin_python/driver/driver_remote_connection.py

The deprecated submitAsync alias forwarded three positional arguments to
submit_async, which had been narrowed to a single gremlin_lang argument in
4.x, and it never returned the future - so it could not work at all. Rather than
repair a deprecated method, it has been removed (per PR review), with an upgrade
note directing users to submit_async().

Problem use case

conn = DriverRemoteConnection('http://localhost:8182/gremlin', 'g')
future = conn.submitAsync(gremlin_lang)
result = future.result()

Behaviour

Result
Before Raises TypeError: submit_async() takes 2 positional arguments but 4 were given; even setting that aside it returned None instead of a future
After submitAsync is removed; use submit_async(gremlin_lang), which returns the Future (resolving to a RemoteTraversal)

Tests

  • tests/unit/process/test_gremlin_lang.py: equality of traversals with
    different steps / equal params, equal objects, differing params, and
    non-GremlinLang comparison.
  • tests/unit/driver/test_remote_connection.py: submitAsync emits the
    deprecation warning, forwards a single argument, returns a Future resolving
    to a RemoteTraversal, and no longer raises TypeError.

Assisted-by: Kiro: Claude Opus 4.8

@codecov-commenter

codecov-commenter commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.41%. Comparing base (a28cd1f) to head (c26d4c4).
⚠️ Report is 277 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3520      +/-   ##
============================================
+ Coverage     76.35%   76.41%   +0.05%     
- Complexity    13424    14269     +845     
============================================
  Files          1012     1036      +24     
  Lines         60341    64527    +4186     
  Branches       7075     7650     +575     
============================================
+ Hits          46076    49306    +3230     
- Misses        11548    12129     +581     
- Partials       2717     3092     +375     

☔ View full report in Codecov by Harness.
📢 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.

@xiazcy

xiazcy commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

VOTE +1

Comment thread gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py Outdated
@Cole-Greer

Copy link
Copy Markdown
Contributor

Building on my comment above, I'd like to either remove submitAsync() now, or open a JIRA to track it. I'm happy with either of those directions for this PR.

VOTE +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants