Skip to content

fix(ext/node): forward http2 protocol errors from invalid frame callback to session error event - #33630

Merged
littledivy merged 3 commits into
denoland:mainfrom
divybot:claude/test-http2-connect-method-extended-cant-turn-off
Apr 29, 2026
Merged

littledivy merged 3 commits into
denoland:mainfrom
divybot:claude/test-http2-connect-method-extended-cant-turn-off

Conversation

@divybot

@divybot divybot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Enables test-http2-connect-method-extended-cant-turn-off in node_compat suite.

Test plan

  • cargo test --test node_compat -- test-http2-connect-method-extended-cant-turn-off

Comment thread .claude/scheduled_tasks.lock Resolved

@fibibot fibibot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Substance is right. The fix mirrors Node's OnInvalidFrame — checking nghttp2_is_fatal plus the explicit non-fatal-but-protocol codes (PROTO, STREAM_CLOSED, FLOW_CONTROL) and dispatching to JS via the existing session_internal_error_cb. The _lib_error_code → lib_error_code rename is required since the value is now used. invoke_session_internal_error correctly builds the v8 scope from the raw isolate pointer and the cppgc-traced context — the same pattern other callbacks in this file use.

The new test enrollment (parallel/test-http2-connect-method-extended-cant-turn-off.js) is alphabetically positioned correctly between compat-write-head-destroyed and connect-method-extended.

Conflict with #33625

This PR duplicates work already in #33625. That PR (already approved, full green CI, older — opened ~2h before this one) adds:

  • op_http2_error_string — same wrapper around nghttp2_strerror with the same null-guard + CStr::from_ptr + to_string_lossy() pattern
  • replaces the same binding.nghttp2ErrorString(integerCode) call site in polyfills/internal/http2/util.ts:891 with that op

So whichever lands second will have a merge conflict on util.ts (and on the op_http2_* registration in lib.rs/mod.rs), and the codebase will end up with two ops doing the exact same thing under slightly different names.

Recommendation: rebase this PR on top of #33625 and delete the new op_http2_nghttp2_error_string (in lib.rs, ops/http2/mod.rs, ops/http2/session.rs), then call op_http2_error_string from util.ts instead. The protocol-error-forwarding fix (the actual substance here) is independent and can stay as-is.

Inline note left at the conflict point.

CI gate

94 passing, 0 failures, 28 still pending (test_node_compat 2/3 and 3/3 on linux/macos x86_64, several test_specs/test_unit shards, build release linux-x86_64). Holding off on autonomous APPROVE — will re-confirm once those finish green and the duplicate-op question is resolved.

cc @bartlomieju for the dedup decision (which op name to keep — #33625's op_http2_error_string is the simpler name and that PR is older).

// ? getMessage(customErrorCode, [], null)
? undefined
: binding.nghttp2ErrorString(integerCode),
: op_http2_nghttp2_error_string(integerCode),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflict with #33625 — that PR (already approved, older) replaces this same call site with op_http2_error_string (same nghttp2_strerror wrapper, simpler name). Whichever PR merges second will conflict here, and the tree will end up with two ops doing the same thing.

Suggest: drop the new op_http2_nghttp2_error_string (here, lib.rs, ops/http2/mod.rs, ops/http2/session.rs) and use op_http2_error_string from #33625 instead. The protocol-error-forwarding fix in on_invalid_frame_recv_callback is the real substance of this PR and is independent.

@fibibot fibibot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on the delta. The rename op_http2_nghttp2_error_string → op_http2_error_string aligns this PR with #33625 — both branches now declare the same op (same null-check, same nghttp2_strerror wrap, same name), so whichever lands first satisfies the requirement and the second will need only to drop the duplicate declaration in lib.rs / mod.rs / session.rs while keeping its unique substance (here: the on_invalid_frame_recv_callback protocol-error forwarding).

CI: 131 success, 2 failure (wpt release linux-x86_64 + the aggregate ci status), 2 skipped.

The WPT failure is unrelated — single WebSocket test (/websockets/stream/tentative/close.any.worker.html?default - close code should be sent to server and reflected back) that the runner detected as needing an expectations-file update; this PR doesn't touch ext/websocket/ or tests/wpt/runner/expectations/ at all. Looks like the WebSocket WPT got recently flaky and the expectations diff is being surfaced.

All HTTP/2-relevant CI is green:

  • All 36 test node_compat (3 shards × 6 platforms × debug+release) ✓
  • All 12 test unit_node ✓
  • All 24 test specs ✓
  • All lint debug ✓

…ack to session error event

Enables tests/node_compat/runner/suite/test/parallel/test-http2-connect-method-extended-cant-turn-off.js

Co-authored-by: Divy Srivastava <me@littledivy.com>
@divybot
divybot force-pushed the claude/test-http2-connect-method-extended-cant-turn-off branch from f866133 to afabbc8 Compare April 28, 2026 20:36
divybot and others added 2 commits April 29, 2026 02:55
denoland#33625), conflicts

Enables tests/node_compat/runner/suite/test/parallel/test-http2-connect-method-extended-cant-turn-off.js

Co-authored-by: Divy Srivastava <me@littledivy.com>
Co-authored-by: Divy Srivastava <me@littledivy.com>

@littledivy littledivy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@littledivy
littledivy merged commit 081cab3 into denoland:main Apr 29, 2026
136 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants