Standardized gremlin-js connection options#3472
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 #3472 +/- ##
============================================
+ Coverage 76.35% 76.43% +0.07%
- Complexity 13424 13666 +242
============================================
Files 1012 1025 +13
Lines 60341 61656 +1315
Branches 7075 7204 +129
============================================
+ Hits 46076 47127 +1051
- Misses 11548 11676 +128
- Partials 2717 2853 +136 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| "buffer": "^6.0.3", | ||
| "eventemitter3": "^5.0.1" | ||
| "eventemitter3": "^5.0.1", | ||
| "undici": "6.27.0" |
There was a problem hiding this comment.
A community member spent quite a bit of effort trying to make the javascript driver work in the browser. Will this dependency make it impossible for it to work in the browser moving forward?
There was a problem hiding this comment.
not sure what's possible, but can we produce a smoke test of some sort that would help defend that functionality?
There was a problem hiding this comment.
I added dispatcher.browser.ts for browsers and throw if users try to set the unsupported connection options in a browser.
I tested this manually with example in examples/browser. As for a smoke test, I created a follow up ticket https://issues.apache.org/jira/browse/TINKERPOP-3260 to implement this.
Removed deprecated Updated doc link defaultBatchSize to batchSize timeout to timeoutMillis Assisted-by: Kiro: Claude Opus 4.8
bc35259 to
44543ee
Compare
Standardize
gremlin-javascriptconnection optionsImplements the JavaScript portion of the TinkerPop 4.x GLV connection-options standardization. Adopts
undicias a pinned dependency and builds an explicit dispatcher so the standardized options take effect, adds a set of new options, removes dead WebSocket-era fields, and deprecatesheaders. JavaScript driver changes only; the other GLVs follow in separate PRs.Proposal: https://lists.apache.org/thread/yqtr2wnb1kq2pqqq4002cz511q5o0bkg
New options
maxConnections(128) - caps concurrent connections per origin on the default dispatcher (previously uncapped). (breaking)readTimeout- per-read idle (body) timeout in ms (undicibodyTimeout); resets per chunk, so it is streaming-safe.maxResponseHeaderBytes- maximum response header size in bytes (undicimaxHeaderSize).keepAliveTime(30000 ms) - idle time before TCP keep-alive probes begin; enablesSO_KEEPALIVEvia a custom undici connector. Set0to disable.proxy- HTTP proxy URI; routes requests through an undiciProxyAgent.compression('none'/'deflate', default'deflate') - the wire compression negotiated with the server. (breaking)defaultBatchSize(64) - connection-level default that fills a request'sbatchSizewhen unset.bulkResults(default false) - connection-level default forbulkResults, applied to every request unless overridden per-request. TheDriverRemoteConnectiontraversal path defaults totrueregardless of this setting.logger- a logger object (withdebug/info/warn/errormethods) or a(level, message, ...args)callback. Disabled when unset.Behavior changes (breaking)
undicias a pinned dependency (6.27.0). The driver now builds and owns an explicit undici dispatcher from the discrete options above; previously the options were declared but not wired to anything.compressiondefaults to'deflate'(on), so the driver sendsAccept-Encoding: deflateby default. Setcompression: 'none'to disable; this also suppresses the auto-injectedAccept-Encodingso compression is not silently negotiated. Defaulting on is a deliberate deviation from the proposal's agreed default-off, applied consistently across the GLVs by later agreement.maxConnectionsnow caps concurrent connections at 128 (was uncapped).Removed (breaking)
agent,ca,cert,pfx, andrejectUnauthorizedTLS fields - they were declared (WebSocket-era leftovers) but never wired to the HTTP transport. TLS is now configured through the Node/undici runtime (NODE_EXTRA_CA_CERTS,NODE_TLS_REJECT_UNAUTHORIZED).Deprecated
headers- retained as a deprecated option (implemented via a synthesized interceptor that emits a one-time warning). Set custom headers via an interceptor instead, e.g.interceptors: (req) => { req.headers['X-Custom'] = 'value'; }.Bug fix
Client.submit()so that an explicitbulkResults: falserequest option is forwarded to the server instead of being silently dropped.Notes
connectTimeout/idleTimeout/writeTimeoutas driver options (the undici runtime defaults are used), and TLS is runtime-delegated rather than a driver option. No publicdispatcheroption is exposed; the dispatcher is built internally from the discrete options.Testing
gremlin-javascriptbuilds (dual CJS/ESM) and all 358 unit tests pass, including newclient,connection,dispatcher, andloggersuites covering the option-to-undici mapping, compression negotiation, keep-alive wiring, andbulkResultsprecedence.Assisted-by: Kiro: Claude Opus 4.8