Informal specification of the value-oriented ReadableStream as implemented in workerd, derived from — and kept in lockstep with — this suite. The tests are the normative artifact. Byte streams (type:'bytes', BYOB) belong to the readable-byte suite; the pipeTo/ pipeThrough matrix belongs to piping/. The suite COMPLEMENTS WPT (//src/wpt:streams). Probing the C++ expectedFailures showed many root-cause to a handful of construction divergences (hwm Infinity rejection, validation order) rather than behavioral gaps; the reentrancy family is mostly parity at finite hwm.
Informal specification of byte-oriented ReadableStreams as implemented in workerd, derived from — and kept in lockstep with — this suite. The tests are the normative artifact. Value streams live in readable/; the pipeTo/pipeThrough matrix belongs to piping/. The suite COMPLEMENTS WPT (//src/wpt:streams). Probing showed the C++ failures in readable-byte-streams/* root-cause to a few construction and pump divergences plus the close-with-partial and read-min shapes below; the releaseLock→second-reader cluster and the buffer-hazard families are behavior-parity (messages aside).
Dequeue cost stays linear in every internal queue of both streams implementations: buffered chunks, pending reads, pending pull-intos, write requests, the writable controller's chunk queue, and the identity stream's write snapshots. Each test drives one queue to 80k-160k entries (identity: 80k, over a 16x range) and asserts, through helpers.js, that the time grows by at most 4x the linear multiple of a run at 1/8 (identity: 1/16) the size. The ratio is machine-independent; the sizes sit well past the ~20k…
The readable/writable stream halves of connect() TCP sockets under both stream implementations. The tests are the normative artifact. The general Socket surface (startTls, secureTransport, DNS overrides, the connect-handler protocol, HTTP-over-socket) is owned by src/workerd/api/tests/ (http-socket-test, connect-handler-test, starttls-*); this suite owns the STREAMS interaction only. A node sidecar (echo-server.js) runs two TCP servers, their ports delivered through fromEnvironment bindings (STREAMSECHOPORT, STREAMSGREETPORT, plus SIDECAR_HOSTNAME): - echo: echoes every byte; on client half-close, flushes and ends (the client's readable reaches EOF after the…
An informal specification of the two WHATWG queuing strategy classes as implemented in workerd, derived from — and kept in lockstep with — the test suite in this directory. The tests are the normative artifact. Both the C++ implementation (src/workerd/api/streams/readable.h) and the TypeScript implementation (src/perisolate/webstreams/strategies.ts, behind typescriptimplemented_streams) are covered. The WPT streams/queuing-strategies.any.js runs against both implementations; its 12 C++ expectedFailures in src/wpt/streams-test.ts correspond exactly to ledger entries #1–#6 below — the suite pins what the C++ side actually does where…
An informal specification of the JS-backed TransformStream as implemented in workerd, derived from — and kept in lockstep with — the test suite in this directory. The tests are the normative artifact. Both the C++ implementation (src/workerd/api/streams/transform.c++ over standard.c++'s TransformStreamDefaultController) and the TypeScript implementation (behind typescriptimplementedstreams) are covered. The suite COMPLEMENTS WPT (//src/wpt:streams runs transform-streams/ against both implementations). Probing the 30+ C++ expectedFailures showed most narrow to a handful of root causes (below); several WPT "failures" (properties.any's arg counts/prototype-chain, the…
An informal specification of the JS-backed writable stream classes as implemented in workerd, derived from — and kept in lockstep with — the test suite in this directory. The tests are the normative artifact. Both the C++ implementation (src/workerd/api/streams/writable.{h,c++} over standard.c++'s WritableImpl/WritableStreamJsController) and the TypeScript implementation (src/perisolate/webstreams/writable.ts, behind typescriptimplemented_streams) are covered. The suite COMPLEMENTS WPT (//src/wpt:streams runs writable-streams/ against both implementations): behaviors WPT already asserts identically on both sides are not duplicated here. The WPT C++ expectedFailures for writable-streams/ in…
WebCrypto API + Node.js crypto C++ implementations over BoringSSL. crypto.h defines public JSG types (CryptoKey, SubtleCrypto, CryptoKeyUsageSet). impl.h defines internal CryptoKey::Impl base class with per-algorithm static ImportFunc/GenerateFunc dispatch. Algorithm files implement Impl subclasses. OSSLCALL() macro wraps all BoringSSL calls with error translation.
C++ implementations of Node.js built-in modules. Each module = JSG-bound class registered via NODEJS_MODULES(V) macro in node.h. TypeScript counterpart lives in src/node/. Tests in tests/. Naming: <module>-test.js + <module>-test.wd-test; -nodejs- infix when needing compat flags. All tests set compatibilityFlags = ["nodejscompat", "nodejscompatv2", "experimental"]. Network tests (net, tls, http) use sidecar jsbinary targets. fixtures/ has 46 PEM files for crypto. process-stdio tests use shtest with .expectedstdout/.expectedstderr. C++ unit test: buffer-test.c++ via kjtest.
Web Streams API: ReadableStream, WritableStream, TransformStream. See README.md for terse reference (classification, state machines, safety patterns). See docs/streams.md for narrative tutorial. NOTE: C++ code outside this directory does not use jsg::Ref<ReadableStream> or jsg::Ref<WritableStream> directly; it goes through the JsReadableStream / JsWritableStream abstractions in src/workerd/api/js-{readable,writable}-stream.{h,c++}, which hide which stream implementation backs a given stream (and provide JsReadableWritablePair + pipeTo/pipeThrough for abstraction-level pipelines). New C++ consumers of streams should use those abstractions, not the types defined here. Allocating the types defined here…
See README.md for terse reference (type mappings, macro catalog, error catalog). See docs/jsg.md for narrative tutorial. Macro-driven C++/V8 binding layer: declares C++ types as JS-visible resources/structs with automatic type conversion.
Binary + orchestration layer. :workerd is a Rust binary: the :workerd-cli crate (cli/) parses the command line (clap), produces the encoded config (schema files via config-compiler.c++), handles --watch and compile, and runs each serving subcommand (serve, compile, test, fuzzilli, pyodide-lock, make-pyodide-baseline-snapshot) through a run_* function in cli-main.c++. Server (server.c++, ~6K lines) is the god object: parses workerd.capnp config, constructs all service types as nested inner classes, wires sockets/bindings/actors, runs the event loop.
Generates @cloudflare/workers-types .d.ts files from C++ RTTI (via jsg/rtti.capnp) + hand-written defines/*.d.ts. A workerd-hosted Worker extracts RTTI at runtime per compat-date; TypeScript transforms post-process into ambient and importable outputs. CI validates generated-snapshot/ matches. Types in this project come from three layers. Changes must be made in the correct layer: Do not edit files in generated-snapshot/ directly — they are overwritten by just generate-types. If the generated output looks wrong, fix the source layer (C++ RTTI, JSGTSOVERRIDE, or defines/). Types in…
Monorepo with 40+ packages in @sentry/*, managed with Yarn workspaces and Nx. Prefer LSP over Grep/Read for code navigation — it's faster, precise, and avoids reading entire files: Use Grep only when LSP isn't available or for text/pattern searches (comments, strings, config). After writing or editing code, check LSP diagnostics and fix errors before proceeding. Use yarn, never npm or pnpm. Scripts live in the root package.json. yarn build:dev:filter @sentry/<pkg> builds one package and its deps. Single package: cd packages/<name>…
Next.js apps use either webpack or turbopack as their bundler. This fundamentally changes how Sentry instruments the application. Detection: process.env.TURBOPACK or --turbo CLI flag (see src/config/util.ts:detectActiveBundler). Webpack builds use loaders and templates to wrap user code at compile time: Template files and what they wrap: Config options that control wrapping: autoInstrumentServerFunctions, autoInstrumentMiddleware, autoInstrumentAppDirectory, excludeServerRoutes. Turbopack does NOT use the wrapping loader or templates. There is no build-time function wrapping. What turbopack does support: What turbopack does NOT support: Instrumentation with…
Official MongoDB Go Driver (go.mongodb.org/mongo-driver/v2). Correctness, backward compatibility, and conformance to MongoDB Driver Specifications are top priorities. Uses Task, not make. Tests require a running mongod on localhost:27017 (or MONGODB_URI). The full test suite is serial (-p 1) — integration tests share server state. Do not parallelize. Evergreen's project configuration lives in .evergreen/config.yml, where every task, variant, and expansion is declared; supporting CI scripts live alongside it. Validate any change with evergreen validate -p mongo-go-driver -f .evergreen/config.yml (authenticate with evergreen…