Repository navigation
feat(#5001): advertise and negotiate Bolt 5.0-5.4 with version-gated wire encoding - #5059
Conversation
…UTC 'I'/'i') BoltDateTimeStructure carries both epoch bases (local and true UTC) computed at build time and picks signature + seconds at writeTo() from the writer's negotiated Bolt major version. BoltStructureMapper.toTemporalStructure now returns PackStreamStructure and builds BoltDateTimeStructure for the two DateTime variants (offset and zone-id); Date/Time/LocalTime/LocalDateTime/ Duration are version-invariant and stay on BoltTemporalStructure. Widened BoltTypeRoundTripTest's TYPE-010 assertion from BoltTemporalStructure to PackStreamStructure since OffsetDateTime output is now a BoltDateTimeStructure.
Add BoltNetworkExecutor.deferAuthToLogon(), consumed in handleHello so a Bolt 5.1+ HELLO with no auth fields is accepted and waits for the subsequent LOGON message instead of being rejected as missing credentials. Pre-5.1 HELLO-embedded auth and the explicit "none" scheme rejection are unchanged. Also add BoltMessage.TELEMETRY (0x54) and TelemetryMessage, acknowledged with SUCCESS so a Bolt 5.4 TELEMETRY message doesn't break the connection.
…e negotiated version
Server now advertises Bolt 5.0-5.4 (Tasks 1-4), so PROTO-002 (5.x-only driver negotiation) moves from expected-fail to passing in the shared conformance spec. The e2e proto002_bolt5 xfail wrapper is unwrapped to a direct assertion since it would now self-fail (assertExpectedFailure fails loudly when the wrapped assertion passes). validate_spec.py's REQUIRED_GAP_AREAS is narrowed to drop "protocol", since its only #4890-tracked gap is closed (mirrors the existing precedent for errors/type-roundtrip).
|
Tick the box to add this pull request to the merge queue (same as
|
There was a problem hiding this comment.
Code Review
This pull request implements Bolt 5.x version negotiation (supporting Bolt 5.0 through 5.4) and version-gates the outbound wire encoders (graph elements and datetime structures) based on the negotiated major version. It also introduces deferred authentication for Bolt 5.1+ handshakes and gracefully acknowledges TELEMETRY messages. Feedback on the changes points out that the version comparison logic in deferAuthToLogon is incorrect for future major versions (e.g., Bolt 6.0+) and should be performed lexicographically.
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 boolean deferAuthToLogon(final int protocolVersion, final String scheme, final String principal, | ||
| final String credentials) { | ||
| final int major = getMajorVersion(protocolVersion); | ||
| final int minor = getMinorVersion(protocolVersion); | ||
| return major >= 5 && minor >= 1 && scheme == null && principal == null && credentials == null; | ||
| } |
There was a problem hiding this comment.
The version comparison logic in deferAuthToLogon is incorrect for future major versions (e.g., Bolt 6.0+). Comparing major >= 5 && minor >= 1 independently will return false if major is 6 and minor is 0. The comparison should be performed lexicographically: major > 5 || (major == 5 && minor >= 1).
static boolean deferAuthToLogon(final int protocolVersion, final String scheme, final String principal,\n final String credentials) {\n final int major = getMajorVersion(protocolVersion);\n final int minor = getMinorVersion(protocolVersion);\n return (major > 5 || (major == 5 && minor >= 1)) && scheme == null && principal == null && credentials == null;\n }There was a problem hiding this comment.
Fixed in 5e490b7. The predicate is now lexicographic: `major > 5 || (major == 5 && minor >= 1)`.
Note on severity: this is a latent/defensive correctness fix rather than a live bug. SUPPORTED_VERSIONS caps the advertised ceiling at 5.4 and negotiateVersion() only selects an advertised version, so protocolVersion never reaches deferAuthToLogon with major >= 6 today (and there is no Bolt protocol 6.x - the 6.x is the driver version). The lexicographic form costs nothing and keeps the helper correct if a future change raises the ceiling. Added a regression case: deferAuthToLogon(0x00000006, null, null, null) asserts true.
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| CodeStyle | 1 minor |
🟢 Metrics 19 complexity
Metric Results Complexity 19
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.
|
Code review: Bolt 5.0-5.4 negotiation (#5059) Reviewed the full diff (executor, structures, temporal encoding, message parsing, tests, conformance). Overall this is a clean, well-scoped, and well-tested change. The core design decision - the negotiated major version as a single switch threaded through Strengths
Minor findings (non-blocking)
Nit
None of these block the merge. The correctness-critical paths (temporal epoch bases, field counts, negotiation, auth deferral) are right and backed by focused tests. |
Review: Bolt 5.0-5.4 negotiation with version-gated wire encodingThorough, well-executed change. The single-switch design (negotiated major version threaded through Correctness / maintainability
Test structure
Minor / positives
Nice work closing PROTO-002 without weakening the 3.0/4.0/4.4 paths. |
|
Addressed in 28195df. 1. TELEMETRY without a state guard - Fixed. The 3. 2. Nit - per-RECORD Full module remains green ( |
|
This re-review landed on commit
Current HEAD |
Code Review: Bolt 5.0-5.4 negotiation with version-gated wire encodingReviewed the full diff (negotiation, version-gated structs, temporal encoding, auth deferral, TELEMETRY, and the conformance/e2e updates). This is a high-quality, well-documented, and thoroughly tested change. Threading a single negotiated Bolt major through Correctness (verified, looks good)
Minor: orphaned/misplaced Javadoc after the
|
|
Orphaned Javadoc after the
Nit - TELEMETRY SUCCESS-acked on a negotiated 4.x connection - Left intentionally permissive. TELEMETRY is only ever sent when the server advertises a telemetry hint (which ArcadeDB does not), so no compliant driver sends it on any version; gating the ack on HEAD |
Code Review: Bolt 5.0-5.4 negotiation and version-gated wire encodingOverall this is a clean, well-scoped, and thoroughly tested change. The design of threading a single negotiated major version through Strengths
Suggestions / points to consider
None of these are blockers. The core protocol work looks correct and the test suite (including the un-wrapped Review generated with Claude Code. Static review only - I did not run the build/ITs; relying on the PR's stated |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5059 +/- ##
============================================
- Coverage 65.81% 65.61% -0.21%
- Complexity 840 842 +2
============================================
Files 1687 1690 +3
Lines 134939 135485 +546
Branches 28859 28985 +126
============================================
+ Hits 88809 88895 +86
- Misses 33941 34463 +522
+ Partials 12189 12127 -62 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
3. 2. TELEMETRY acked in any non-FAILED state - Holding as-is. TELEMETRY is only sent when the server advertises a telemetry hint, which ArcadeDB never does, so it never legitimately arrives on any version or state; the FAILED->IGNORED guard is the one meaningful state check, and adding a READY-only whitelist would branch on states (AUTHENTICATION/STREAMING/TX_STREAMING) that can never receive a real TELEMETRY. Defensive SUCCESS is the intended stance, and as you note it is harmless and not blocking. 1. HEAD |
Code Review: Bolt 5.0-5.4 negotiation (#5059)Reviewed the full diff, the surrounding Strengths
Minor points (non-blocking)
VerificationPer the checklist the Nice work. None of the above blocks merge. 🤖 Generated with Claude Code |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| CodeStyle | 1 minor |
🟢 Metrics 19 complexity
Metric Results Complexity 19
🟢 Coverage 91.82% diff coverage · -7.50% coverage variation
Metric Results Coverage variation ✅ -7.50% coverage variation Diff coverage ✅ 91.82% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (1df3470) 134939 101035 74.87% Head commit (9536e36) 167288 (+32349) 112702 (+11667) 67.37% (-7.50%) 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 (#5059) 110 101 91.82% 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%
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.
What does this PR do?
Advertises Bolt 5.0 through 5.4 in the handshake (previously 3.0/4.0/4.4 only) and version-gates the outbound wire encoders so a 5.x driver connects natively instead of silently downgrading to 4.4. Closes conformance scenario PROTO-002.
The negotiated Bolt major version is the single switch, threaded through the per-message
PackStreamWriter:Node/Relationship/UnboundRelationshipemit their Bolt 5.0 layouts (withelement_id/start_node_element_id/end_node_element_id, field counts 4/8/4) when the negotiated major is >= 5, and stay byte-identical (3/5/3) on 4.x.BoltDateTimeStructurecarries both epoch bases and emits the legacy'F'/'f'signatures with the local epoch-second on 4.x, and the UTC'I'/'i'signatures with the true UTC epoch-second on 5.0+.HELLOis now accepted and defers to the separateLOGON(resolving the standingNOTE (Bolt 5.1+)latent bug);AuthTokens.none()stays deliberately rejected.TELEMETRY(5.4) is acknowledged.SUPPORTED_VERSIONSadvertises{5.4, 5.3, 5.2, 5.1, 5.0, 4.4, 4.0, 3.0}; the existing range-matching logic is unchanged, so 3.0/4.0/4.4 drivers negotiate exactly as before.The change advertises 5.x and honors its wire deltas atomically, so the advertised
Neo4j/5.26.0 compatibleidentity is honest up to Bolt 5.4. The 5.7/5.8 handshake manifest and 5.5/5.6 GQL notification metadata are intentionally out of scope (classic-handshake-only); manifest-capable drivers fall back to classic negotiation against the 5.4 ceiling.Motivation
BoltNetworkExecutor.SUPPORTED_VERSIONSnever advertised any Bolt 5.x version, so 5.x drivers worked only by an undocumented, untested silent downgrade to 4.4 - while the server still advertised a 5.26-compatible identity, setting a 5.x feature expectation the handshake did not honor. This closes that gap without lying to drivers: adding 5.x and honoring theelement_id/ UTC-datetime wire deltas land together, guarded by the existing real-driver type round-trip ITs.Related issues
Additional Notes
docs/superpowers/.bolt/conformance/spec.yaml: PROTO-002 flippedexpected-fail->passing; the self-closing e2e xfailRemoteBoltDatabaseIT#proto002_bolt5is un-wrapped to a direct assertion;validate_spec.pydrops the now-nonexistentprotocol-area Bolt: tracking issue for protocol/type-fidelity gaps surfaced by certification #4890 gap (CONN-004'sconnection-area gap is untouched).Checklist
mvn clean packagecommand (verifiedmvn -pl bolt verify: 275 unit + 110 IT green, including the realneo4j-java-driverITs -BoltProtocolIT78/78, temporal/type round-trip ITs - with no assertion changes needed)none-rejected)🤖 Generated with Claude Code