Repository navigation
fix(#9962,#9960): every list queries entry names its client; MCP and Gremlin Server name the leader of a refusal - #9980
Conversation
…and the Gremlin Server name the leader of a refusal #9962: RunningQueryRegistry.register/open now take the client (connectionId, clientAddress) as part of opening the entry, set before it is listed; RunningQuery.setConnection is package-private. The surfaces that recorded no client now do: MCP (peer address over HTTP, "stdio" over stdio, passed per message), the /ws insert session (session id and WebSocket peer, in every transaction mode), the Gremlin Server (channel id and peer, published by the channelizer around the read that submits the evaluation) and gRPC (unary RPCs and the client-streaming loads, which the issue's census missed). #9960: ServerIsNotTheLeaderException.withLeaderSentence is the shared arm (Redis and Postgres delegate to it). MCP appends the leader sentence to a tool error after concealment; the Gremlin Server recognises a refusal by the exception classes TinkerPop attaches and names the leader of the cluster view, after the placeholder in production.
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 22 |
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Review of #9980I read the registry, Bolt, Gremlin and test-migration parts of the diff in detail. The MCP, gRPC, Design
Points to check
Tests Overall this looks solid. Point 1 and the 🤖 Generated with Claude Code |
…of "null"; document the Gremlin pipeline-order assumption RunningQueryRegistry.clientAddress(SocketAddress) is the one conversion every surface uses (HTTP, MCP, /ws, Bolt, Redis, MongoDB, Postgres, Gremlin, gRPC), so a closed or in-process peer leaves the field out of the listing. Adds a registry-level test that an entry is listed with its client from the start.
Review of #9980 (client in every
|
…ry.Client value, not two positional strings register()/open() take a RunningQuery.Client (Client.NONE for work from no connection, Client.of(id, SocketAddress) for a socket peer, which leaves a missing peer out instead of listing "null"), so the client fields can no longer be swapped with each other or with the session id and tag. Gremlin reuses the record and keeps it in one thread-local holder on both threads, published around the pipeline read by GremlinAuthContext.publishing, which is unit-tested. StreamingLoadEntry documents that it must be built on the call's gRPC Context.
|
Review of #9980 Good design overall. Putting the client into register/open through a RunningQuery.Client record means a new surface cannot compile without deciding who its client is, which beats the extra setConnection line the issue suggested. The client is set before the entry is listed and setClient is package-private. Tests are broad (HTTP, stdio, Gremlin and gRPC end to end, plus unit tests). I did not build or run anything; this is from reading the diff. Things to check
Style (CLAUDE.md): several test call lines (the register(..., RunningQuery.Client.NONE) ones) are very long; wrap them to match the surrounding files. Coverage: strong. ThreadLocal clean-up on a failed read is covered at the helper level. No blocking issues found. The main open question is item 1. Generated with Claude Code |
|
Review round 3 addressed in the latest commit:
|
|
Review of #9980 (client on every I read the full diff but did not build or run the tests. Overall this is a well-designed change and I have no blocking concerns. What I like
Suggestions
Security and performance
Nice work overall. |
…d; surfaces that may have none pass Client.NONE explicitly
|
Review round 4 addressed in the latest commit:
|
|
Review of #9980 (client on every list-queries entry, leader named in MCP/Gremlin refusals) I read the engine, Gremlin and test changes closely. I did not read the MCP, gRPC, /ws and Redis/Postgres delegation hunks line by line, and I did not build or run anything. What looks good
Points to consider (none blocking)
Overall this is a clean, well-tested change. I would approve once point 2 is confirmed. 🤖 Generated with Claude Code |
|
Review round 5:
|
Review of #9980 (list queries client + leader refusal naming)Overall this is a well-designed change. Making the client a required argument of Observations and suggestions
Security
TestsCoverage is good: unit tests for 🤖 Generated with Claude Code |
|
Review round 6: no blocking findings, and CodeRabbit generated no actionable comments. Remaining points, judged not worth changing in this PR:
|
Fixes #9962
Fixes #9960
#9962 - every
list queriesentry names its clientThe issue proposed one more
setConnectionline per surface. That keeps recording the client a separate, forgettable step, which is exactly how three surfaces missed it. Instead:RunningQueryRegistry.register(...)/open(...)take aRunningQuery.Client(connection id + address) as part of opening the entry, and set it before the entry is listed (a listing can no longer see an entry without its client). One value rather than two more positional strings, so it cannot be swapped with the session id or tag;Client.NONEfor work from no connection,Client.of(id, SocketAddress)for a socket peer (a peer the transport does not report is omitted, never listed as"null"). The setter is package-private, so the registry is the only path. A ninth surface cannot compile without deciding who its client is.stdioon the stdio one. Passed per message (dispatch(request, user, client)), not as a dispatcher field, because one HTTP dispatcher serves every client of the endpoint./wsinsert: session id asconnectionIdand the WebSocket peer as address, in every transaction mode (not onlynone).RequestMessagecarries no channel, soConcealingWebSocketChannelizerpublishes the connection on the Netty thread around the read that submits the evaluation (relying on TinkerPop 3.8 submitting from inside that read, documented at the handler);GremlinPrincipalPropagatingExecutorServicecarries it to the pool thread in the same holder.StreamingLoadEntry, via a Context key set byGrpcAdmissionInterceptor) listed no client either.#9960 - MCP and the Gremlin Server name the leader of a refusal
ServerIsNotTheLeaderException.withLeaderSentence(text, error)is the shared arm (redirectIn+leaderSentence). Redis and Postgres now delegate to it instead of carrying their own copy.failureMessageappends the sentence after concealment, in both modes. A production tool error now reads<placeholder>. The leader is server 'host:port'instead of the bare placeholder.Not changed:
Database.transactionstill retries a leader refusaltxRetriestimes before answering. This applies to every transport (HTTP's auto-retry too), not only MCP, and a retry can succeed when the refusal came from a transiently failed forward. Changing it is an engine-wide HA semantics decision, so it is out of scope here.Tests
Issue9962MCPClientListedTest(HTTP + stdio, end to end),Issue9962GremlinRequestClientTest,Issue9960MCPLeaderRefusalTest,Issue9960GremlinLeaderRefusalTest,ExceptionTest.withLeaderSentenceNamesTheLeaderOnlyForARedirectIssue9689GremlinTerminateTest(Gremlin Server end to end),Issue9838WsInsertSessionListedInEveryModeTest,Issue9689GrpcRunningQueryIT,Issue9875GrpcStreamingLoadsListedIT,Issue9689RunningQueryFollowUpsTestgremlin-it(5 classes), ITsIssue9689GrpcRunningQueryIT,Issue9875GrpcStreamingLoadsListedIT,Issue9689BoltTerminateTransactionsIT,Issue9689PostgresCancelITSummary by CodeRabbit
stdio.