feat(#4890): native Bolt Duration, Point, Path + semantic errors (#4997, #4998, #4999)#5006
Conversation
|
Tick the box to add this pull request to the merge queue (same as
|
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| CodeStyle | 4 minor |
🟢 Metrics 53 complexity
Metric Results Complexity 53
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.
|
Review: native Bolt Duration / Point / Path + semantic errors (4997, 4998, 4999) Reviewed the full diff. Well-scoped, cleanly mirrors the existing temporal work (4907), and has strong module-level test coverage on both outbound encoding and inbound decoding. The Potential issues 1. The semantic-validator retarget is broader than ERR-002 and may misclassify some errors vs. real Neo4j. 2. Structural Point detection can misencode legitimate user maps on the outbound path. 3. Test coverage
Security / performance Overall a solid PR that closes the three sub-issues cleanly. Main ask: double-check the breadth of the |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
Addressed in f2181f7. 1. Semantic-validator retarget breadth. Correct - the wholesale sed over-broadened beyond what ERR-002 certifies. Scoped it back: only the 8 2. Structural Point detection. Correct footgun. Tightened 3. Empty-path guard. Added - Test gaps. Also removed the now-dead |
|
/gemini review |
Review: native Bolt Duration/Point/Path + semantic errors (#4997, #4998, #4999)Solid, well-structured PR. TDD throughout, the backward-compat design ( A few points, none of them blockers: 1. PR description no longer matches the code (please reconcile)The description says the change is a "wholesale semantic-validator retarget" and follow-up note #2 warns that This is arguably better than described (it sidesteps the 2. Semantic-vs-syntax classification is now partialAs a consequence of (1), ArcadeDB now returns 3. Outbound Point has no engine-level module test (only hand-built maps + CI e2e)
4.
|
There was a problem hiding this comment.
Code Review
This pull request implements native Bolt serialization and deserialization for Duration, Point, and Path structures, and enables the distinction between semantic and syntax errors. It introduces BoltPointStructure, maps TraversalPath to BoltPath, and decodes inbound Bolt Duration and Point structures. It also introduces CommandSemanticException to classify semantic errors separately from syntax errors. Conformance tests across multiple languages have been updated to reflect these improvements. The review feedback highlights a potential NullPointerException in BoltStructureMapper.toPointStructure when a map contains a null value for the "crs" key, as Set.of(...) is null-hostile; a code suggestion is provided to address this issue.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| static BoltPointStructure toPointStructure(final Object value) { | ||
| if (!(value instanceof Map<?, ?> map) || !map.containsKey("crs")) | ||
| return null; | ||
| if (!RECOGNIZED_CRS.contains(map.get("crs")) && !(map.get("srid") instanceof Number)) | ||
| return null; |
There was a problem hiding this comment.
The RECOGNIZED_CRS set is initialized using Set.of(...), which is null-hostile in Java. Calling RECOGNIZED_CRS.contains(null) will throw a NullPointerException. If a client passes a map where the "crs" key is present but its value is null (e.g., {"crs": null, "x": 1.0, "y": 2.0}), map.containsKey("crs") will return true, and then map.get("crs") will return null, causing a NullPointerException when RECOGNIZED_CRS.contains(null) is evaluated.
To prevent this, check if the "crs" value is null before querying the set.
| static BoltPointStructure toPointStructure(final Object value) { | |
| if (!(value instanceof Map<?, ?> map) || !map.containsKey("crs")) | |
| return null; | |
| if (!RECOGNIZED_CRS.contains(map.get("crs")) && !(map.get("srid") instanceof Number)) | |
| return null; | |
| static BoltPointStructure toPointStructure(final Object value) { | |
| if (!(value instanceof Map<?, ?> map) || !map.containsKey("crs")) | |
| return null; | |
| final Object crs = map.get("crs"); | |
| if ((crs == null || !RECOGNIZED_CRS.contains(crs)) && !(map.get("srid") instanceof Number)) | |
| return null; |
There was a problem hiding this comment.
Fixed in 2251567. The crs value is now null-checked before the RECOGNIZED_CRS lookup, so {crs: null, x, y} no longer NPEs - it falls through to generic map handling (no recognized crs value and no numeric srid). Added a regression test asserting that map returns a Map, not a Point.
|
Addressed in 2251567 + PR description update. 1. Stale PR text. Correct - the "wholesale retarget" wording predated the cycle-1 scoping. Updated the description: classification is now explicitly scoped to the 2. Partial semantic/syntax split. Intentional, now documented. Added a comment at the head of 3. No engine-level outbound Point test. Added 4. Minor. Renamed On the two CI reds that are not from this change: the Meterian NodeJS security finding is in base/ |
|
/gemini review |
Review: native Bolt Duration/Point/Path + semantic errorsOverall this is a clean, well-structured PR. It follows the repo's TDD conventions (tests-first, AssertJ, A few observations, mostly minor. Correctness / behavior
Minor / nits
Performance / security
Test coverageExcellent. The only gap I'd note is that Nothing here is blocking. LGTM pending the maintainer's call on the Point-detection tradeoff. |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
Addressed the concrete test-coverage item in 78e56f3. Revisited-node / cycle path test. Added to On the remaining observations:
|
|
/gemini review |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| CodeStyle | 4 minor |
🟢 Metrics 53 complexity
Metric Results Complexity 53
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.
There was a problem hiding this comment.
Code Review
This pull request implements native Bolt Duration, Point, and Path structures, and distinguishes semantic from syntax errors. Specifically, it introduces the BoltPointStructure class, adds outbound and inbound mapping for TraversalPath, CypherDuration, and spatial point maps in BoltStructureMapper, and creates a new CommandSemanticException to classify undefined variable errors as SEMANTIC_ERROR rather than SYNTAX_ERROR. Additionally, it updates the conformance specification and end-to-end test suites across C#, Go, JavaScript, Python, and Java to mark these scenarios as passing. There are no review comments to assess, so no feedback on comments is provided.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Review: native Bolt Duration/Point/Path + semantic errors (#4997/#4998/#4999)Reviewed the final combined diff (the review commits correctly re-scoped the semantic-error change after the initial broad retarget). Overall this is a clean, well-tested PR: TDD is evident, comments explain the wire-format reasoning, the exception change is genuinely backward-compatible ( A few observations, none blocking: 1. Point detection is looser than the PR description states (worth tightening)
Consequence: a user query returning a plain map that happens to carry a 2. Semantic-error classification is keyed on message prefix / call site, not error natureOnly the 8 One small note: the 3. Minor:
|
|
Thanks for the close read. On the four points: 1. Point detection already validates the crs value. The guard isn't presence-only - if (!(value instanceof Map<?, ?> map) || !map.containsKey("crs"))
return null;
final Object crs = map.get("crs");
if ((crs == null || !RECOGNIZED_CRS.contains(crs)) && !(map.get("srid") instanceof Number))
return null;So 2. Message-prefix-driven split. Agreed it's call-site/message driven rather than a typed taxonomy, and the 3. Point check ahead of primitives. Leaving as-is. 4. Full echo round-trip. Added in d385984: encode |
Review: native Bolt Duration/Point/Path + semantic errors (#4997, #4998, #4999)Overall this is a clean, well-scoped, and thoroughly tested PR. The design mirrors the existing temporal work (#4907), reuses the A few observations, mostly minor / for confirmation: Correctness & design
Test coverage
Nits
None of these are blocking. The hard gate (bolt module tests + the five e2e suites) plus the added unit tests give good confidence. LGTM pending the maintainers' call on the Point-as-map inbound fidelity note. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5006 +/- ##
============================================
- Coverage 36.17% 36.16% -0.02%
+ Complexity 1164 1153 -11
============================================
Files 1682 1684 +2
Lines 134335 134443 +108
Branches 28738 28762 +24
============================================
+ Hits 48602 48622 +20
- Misses 76663 76750 +87
- Partials 9070 9071 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…etection, guard empty path (review)
…oint test, doc semantic boundary (review)
d385984 to
7753acc
Compare
Code Review: Native Bolt Duration, Point, Path + semantic errors (#4997, #4998, #4999)Reviewed the source ( Strengths
Minor observations (non-blocking)
Test coverageStrong. Outbound (Duration, cartesian/WGS-84-3D Point, 2-hop/backward/cycle Path), inbound decode (Duration, Point2D/3D, malformed-degrades-to-opaque), full encode->wire->decode->re-encode round trip, negative point-detection cases, and the semantic-vs-syntax exception distinction are all exercised. The Nice work - the defensive decoding and the protocol-version documentation in particular are above par. |
What does this PR do?
Adds native Bolt wire serialization for three Cypher types and fixes semantic-error classification, closing three sub-issues of the #4890 tracking issue:
Duration(struct tag0x45) and spatialPoint(0x58/0x59) encoding, plus inbound decoding so both round-trip as query parameters. Point detection is structural (Cypherpoint()returns aMap, there is no Point class), keyed on a recognizedcrsvalue (cartesian/cartesian-3D/WGS-84/WGS-84-3D) or a numericsrid, plus numericx/y; the inbound decode carries a derivedcrsso an echoed point re-encodes as a Point.Path(0x50).BoltPathalready existed but had no call site; this wiresTraversalPath->BoltPathwith deduplicated nodes/rels and the signed 1-based/0-basedindicessequence, deriving traversal direction per hop.CommandSemanticException extends CommandParsingExceptionlets the Bolt RUN handler returnNeo.ClientError.Statement.SemanticError. Classification is scoped to the undefined-variable case that ERR-002 certifies: only theUndefinedVariablevalidator throws becomeCommandSemanticException; every otherCypherSemanticValidatorfailure keeps throwingCommandParsingException->SyntaxError(unchanged from before this PR). The subclass is caught by every existingcatch (CommandParsingException)site unchanged, so only the Bolt handler distinguishes it.All changes are writer/validator-side, mirroring the shipped temporal work (#4907); no query-engine behavior changes beyond the additive exception subclass.
Motivation
Depth gaps surfaced by the Group B conformance suites and pinned in
bolt/conformance/spec.yamlasexpected-fail. Official Neo4j drivers never received typedDuration/Point/Pathvalues, andNeo.ClientError.Statement.SemanticErrorwas dead code.Related issues
passingacross all five per-language e2e suites (Java, JS, Python, C#, Go).Additional Notes
BoltTypeRoundTripTest,PackStreamTypeInputTest,Bolt4998PathMappingTest,BoltErrorClassificationTest,CypherSemanticValidatorExceptionTest) are the hard gate and pass locally (bolt module 253/253). The five e2e suites pass in CI against the branch-built image.SemanticErrorclassification to the remaining genuinely-semantic validator failures (type conflicts, nested aggregation, invalid DELETE target, ...) once each is verified against a real Neo4j instance. They are intentionally left asSyntaxErrorfor now so the change certifies only what ERR-002 exercises rather than trading one misclassification for another.Checklist