mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
## Summary - Fixed inverted logic in `canReceiveData` function in HTTP/2 stream state handling - Added gRPC streaming tests to verify correct behavior ## Problem The `canReceiveData` function had completely inverted logic that reported incorrect `remoteClose` status: | Stream State | Before (Wrong) | After (Correct) | |--------------|----------------|-----------------| | OPEN | `false` (can't receive) | `true` (can receive) | | HALF_CLOSED_LOCAL | `false` (can't receive) | `true` (can receive from remote) | | HALF_CLOSED_REMOTE | `true` (can receive) | `false` (remote closed) | | CLOSED | `true` (can receive) | `false` (stream done) | Per RFC 7540 Section 5.1: - In `HALF_CLOSED_LOCAL` state, the local endpoint has sent END_STREAM but can still **receive** data from the remote peer - In `HALF_CLOSED_REMOTE` state, the remote endpoint has sent END_STREAM so no more data will be received ## Test plan - [x] Added gRPC streaming tests covering unary, server streaming, client streaming, and bidirectional streaming calls - [x] Verified HTTP/2 test suite passes (same or fewer failures than before) - [x] Verified gRPC test suite improves (7 failures vs 9 failures before + 2 errors) Closes #20875 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>