workerd / streams
AGENTS.md8.8k starsChanged 9 months agoApache-2.0View on GitHub
Streams test suite, organized WPT-style: one subdirectory per functional area (identity/, encoding/, compression/, digest/, strategies/, readable/, readable-byte/, writable/, transform/, piping/, inspect/, r2-patterns/, iocontext/, cache/, htmlrewriter/, formdata/, sockets/, scaling/). Every test here runs against both streams implementations — the legacy C++ one (src/workerd/api/streams/) and the TypeScript one (src/per_isolate/webstreams/) — to prove parity. A test that only makes sense for one implementation's internals belongs elsewhere. - One file, one behavior. Decompose aggressively; the filename names the behavior. Shared setup helpers go in…
Trending
Quiet since August.thin dataabout the whole repository
Who's talking about cloudflare/workerd
- A Hacker News story“OS Workerd, Cloudflare's JavaScript/WASM Runtime”Hacker News · Sep 27, 2022 · 27 points
- withastro/astro“Cloudflare adapter returning [object Object]”GitHub · Oct 10, 2025 · 18 reactions
- supabase/supabase-js“The 'cache' field on 'RequestInitializerDict' is not implemented - Cloudflare Workers”GitHub · Mar 28, 2024 · 16 reactions
- nodejs/node“src: improve buffer.transcode performance”GitHub · Aug 1, 2024 · 13 reactions
- NixOS/nixpkgs“Package request: workerd”GitHub · Nov 12, 2024 · 12 reactions
The biggest 5 of 12 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 12
Talked about on GitHub, Bluesky and Hacker News (12 times).
On GitHub · 6
- Oct 10, 2025Cloudflare adapter returning [object Object] — withastro/astro18 reactions · 15 comments
- Mar 28, 2024The 'cache' field on 'RequestInitializerDict' is not implemented - Cloudflare Workers — supabase/supabase-js16 reactions · 24 comments
- Aug 1, 2024src: improve buffer.transcode performance — nodejs/node13 reactions · 26 comments
- Nov 12, 2024Package request: workerd — NixOS/nixpkgs12 reactions · 8 comments
- Feb 19, 2024Add Curve25519 — w3c/webcrypto9 reactions · 16 comments
1 more on GitHub
- Nov 3, 2025Optimize TextEncoder::encode — nodejs/performance7 reactions · 33 comments
On Bluesky · 4
- Mar 24, 2026workerd : le runtime JavaScript/Wasm open source de Cloudflare Workers — @news.humancoders.com4 likes and reposts
- Aug 22, 2026Current status: trying to build github.com/cloudflare/w... on various sandbox providers — @jeremymorrell.dev1 likes and repost
- Mar 24, 2026workerd : le runtime JavaScript/Wasm qui propulse Cloudflare Workers est maintenant open source. Basé sur les standards web, il permet… — @humancoders.com1 likes and repost
- Nov 5, 2024Technically workers are open source github.com/cloudflare/w... — @userops.bsky.social1 likes and repost
On Hacker News · 2
- Sep 27, 2022OS Workerd, Cloudflare's JavaScript/WASM Runtime27 points · 2 comments
- Oct 5, 2023Cloudflare workers is adopting Ada URL parser2 points
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository61 other files it gives its agents.
- AGENTS.mdAGENTS.md
- build/AGENTS.mdAGENTS.md
- src/cloudflare/AGENTS.mdAGENTS.md
- src/node/AGENTS.mdAGENTS.md
- src/per_isolate/AGENTS.mdAGENTS.md
- src/per_isolate/crypto/AGENTS.mdAGENTS.md
- src/per_isolate/webfs/AGENTS.mdAGENTS.md
- src/per_isolate/webstreams/AGENTS.mdAGENTS.md
- src/pyodide/AGENTS.mdAGENTS.md
- src/rust/AGENTS.mdAGENTS.md
- src/rust/cxx/AGENTS.mdAGENTS.md
- src/tests/node/AGENTS.mdAGENTS.md
- src/tests/node/http-client/AGENTS.mdAGENTS.md
- src/tests/node/http-server/AGENTS.mdAGENTS.md
- src/tests/node/net/AGENTS.mdAGENTS.md
- src/tests/node/stream/AGENTS.mdAGENTS.md
- src/tests/streams/cache/AGENTS.mdAGENTS.md
- src/tests/streams/compression/AGENTS.mdAGENTS.md
- src/tests/streams/digest/AGENTS.mdAGENTS.md
- src/tests/streams/encoding/AGENTS.mdAGENTS.md
- src/tests/streams/formdata/AGENTS.mdAGENTS.md
- src/tests/streams/htmlrewriter/AGENTS.mdAGENTS.md
- src/tests/streams/identity/AGENTS.mdAGENTS.md
- src/tests/streams/inspect/AGENTS.mdAGENTS.md
- src/tests/streams/iocontext/AGENTS.mdAGENTS.md
- src/tests/streams/piping/AGENTS.mdAGENTS.md
- src/tests/streams/r2-patterns/AGENTS.mdAGENTS.md
- src/tests/streams/readable/AGENTS.mdAGENTS.md
- src/tests/streams/readable-byte/AGENTS.mdAGENTS.md
- src/tests/streams/scaling/AGENTS.mdAGENTS.md
- src/tests/streams/sockets/AGENTS.mdAGENTS.md
- src/tests/streams/strategies/AGENTS.mdAGENTS.md
- src/tests/streams/transform/AGENTS.mdAGENTS.md
- src/tests/streams/writable/AGENTS.mdAGENTS.md
- src/workerd/api/AGENTS.mdAGENTS.md
- src/workerd/api/crypto/AGENTS.mdAGENTS.md
- src/workerd/api/node/AGENTS.mdAGENTS.md
- src/workerd/api/streams/AGENTS.mdAGENTS.md
- src/workerd/io/AGENTS.mdAGENTS.md
- src/workerd/jsg/AGENTS.mdAGENTS.md
- src/workerd/server/AGENTS.mdAGENTS.md
- src/workerd/util/AGENTS.mdAGENTS.md
- types/AGENTS.mdAGENTS.md
- bazel-test-hygieneSkill
- commit-categoriesSkill
- dad-jokesSkill
- find-and-run-testsSkill
- identify-reviewerSkill
- investigation-notesSkill
- kj-styleSkill
- markdown-draftsSkill
- parent-project-skillsSkill
- pr-review-guideSkill
- receiving-code-reviewSkill
- rust-reviewSkill
- ts-styleSkill
- update-v8Skill
- wd-test-formatSkill
- workerd-api-reviewSkill
- workerd-safety-reviewSkill
- The first 60 shown.
The file
We split this AGENTS.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 58
If a test fails only under @all-compat-flags, a date-gated flag changes the behavior: identify it (compatibility-date.capnp) and pin it, …
- Very specific: line 91
Preserve the outgoing behavior as a legacy test: Add legacy-*.js module(s) asserting the pre-flag behavior, run by the unflagged …
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
src/tests/streams/
Streams test suite, organized WPT-style: one subdirectory per functional area
(identity/, encoding/, compression/, digest/, strategies/,
readable/, readable-byte/, writable/, transform/, piping/,
inspect/, r2-patterns/, iocontext/, cache/, htmlrewriter/,
formdata/, sockets/, scaling/). Every
test here runs against both streams implementations — the legacy C++ one
(src/workerd/api/streams/) and the TypeScript one
(src/per_isolate/webstreams/) — to prove parity. A test that only makes
sense for one implementation's internals belongs elsewhere.
Structure of a suite directory
identity/
identity-modules.capnp # THE module list, defined once (see below)
identity-cpp.wd-test # runs the modules against the C++ implementation
identity-ts.wd-test # runs the *same* modules against the TS implementation
main.js # entry point: explicit re-exports of every test
which-impl.js # exports usingTsImpl (see Divergences)
<behavior>.js # one file per behavior, small and single-purpose
BUILD.bazel # wd_test() targets over glob(["*.js"]) + the .capnp- One file, one behavior. Decompose aggressively; the filename names the behavior. Shared setup helpers go in the file that needs them until a real need for a shared helper module appears.
main.jsuses explicit named re-exports, neverexport *. A name collision between two modules must be a load-time SyntaxError, not a silently dropped test.- The module list is defined exactly once, as a
List(Workerd.Worker.Module)constant in<name>-modules.capnp, which both main configs import and reference (modules = IdentityModules.modules). Sharing the test modules is the point: behavioral drift between the implementations fails one config or the other, and a single source of truth makes it impossible for the two cells to embed different code. A new test module is added in two places only: the.capnpconstant andmain.js. (embedpaths resolve relative to the.capnpfile; the legacy cell's deliberately different, smaller list stays inline in its own config.)
Compatibility flags, not dates
Configs do not set compatibilityDate. The wd_test variant machinery
owns the date axis (@ runs at 2000-01-01, @all-compat-flags at
2999-12-31) and the tests must pass at both extremes. Every date-gated
behavior a test depends on is pinned by naming its flag in both configs.
Each suite's <name>-cpp.wd-test documents its pinned set with a one-line
reason per flag, and the suite's AGENTS.md tables the flags against the
legacy tests that guard their unflagged sides. The TypeScript implementation
hard-codes the modern behaviors, so pinning them also keeps the two cells
comparable at the oldest date. Dateless opt-in flags that gate behaviors on
a suite's surface (e.g. pedantic_wpt) get a dedicated cell running the
full shared module set with the flag added, with the flag-off side pinned
in the legacy cells.
If a test fails only under @all-compat-flags, a date-gated flag changes the
behavior: identify it (compatibility-date.capnp) and pin it, don't pin a
date.
Legacy (unflagged) cells
Pinning flags in the main configs means the suite never exercises the
pre-flag behaviors — the ones workers with old compat dates still depend on
and that backward compatibility protects. Each suite therefore also carries a
<name>-cpp-legacy.wd-test cell that omits the semantic flags entirely and
asserts the original behaviors as a regression guard (separate legacy-*.js
modules with their own legacy-main.js entry point). Legacy cells are
C++-only — the TypeScript implementation hard-codes the modern behaviors
regardless of these flags — and their wd_test sets
generate_all_compat_flags_variant = False, since the 2999-12-31 variant
would turn the omitted flags back on and contradict the cell's purpose.
Main cells track current defaults
<name>-cpp.wd-test and <name>-ts.wd-test must always reflect the
behavior a newly created worker gets today. When a new streams-relevant
compatibility flag lands in compatibility-date.capnp, the suite is updated
in the same change:
- Pin the new flag in the main config of every implementation whose
behavior it changes. The C++ cell pins every semantic flag it is
subject to. The TS cell stays minimal, pinning only flags the TypeScript
implementation actually consults — its omissions are themselves an
assertion of flag-indifference (see the comment in
identity-ts.wd-test). - Update the shared tests to assert the new default behavior, using the
which-implpattern wherever the implementations diverge under the new flag. - Preserve the outgoing behavior as a legacy test. Add
legacy-*.jsmodule(s) asserting the pre-flag behavior, run by the unflagged<name>-cpp-legacy.wd-testcell. If the pre-flag behavior cannot be reproduced by the fully-unflagged cell — for example, it only manifests in combination with some other flag being on — add a dedicated legacy config pinning exactly that combination, again withgenerate_all_compat_flags_variant = False.
A main cell that lags the current defaults is a bug in the suite: it means the behavior new workers actually receive is untested. Legacy assertions are never deleted while the C++ implementation still serves workers pinned to older compat dates.
Divergences
Where the implementations deliberately differ, do not loosen the assertion to whatever both happen to satisfy. Branch on the implementation and assert each side's exact behavior:
import { usingTsImpl } from 'which-impl';
const expected = usingTsImpl ? RangeError : TypeError;
throws(() => new FixedLengthStream(-1), expected);which-impl.js reads
globalThis.Cloudflare.compatibilityFlags['typescript_implemented_streams'].
This pins every known divergence: if either implementation changes its side,
the corresponding cell fails. Document each divergence in the header comment
of the file that asserts it.
Running
bazel test //src/tests/streams/... --nocache_test_resultsTargets per suite: <name>-cpp@, <name>-ts@, each with @all-compat-flags
and @all-autogates variants, plus @gc-stress (off-by-default; run with
--test_tag_filters=). workerd test requires an exported test() handler
per case; assertions come from node:assert (nodejs_compat is in both
configs' flag lists). The scaling/ suite is the exception to the
variant set: it times shapes at 80k-160k entries, so it has no
@gc-stress variant, skips the sanitizer builds, and its C++ cell is
off-by-default (see its AGENTS.md).
Streams tests that live elsewhere (by design)
src/tests/node/— the Node.js compatibility layer's USE of web streams (node:streamadapters,node:netsockets, thenode:httpclient and server), under the same suite rules and the same cpp/ts cells; each suite'sAGENTS.mdthere carries its own ledger. A pure web-streams behavior found through the node layer is pinned here, not there (e.g.readableledger #18).src/workerd/api/tests/js-rpc-streams-*— stream serialization over JS RPC (including ts-impl cells); owned by the worker-rpc domain.src/workerd/api/tests/ts-webstreams-test.js— TypeScript-impl internals (native/buffer/iterable bodies ARE ts streams, pumpTo); single-implementation by nature.- Security regression singles in
src/workerd/api/tests/(streams-byob-close-reentry, streams-byob-concurrent-readatleast, streams-byte-cancel-uaf, streams-byte-handlePush-uaf, streams-circ-ref-regression, streams-consumer-reentry-gc, streams-internal-read-buffer-gc, autovuln-*) — authoritative crash/UAF repros, deliberately not merged into suites. src/workerd/api/streams/streams-test.js—partiallyReadStream(needs a KV binding).
IDL shape (deliberately not pinned here)
WebIDL function metadata — operation .length values (optional
arguments do not count), and promise-typed attributes/operations
REJECTING rather than throwing on a broken this — is enumerated
per-implementation by WPT's idlharness.any.js: the C++ implementation
carries the known deviations as expectedFailures in
src/wpt/streams-test.ts; the TypeScript implementation matches spec.
The suites do not duplicate that enumeration.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

