Skip to content

fix: skip deduplication for upgrade requests - #5593

Open
Ram-blip wants to merge 1 commit into
nodejs:mainfrom
Ram-blip:fix/deduplicate-upgrade-requests
Open

fix: skip deduplication for upgrade requests#5593
Ram-blip wants to merge 1 commit into
nodejs:mainfrom
Ram-blip:fix/deduplicate-upgrade-requests

Conversation

@Ram-blip

@Ram-blip Ram-blip commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This relates to...

The deduplicate interceptor currently treats upgrade-bearing requests as ordinary safe-method requests. Since Dispatcher.upgrade() dispatches a GET with an upgrade option, the request can enter the normal response-deduplication path.

A successful protocol upgrade completes through onRequestUpgrade and transfers an upgraded socket instead of following the normal onResponseStartonResponseDataonResponseEnd lifecycle. As a result, the pending deduplication entry is not removed, and later matching requests can attach to stale state without being dispatched or settled.

Rationale

Protocol upgrades are stateful operations and cannot share or replay a single upgraded transport across independent callers.

Upgrade-bearing requests should therefore bypass response deduplication before key generation and pending-request lookup. This also prevents collisions between an ordinary GET and an otherwise identical upgrade-bearing GET.

Changes

  • Skip deduplication for upgrade-bearing requests.
  • Preserve existing behavior for ordinary requests where upgrade is absent or falsey.
  • Add a deterministic regression test proving that an upgrade request is dispatched independently from a matching pending GET.

Features

N/A

Bug Fixes

  • Prevent upgrade requests from entering the ordinary response-deduplication lifecycle.
  • Prevent stale pending entries after a successful protocol upgrade.
  • Prevent later matching requests from attaching to an already completed upgrade.
  • Prevent ordinary GET and upgrade-bearing GET requests from colliding in the deduplication map.

Breaking Changes and Deprecations

None.

Status

@codecov-commenter

codecov-commenter commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.47%. Comparing base (21a8e1e) to head (772bdd0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5593      +/-   ##
==========================================
- Coverage   93.47%   93.47%   -0.01%     
==========================================
  Files         110      110              
  Lines       38238    38238              
==========================================
- Hits        35744    35742       -2     
- Misses       2494     2496       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants