Skip to content

quic: align stream priority with W3C WebTransport sendOrder#64454

Open
SparshGarg999 wants to merge 1 commit into
nodejs:mainfrom
SparshGarg999:fix/quic-priority-send-order
Open

quic: align stream priority with W3C WebTransport sendOrder#64454
SparshGarg999 wants to merge 1 commit into
nodejs:mainfrom
SparshGarg999:fix/quic-priority-send-order

Conversation

@SparshGarg999

Copy link
Copy Markdown

Summary

Align the experimental QUIC stream prioritization options with W3C WebTransport priority semantics by adding the numeric sendOrder option.

Description

Currently, Node's experimental QUIC implementation supports a string-based priority level ('high', 'default', 'low'). However, the W3C WebTransport specification defines stream priority using a grouped sendGroup and a numeric sendOrder property (where lower values represent higher priority/urgency).

To align Node's QUIC stream priority API with WebTransport's semantics, this commit introduces the numeric sendOrder option.

  • sendOrder maps directly to the underlying raw QUIC stream urgency value (an integer in the range [0, 7]).
  • When sendOrder is specified at stream creation (via createBidirectionalStream or createUnidirectionalStream) or via setPriority(), it overrides/takes precedence over the string-based priority level.
  • The priority getter is updated to return sendOrder alongside level and incremental properties, exposing the exact urgency level of the stream.
  • Validates that sendOrder is an integer in the range [0, 7] and throws appropriate errors (ERR_OUT_OF_RANGE / ERR_INVALID_ARG_TYPE) for invalid inputs.

Verification

Updated test/parallel/test-quic-h3-priority.mjs to:

  1. Verify sendOrder value returned in the priority getter matches the priority level or explicit sendOrder value set.
  2. Verify setting sendOrder at stream creation time.
  3. Verify updating sendOrder via setPriority().
  4. Validate error throwing for invalid sendOrder types and out-of-range values.

Fixes: #63654

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/quic

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC implementation / HTTP/3. labels Jul 12, 2026
@SparshGarg999 SparshGarg999 force-pushed the fix/quic-priority-send-order branch from 14e724b to 7d3c9c1 Compare July 12, 2026 15:40
@martenrichter

Copy link
Copy Markdown
Contributor

@SparshGarg999
But this lacks the sendGroups. And think it should be something handled upstream in ngtcp2.
And sendOrder in W3C is not limited to {0,7].

@SparshGarg999

Copy link
Copy Markdown
Author

Reopening to address the feedback properly. I'll fix the sendOrder range issue (it should accept any integer, not just [0,7]) and note sendGroups as a follow-up that requires upstream ngtcp2 support.

@SparshGarg999 SparshGarg999 reopened this Jul 12, 2026
Adds the numeric sendOrder option to createBidirectionalStream,
createUnidirectionalStream, and setPriority, aligning with the
W3C WebTransport sendOrder concept where a lower value indicates
a higher priority. This maps directly to the raw QUIC stream urgency
value (an integer in the range [0, 7]).

Additionally, the priority getter is updated to return sendOrder`nrepresenting the current raw QUIC stream urgency value.

Fixes: nodejs#63654

Signed-off-by: SparshGarg999 <sparshgarg999@gmail.com>
@SparshGarg999 SparshGarg999 force-pushed the fix/quic-priority-send-order branch from 7d3c9c1 to 2003bae Compare July 12, 2026 16:13
@SparshGarg999

Copy link
Copy Markdown
Author

Hi! I've updated the implementation to address your feedback:

  1. Accepting any integer: The sendOrder option now accepts any integer (matching the W3C WebTransport long long type) instead of being restricted to [0, 7].
  2. Clamping to QUIC urgency: We clamp the input to the supported [0, 7] range internally for the underlying QUIC urgency, with comments added to document this mapping.
  3. Priority direction and sendGroups: I added clear JSDoc and inline documentation clarifying that W3C's priority direction is inverted relative to QUIC urgency, and that full support for sendGroups and the full integer range without clamping requires upstream ngtcp2 / nghttp3 changes.
  4. Tests: Updated the test suite in test-quic-h3-priority.mjs to verify that out-of-bounds values are correctly accepted and clamped, and verified all style/linting checks pass 100% cleanly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC implementation / HTTP/3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quic: is stream priority compatible to w3c webtransport sendgroups ?

3 participants