Skip to content

streams: drop dead ended = false in NetworkSink and FetchRequestBodySink start - #37406

Merged
Jarred-Sumner merged 1 commit into
mainfrom
farm/4dbf41e8/sink-start-ended
Aug 11, 2026
Merged

Jarred-Sumner merged 1 commit into
mainfrom
farm/4dbf41e8/sink-start-ended

Conversation

@robobun

@robobun robobun commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

What

NetworkSink::start and FetchRequestBodySink::start both return early when self.ended is set and then assigned self.ended = false a few lines later, so the assignment could only ever write false over false. Removed in both places. No behaviour change.

Related: #36770 reworks NetworkSink's lifecycle flags more broadly; this is just the two dead lines.

Verification

bun bd test test/js/bun/s3/s3.test.ts test/js/web/fetch/fetch.stream.test.ts test/js/web/fetch/body.test.ts test/js/web/fetch/fetch-abort-stream-body.test.ts passes (the S3 cases that run against a local server included).

…ink start

Both start() methods return early when ended is set, so the assignment
that followed could only ever write false over false.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@robobun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 seconds

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 31c7ca08-6efb-4dc6-8188-0fab84a602a9

📥 Commits

Reviewing files that changed from the base of the PR and between 9fcdea8 and c85871d.

📒 Files selected for processing (2)
  • src/runtime/webcore/fetch/FetchRequestBodySink.rs
  • src/runtime/webcore/streams.rs

Comment @coderabbitai help to get the list of available commands.

@claude claude Bot 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 — both removed assignments are provably dead.

What was reviewed:

  • Confirmed both start() methods early-return when self.ended is true, so the removed self.ended = false could only ever write false over false.
  • Checked that ended defaults to false in both structs, so no first-call initialization is lost.
  • No other callers or side effects touched.
Extended reasoning...

Overview

This PR removes one dead line from each of NetworkSink::start (src/runtime/webcore/streams.rs) and FetchRequestBodySink::start (src/runtime/webcore/fetch/FetchRequestBodySink.rs). Both functions begin with if self.ended { return Ok(()); }, so control flow can only reach the removed self.ended = false; when self.ended is already false. The assignment is a tautological no-op.

Security risks

None. This is pure dead-code removal in stream sink initialization; no input handling, allocation, or lifecycle logic is changed.

Level of scrutiny

Very low. The change is two deleted lines whose deadness is locally provable from the guard three lines above each. ended is initialized to false in Default::default() for both structs, so there is no scenario where this assignment did useful first-time initialization. The PR description accurately characterizes the change and references #36770 as the broader lifecycle rework this trims ahead of.

Other factors

The author ran the relevant fetch/S3 stream test suites. No new tests are needed since there is no observable behavior to assert — this is exactly the "delete dead code in the same PR that makes it dead" pattern the review guidelines call for. No prior reviewer comments to address.

@github-actions

Copy link
Copy Markdown
Contributor

This PR may be a duplicate of:

  1. streams: collapse NetworkSink and HTTPServerWritable lifecycle bools into ordered state enums #36770 - Replaces NetworkSink's lifecycle bools with a state enum and deletes the identical self.ended = false; line from NetworkSink::start in src/runtime/webcore/streams.rs.
  2. streams: remove NetworkSink's write-only cancel flag and unreachable EOF branch #37407 - Removes dead NetworkSink lifecycle-flag code (cancel field, unreachable if !self.ended EOF branch) in the same struct and file, from the same cleanup sweep.

🤖 Generated with Claude Code

@Jarred-Sumner
Jarred-Sumner merged commit e75e117 into main Aug 11, 2026
52 of 53 checks passed
@Jarred-Sumner
Jarred-Sumner deleted the farm/4dbf41e8/sink-start-ended branch August 11, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants