quic: create streams synchronously #67749
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 213 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.321
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #67749"
general
weight: 0.35
efekrskl
The QUIC API stream creation methods are
asyncand return promises, but they never wait for anything. Discussed briefly in https://github.com/nodejs/node/pull/65331#issuecomment-5560302465.The only situation where there's some actual async work anywhere is pending streams (blocked on flow control, or incomplete initial handshake). In that case we do return immediately today (promise resolves immediately) but just with
stream.pendingset totrue.That is correct imo: we do want to return immediately, because we want to allow queueing operations immediately without waiting for the stream to actually open, e.g. so you can start queueing up requests on streams straight away, without separately waiting for the handshake to complete.
In the case where you really want to wait for the stream to open before you use it, you just create the stream then use
await stream.opened. This already works today.Making this API async when it doesn't actually wait is confusing (suggests
awaitwill actually wait for opened somehow). It also adds an unnecessary promise & microtask for every stream, and similarly forces the calling code to be async, etc.This PR drops that:
Drop
asyncfrom the methods.Remove unnecessary
awaitfrom a large number of existing calls.Updates
waitUntilAvailabletext, which implied the promise would wait for flow control (it didn't - it returns as pending).Fix the swapped values for pending/now in the
createStreamdebug message.stream.pendingThe alternative to all this is to make stream creation actually wait (at least in some cases). I don't see much upside though, and this approach roughly matches
node:http2.