Skip to content

fix: released writer surface and failed compression close (#193, #223) - #229

Merged
ryuzdev merged 2 commits into
mainfrom
fix/workerd-diff-stream-edges
Nov 23, 2026
Merged

ryuzdev merged 2 commits into
mainfrom
fix/workerd-diff-stream-edges

Conversation

@ryuzdev

@ryuzdev ryuzdev commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Two more workerd divergences from the differential gate, both measured on
workerd 1.20261121.1.

#193 — a released WritableStreamDefaultWriter

  • desiredSize now throws TypeError: This WritableStream writer has been released. in every stream state. It used to report the stream's size, and
    null once the stream had errored.
  • releaseLock() installs a fresh rejected ready, as workerd does: a read
    after the release is the released error, while a handler attached before the
    release keeps the old settlement (still resolved, or still the stream's
    error). Previously a released writer on an errored stream kept carrying that
    error from ready.
  • closed keeps its own settlement once it has one and still rejects with the
    released error while pending; write(), close(), abort() and a second
    releaseLock() are unchanged and already matched.
  • The issue's note that cello rejected a ready captured before the release
    does not reproduce on 209791e: both runtimes resolved it. The actual ready
    divergence is the post-release read, pinned here.

#223 — DecompressionStream close after a failed write

Workerd's compression streams are internal streams, so a failed push or flush
closes the writable side instead of erroring it: close()/write() then
report TypeError: This WritableStream has been closed. (cello replayed the
stored Decompression failed.), desiredSize is 0 and abort() resolves,
while writer.closed rejects with the failure and writer.ready resolves.
compression_streams.js opts its transform-stream writable into that settle;
a plain TransformStream still errors both sides. CompressionStream shares
the path and is pinned by the same case.

Tests

  • Gate cases writer-released and decompression-close-after-error; the full
    gate agrees 193/193 on the rebased base.
  • crates/cello/tests/stream_edges_conformance.rs asserts the measured values
    in-isolate. Verified failing on 209791e (four desiredSize states plus the
    errored-stream post-release ready; the compression close/write/
    desiredSize), passing with the fix.
  • Full suite, clippy --all-targets -D warnings, fmt --check and
    check-docs pass locally; the gate and the two tests were re-run after
    rebasing onto bf0b177 (brotli boxing).

Out of scope, measured while probing and left for their own issues:
workerd's truncated-gzip close message (Called close() on a decompression stream with incomplete data vs cello's Decompression failed.),
CompressionStream accepting a string chunk (workerd UTF-8-encodes it), and
workerd's failed compression writable staying locked after releaseLock().

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 60dc4954-65c5-451d-99ed-2fc6ff7d7d80
Commits

Reviewing files that changed from the base of the PR and between bf0b177 and bc4cc02.

Files selected for processing: 6

  • crates/cello/js/compression_streams.js
  • crates/cello/js/writable_stream.js
  • crates/cello/tests/stream_edges_conformance.rs
  • docs/changelog.md
  • scripts/workerd-diff/cases.mjs
  • scripts/workerd-diff/corpus/streams/index.js
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

- A released WritableStreamDefaultWriter throws workerd's released
  TypeError from desiredSize in every state, and releaseLock installs a
  fresh rejected ready (a pre-release read keeps the old settlement) while
  closed keeps its own once settled.
- DecompressionStream/CompressionStream writables behave as workerd's
  internal streams after a failed push or flush: the writable side closes,
  so later write()/close() report the closed-stream TypeError, desiredSize
  is 0, abort() resolves, writer.closed rejects with the failure and
  writer.ready resolves.
- The gate gains writer-released and decompression-close-after-error;
  crates/cello/tests/stream_edges_conformance.rs pins both, verified
  failing on 209791e.
- The two stream cases from this change are in the total.
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.

1 participant