fix: close graphql-transport-ws sockets with the protocol close codes #1305
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 197 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.316
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1305"
general
weight: 0.35
mcollina
Fixes #1297
With the
graphql-transport-wssubprotocol, a protocol violation now closes the socket with the code from PROTOCOL.md:| Case | Before | After |
| --- | --- | --- |
|
subscribebeforeconnection_ack|connection_errormessage, close with no code | close4401 Unauthorized|| second
connection_init| a secondconnection_ack| close4429 Too many initialisation requests|| unknown message type |
errormessage, socket stays open | close4400 Invalid payload type|| non-JSON frame |
errormessage withid: null, socket stays open | close4400 Message must be a JSON string|The second
connection_initis caught even when it arrives while the first one is still waiting onresolveContextoronConnect.The legacy
graphql-wspath is unchanged.handleConnectionClose()now takes an optionalcodeandreasonand passes them tosocket.close().Not included: the
4408init timeout, since it needs a new option.Tests:
graphql-transport-wsnow run ongraphql-ws, where that behavior stays.onConnectis pending), plus one showinggraphql-wsstill acks every init. They fail onmaster.lib/subscription-connection.jskeeps 100% line coverage.