Fix gremlin-go negative BigInteger decoding and P.outside()#3522
Open
GumpacG wants to merge 1 commit into
Open
Fix gremlin-go negative BigInteger decoding and P.outside()#3522GumpacG wants to merge 1 commit into
GumpacG wants to merge 1 commit into
Conversation
Assisted-by: Kiro: Claude Opus 4.8
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3522 +/- ##
============================================
+ Coverage 76.35% 76.46% +0.10%
- Complexity 13424 14272 +848
============================================
Files 1012 1036 +24
Lines 60341 64527 +4186
Branches 7075 7650 +575
============================================
+ Hits 46076 49338 +3262
- Misses 11548 12097 +549
- Partials 2717 3092 +375 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gremlin-go bug fixes
Two gremlin-go bugs introduced in 4.0.0-beta.2. Both made gremlin-go the only
GLV producing incorrect results; the fixes align it with gremlin-java,
gremlin-python, gremlin-dotnet, and gremlin-javascript.
1. Negative BigInteger / BigDecimal decoded incorrectly
Problem:
readBigIntreconstructed negative two's-complement values with a bitwidth one byte too wide (
(len(b)+1)*8instead oflen(b)*8), so it subtracted apower of two that was 256x too large. Positive values were unaffected. Negative
BigDecimalvalues were affected too, because their unscaled value decodes throughthe same path. Go was the only GLV with this bug because it hand-rolls the
conversion (
math/bighas no signed-bytes constructor), while the other GLVsdelegate to a correct standard-library primitive.
Use case: a ledger service stores account balances as arbitrary-precision integers
so they never overflow. Account
acct-1is overdrawn by 500, stored as theBigInteger-500.Before:
The application reads a balance of -16,712,180 for an account that is only 500
overdrawn. The error is silent, so it can flow into downstream calculations,
alerts, or stored data before anyone notices.
After:
2. P.outside() generated invalid gremlin-lang
Problem:
translatePValuelist-wrapped the arguments of any multi-value predicateexcept
betweenandinside, butoutsidewas omitted from that exclusion.outsidetakes exactly two arguments in the grammar (likebetween/inside), sothey must be comma-separated, not wrapped in a list.
Use case: an anomaly-detection query finds sensor readings outside the normal
operating range of 18 to 65 (too cold or too hot).
Before:
The query never runs. Because the identical query works from the Java, Python,
.NET, and JavaScript drivers, the failure looks like a server or environment
problem rather than a driver bug, and
P.Outsideis effectively unusable from Go.After: