Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cloudflare/workerd
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b608e171b40ec35e96654c05de2c93250167726b
Choose a base ref
...
head repository: cloudflare/workerd
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 80ffbaa51086f6df2c64d192dba0b728da5d4847
Choose a head ref

Commits on Mar 12, 2025

  1. Copy the full SHA
    d4ae1f3 View commit details

Commits on Mar 13, 2025

  1. Ask Claude to implement encodeResponseBody: "manual" option.

    The `Response` encoder has long had a non-standard option `encodeBody: "manual"` which says: "Do not automatically compress the body according to content-encoding; assume the bytes I provide are already compressed."
    
    However, this only allowed you to construct a `Response` to return with manual encoding. If you made at outgoing HTTP request, and the response was compressed, there was no way to stop the runtime from automatically decompressing it. This commit adds such a way: setting `encodeResponseBody: "manual"` as an option to `fetch()`.
    
    (Of course, `encodeResponseBody` is a non-standard option, but `encodeBody` is as well.)
    
    🚨🚨 THIS PR WAS WRITTEN BY CLAUDE.AI 🚨🚨
    (with a lot of prompting by me -- [see trascript](https://claude-workerd-transcript.pages.dev/))
    
    This was an experiment to see how well Claude Code could handle the `workerd` codebase. Final stats:
    
    ```
    Total cost:            $9.77
    Total duration (API):  17m 15.5s
    Total duration (wall): 1h 38m 26.7s
    ```
    
    These numbers are... quite a bit larger than what I've seen when working with Claude Code on smaller, simpler projects.
    
    I am... not really sure I saved much time on the implementation itself, vs. writing it manually. But I am impressed that Claude figured it out! And I especially appreciated it writing the unit test because I hate writing tests.
    kentonv committed Mar 13, 2025
    Copy the full SHA
    cd3fdb3 View commit details
  2. Copy the full SHA
    fa37d08 View commit details
  3. Fix "actor still initializing when getHandler() called" with containers.

    We observed this error in production when testing containers.
    
    This change was technically composed by Claude Code. Transcript: https://claude-workerd-transcript.pages.dev/ensure-constructed
    
    Claude was surprisingly quick to narrow down where the problem might be, given just the error message.
    
    However, ultimately it needed hints to figure out the actual problem, and the code it initially proposed as the fix was not very good (though its choice to use `KJ_ON_SCOPE_FAILURE` was interesting!).
    
    The code in this commit may have been written by it, but only after very explicit prompting from me on what to do.
    
    I think I would have found and fixed the problem more quickly without Claude, but its ability to reason about the code is nevertheless impressive.
    kentonv committed Mar 13, 2025
    Copy the full SHA
    b6294dc View commit details
  4. Fix another small bug in ensureConstructorImpl().

    This was pre-existing (before the containers changes). I'm not sure if it would have been possible to trigger in practice, I noticed just from looking at the code.
    kentonv committed Mar 13, 2025
    Copy the full SHA
    a687be1 View commit details
  5. Move pipelines types to module cloudflare:pipelines

    Inherit Env from WorkerEntrypoint in PipelineEntrypoint
    hhoughgg authored and a-robinson committed Mar 13, 2025
    Copy the full SHA
    c9193c3 View commit details
  6. Merge pull request #3700 from cloudflare/lambros/cfsql-1220-d1-sessio…

    …ns-api-default
    
    Make the D1 Sessions API default allowed for everyone
    lambrospetrou authored Mar 13, 2025
    Copy the full SHA
    4d9e867 View commit details
  7. Copy the full SHA
    d3527e6 View commit details
  8. Merge pull request #3689 from cloudflare/dominik/python-sdk-request

    Implements Request class in Python SDK.
    dom96 authored Mar 13, 2025
    Copy the full SHA
    ecbb83e View commit details
  9. Importable env types, take 2 (#3703)

    * Update rpc.d.ts
    
    * fix type snapshot
    penalosa authored Mar 13, 2025
    Copy the full SHA
    af623c5 View commit details
  10. Extend D1 Binding types to include Sessions API

    We are introducing the new Sessions API with D1 databases to be used
    with read replication.
    This change extends the TypeScript types for the binding to include
    the Sessions API.
    lambrospetrou committed Mar 13, 2025
    Copy the full SHA
    42e0332 View commit details
  11. update types/generated-snapshots

    Run: bazel build //types:types && rm -rf types/generated-snapshot && cp -r bazel-bin/types/definitions types/generated-snapshot
    lambrospetrou committed Mar 13, 2025
    Copy the full SHA
    3ef14ba View commit details
  12. Fix eslint

    lambrospetrou committed Mar 13, 2025
    Copy the full SHA
    380442a View commit details
  13. Merge pull request #3673 from cloudflare/kenton/fix-ensure-constructe…

    …d-race
    
    Fix "actor still initializing when getHandler() called" with containers.
    kentonv authored Mar 13, 2025
    Copy the full SHA
    c9b3c6b View commit details
  14. Merge pull request #3669 from cloudflare/kenton/fetch-manual-encoding

    Ask Claude to implement `encodeResponseBody: "manual"` option.
    kentonv authored Mar 13, 2025
    Copy the full SHA
    e4ea292 View commit details
  15. Copy the full SHA
    019099d View commit details
  16. Copy the full SHA
    ff3244b View commit details
  17. Merge pull request #3701 from cloudflare/lambros/cfsql-1221-extend-d1…

    …-types-with-sessions-api
    
    Extend D1 Binding types to include Sessions API
    lambrospetrou authored Mar 13, 2025
    Copy the full SHA
    294b56a View commit details
  18. update capnp (#3720)

    mikea authored Mar 13, 2025
    Copy the full SHA
    0512c0e View commit details
  19. Copy the full SHA
    30e4313 View commit details
  20. upgrade simdutf (#3719)

    mikea authored Mar 13, 2025
    Copy the full SHA
    e4788e0 View commit details
  21. Release 2025-03-13

    penalosa authored and danlapid committed Mar 13, 2025
    Copy the full SHA
    80ffbaa View commit details
Showing with 1,711 additions and 708 deletions.
  1. +0 −14 WORKSPACE
  2. +9 −1 build/deps/build_deps.jsonc
  3. +7 −0 build/deps/deps.jsonc
  4. +2 −0 build/deps/gen/build_deps.bzl
  5. +18 −0 build/deps/gen/dep_brotli.bzl
  6. +4 −4 build/deps/gen/dep_capnp_cpp.bzl
  7. +18 −0 build/deps/gen/dep_com_google_benchmark.bzl
  8. +3 −3 build/deps/gen/dep_simdutf.bzl
  9. +2 −0 build/deps/gen/deps.bzl
  10. +13 −13 src/cloudflare/internal/d1-api.ts
  11. +1 −1 src/cloudflare/internal/pipeline-transform.ts
  12. +3 −3 src/cloudflare/internal/test/d1/d1-api-test-with-sessions.js
  13. +1 −1 src/cloudflare/internal/test/d1/d1-api-test-with-sessions.wd-test
  14. +1 −1 src/cloudflare/internal/test/pipeline-transform/transform-test.js
  15. 0 src/cloudflare/{pipeline-transform.ts → pipelines.ts}
  16. +166 −19 src/pyodide/internal/workers.py
  17. +29 −6 src/workerd/api/http.c++
  18. +27 −8 src/workerd/api/http.h
  19. +5 −6 src/workerd/io/compatibility-date.capnp
  20. +1 −1 src/workerd/io/supported-compatibility-date.txt
  21. +56 −39 src/workerd/io/worker.c++
  22. +132 −0 src/workerd/server/server-test.c++
  23. +51 −1 src/workerd/server/tests/python/sdk/worker.py
  24. +6 −2 src/workerd/util/abortable.h
  25. +38 −1 types/defines/d1.d.ts
  26. +27 −24 types/defines/pipelines.d.ts
  27. +6 −0 types/defines/rpc.d.ts
  28. +69 −26 types/generated-snapshot/2021-11-03/index.d.ts
  29. +37 −30 types/generated-snapshot/2021-11-03/index.ts
  30. +69 −26 types/generated-snapshot/2022-01-31/index.d.ts
  31. +37 −30 types/generated-snapshot/2022-01-31/index.ts
  32. +69 −26 types/generated-snapshot/2022-03-21/index.d.ts
  33. +37 −30 types/generated-snapshot/2022-03-21/index.ts
  34. +69 −26 types/generated-snapshot/2022-08-04/index.d.ts
  35. +37 −30 types/generated-snapshot/2022-08-04/index.ts
  36. +69 −26 types/generated-snapshot/2022-10-31/index.d.ts
  37. +37 −30 types/generated-snapshot/2022-10-31/index.ts
  38. +69 −26 types/generated-snapshot/2022-11-30/index.d.ts
  39. +37 −30 types/generated-snapshot/2022-11-30/index.ts
  40. +69 −26 types/generated-snapshot/2023-03-01/index.d.ts
  41. +37 −30 types/generated-snapshot/2023-03-01/index.ts
  42. +69 −26 types/generated-snapshot/2023-07-01/index.d.ts
  43. +37 −30 types/generated-snapshot/2023-07-01/index.ts
  44. +69 −26 types/generated-snapshot/experimental/index.d.ts
  45. +37 −30 types/generated-snapshot/experimental/index.ts
  46. +69 −26 types/generated-snapshot/oldest/index.d.ts
  47. +37 −30 types/generated-snapshot/oldest/index.ts
  48. +25 −0 types/test/types/d1.ts
14 changes: 0 additions & 14 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -53,25 +53,11 @@ load("@rules_python//python:repositories.bzl", "py_repositories", "python_regist

py_repositories()

http_archive(
name = "com_google_benchmark",
integrity = "sha256-a8GApX0j1NlRVRn5KwyD1hsFtbqxiJYfNqx7BrDZ6c4=",
strip_prefix = "benchmark-1.8.3",
url = "https://github.com/google/benchmark/archive/refs/tags/v1.8.3.tar.gz",
)

# These are part of what's needed to get `bazel query 'deps(//...)'`, to work, but this is difficult to support
# based on our dependencies – just use cquery instead.
# load("@com_google_benchmark//:bazel/benchmark_deps.bzl", "benchmark_deps")
# benchmark_deps()

http_archive(
name = "brotli",
sha256 = "e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff",
strip_prefix = "brotli-1.1.0",
urls = ["https://github.com/google/brotli/archive/refs/tags/v1.1.0.tar.gz"],
)

http_archive(
name = "nbytes",
build_file = "//:build/BUILD.nbytes",
10 changes: 9 additions & 1 deletion build/deps/build_deps.jsonc
Original file line number Diff line number Diff line change
@@ -242,6 +242,14 @@
"file_regex": "wpt-.*.tar.gz",
"build_file": "//:build/BUILD.wpt",
"freeze_version": "wpt-afa16aa1d"
}
},
// microbenchmark
{
"type": "github_release",
"name": "com_google_benchmark",
"owner": "google",
"repo": "benchmark",
"file_regex": "benchmark-*\\.tar\\.gz"
}
]
}
7 changes: 7 additions & 0 deletions build/deps/deps.jsonc
Original file line number Diff line number Diff line change
@@ -85,6 +85,13 @@
"owner": "protocolbuffers",
"repo": "protobuf",
"file_regex": "protobuf-.*\\.tar\\.gz"
},
{
"type": "github_release",
"name": "brotli",
"owner": "google",
"repo": "brotli",
"file_regex": "brotli-*\\.tar\\.gz"
}
]
}
2 changes: 2 additions & 0 deletions build/deps/gen/build_deps.bzl
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ load("@//build/deps:gen/dep_cargo_bazel_win_x64.bzl", "dep_cargo_bazel_win_x64")
load("@//build/deps:gen/dep_clang_format_darwin_arm64.bzl", "dep_clang_format_darwin_arm64")
load("@//build/deps:gen/dep_clang_format_linux_amd64.bzl", "dep_clang_format_linux_amd64")
load("@//build/deps:gen/dep_clang_format_linux_arm64.bzl", "dep_clang_format_linux_arm64")
load("@//build/deps:gen/dep_com_google_benchmark.bzl", "dep_com_google_benchmark")
load("@//build/deps:gen/dep_cxxbridge_cmd.bzl", "dep_cxxbridge_cmd")
load("@//build/deps:gen/dep_ruff_darwin_arm64.bzl", "dep_ruff_darwin_arm64")
load("@//build/deps:gen/dep_ruff_linux_amd64.bzl", "dep_ruff_linux_amd64")
@@ -62,3 +63,4 @@ def deps_gen():
dep_ruff_linux_arm64()
dep_ruff_linux_amd64()
dep_wpt()
dep_com_google_benchmark()
18 changes: 18 additions & 0 deletions build/deps/gen/dep_brotli.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

load("@//:build/http.bzl", "http_archive")

TAG_NAME = "v1.1.0"
URL = "https://api.github.com/repos/google/brotli/tarball/v1.1.0"
STRIP_PREFIX = "google-brotli-ed738e8"
SHA256 = "10973f4b4199eafa1d5735ef661ddb2ec2f97319ee9fd1824d4aabe08cff5265"
TYPE = "tgz"

def dep_brotli():
http_archive(
name = "brotli",
url = URL,
strip_prefix = STRIP_PREFIX,
type = TYPE,
sha256 = SHA256,
)
8 changes: 4 additions & 4 deletions build/deps/gen/dep_capnp_cpp.bzl
Original file line number Diff line number Diff line change
@@ -2,11 +2,11 @@

load("@//:build/http.bzl", "http_archive")

URL = "https://github.com/capnproto/capnproto/tarball/20af9fe2de10a2e7f621a212351d20860cc32a0d"
STRIP_PREFIX = "capnproto-capnproto-20af9fe/c++"
SHA256 = "96cfddf676babe345bf321ccfaabb855dfe7dc127e69c4fdd959abd52de47721"
URL = "https://github.com/capnproto/capnproto/tarball/f8bcd72a0a469414b5fcbebb0192adfb6440396b"
STRIP_PREFIX = "capnproto-capnproto-f8bcd72/c++"
SHA256 = "e20b5919a86c121d4407cc19b589e4e26fd0e7ee980121f9c641d17ce84584a7"
TYPE = "tgz"
COMMIT = "20af9fe2de10a2e7f621a212351d20860cc32a0d"
COMMIT = "f8bcd72a0a469414b5fcbebb0192adfb6440396b"

def dep_capnp_cpp():
http_archive(
18 changes: 18 additions & 0 deletions build/deps/gen/dep_com_google_benchmark.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

load("@//:build/http.bzl", "http_archive")

TAG_NAME = "v1.9.1"
URL = "https://api.github.com/repos/google/benchmark/tarball/v1.9.1"
STRIP_PREFIX = "google-benchmark-96afad5"
SHA256 = "6e8bd8a610ad0c6814af4b3ae930517dd00fa69caf6f6f4667270fae8d47b53d"
TYPE = "tgz"

def dep_com_google_benchmark():
http_archive(
name = "com_google_benchmark",
url = URL,
strip_prefix = STRIP_PREFIX,
type = TYPE,
sha256 = SHA256,
)
6 changes: 3 additions & 3 deletions build/deps/gen/dep_simdutf.bzl
Original file line number Diff line number Diff line change
@@ -2,10 +2,10 @@

load("@//:build/http.bzl", "http_archive")

TAG_NAME = "v6.2.0"
URL = "https://github.com/simdutf/simdutf/releases/download/v6.2.0/singleheader.zip"
TAG_NAME = "v6.3.1"
URL = "https://github.com/simdutf/simdutf/releases/download/v6.3.1/singleheader.zip"
STRIP_PREFIX = ""
SHA256 = "66c85f591133e3baa23cc441d6e2400dd2c94c4902820734ddbcd9e04dd3988b"
SHA256 = "7cdd0777bf81ad5f21f9627f8aa740aaa413302b0bd8c86dffc2e6c2685009d1"
TYPE = "zip"

def dep_simdutf():
2 changes: 2 additions & 0 deletions build/deps/gen/deps.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT

load("@//build/deps:gen/dep_ada_url.bzl", "dep_ada_url")
load("@//build/deps:gen/dep_brotli.bzl", "dep_brotli")
load("@//build/deps:gen/dep_capnp_cpp.bzl", "dep_capnp_cpp")
load("@//build/deps:gen/dep_com_google_protobuf.bzl", "dep_com_google_protobuf")
load("@//build/deps:gen/dep_dawn.bzl", "dep_dawn")
@@ -20,3 +21,4 @@ def deps_gen():
dep_vulkan_headers()
dep_spirv_headers()
dep_com_google_protobuf()
dep_brotli()
26 changes: 13 additions & 13 deletions src/cloudflare/internal/d1-api.ts
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0

import flags from 'workerd:compatibility-flags';

interface Fetcher {
fetch: typeof fetch;
}
@@ -96,7 +94,9 @@ class D1Database {
return this.alwaysPrimarySession.exec(query);
}

// DEPRECATED, TO BE REMOVED WITH NEXT BREAKING CHANGE
/**
* @deprecated
*/
public async dump(): Promise<ArrayBuffer> {
return this.alwaysPrimarySession.dump();
}
@@ -108,13 +108,13 @@ class D1DatabaseWithSessionAPI extends D1Database {
}

public withSession(
constraintOrToken: D1SessionBookmarkOrConstraint | null | undefined
constraintOrBookmark?: D1SessionBookmarkOrConstraint
): D1DatabaseSession {
constraintOrToken = constraintOrToken?.trim();
if (constraintOrToken == null || constraintOrToken === '') {
constraintOrToken = D1_SESSION_CONSTRAINT_FIRST_UNCONSTRAINED;
constraintOrBookmark = constraintOrBookmark?.trim();
if (constraintOrBookmark == null || constraintOrBookmark === '') {
constraintOrBookmark = D1_SESSION_CONSTRAINT_FIRST_UNCONSTRAINED;
}
return new D1DatabaseSession(this.fetcher, constraintOrToken);
return new D1DatabaseSession(this.fetcher, constraintOrBookmark);
}
}

@@ -341,7 +341,10 @@ class D1DatabaseSessionAlwaysPrimary extends D1DatabaseSession {
}
}

// DEPRECATED, TO BE REMOVED WITH NEXT BREAKING CHANGE
/**
* DEPRECATED, TO BE REMOVED WITH NEXT BREAKING CHANGE
* Only applies to the deprecated v1 alpha databases.
*/
public async dump(): Promise<ArrayBuffer> {
const response = await this._wrappedFetch('http://d1/dump', {
method: 'POST',
@@ -570,8 +573,5 @@ async function toJson<T = unknown>(response: Response): Promise<T> {
}

export default function makeBinding(env: { fetcher: Fetcher }): D1Database {
if (flags.enableD1WithSessionsAPI) {
return new D1DatabaseWithSessionAPI(env.fetcher);
}
return new D1Database(env.fetcher);
return new D1DatabaseWithSessionAPI(env.fetcher);
}
2 changes: 1 addition & 1 deletion src/cloudflare/internal/pipeline-transform.ts
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ export class PipelineTransformImpl<

// called by the dispatcher to validate that run is properly implemented by the subclass
// @ts-expect-error thinks ping is never used
private _ping(): Promise<void> {
private async _ping(): Promise<void> {
// making sure the function was overridden by an implementing subclass
if (this.run !== PipelineTransformImpl.prototype.run) {
return Promise.resolve();
6 changes: 3 additions & 3 deletions src/cloudflare/internal/test/d1/d1-api-test-with-sessions.js
Original file line number Diff line number Diff line change
@@ -97,17 +97,17 @@ async function testD1ApiWithSessionsTokensHandling(DB, envD1MockFetcher) {
true
);

// Assert tokens sent by the DEFAULT DB.withSessions()
// Assert tokens sent by the DEFAULT DB.withSession()
await resetCommitTokens(envD1MockFetcher);
await testD1ApiQueriesHappyPath(DB.withSession());
await assertTokensSentReceived('first-unconstrained');

// Assert tokens sent by the DB.withSessions("first-unconstrained")
// Assert tokens sent by the DB.withSession("first-unconstrained")
await resetCommitTokens(envD1MockFetcher);
await testD1ApiQueriesHappyPath(DB.withSession('first-unconstrained'));
await assertTokensSentReceived('first-unconstrained');

// Assert tokens sent by the DB.withSessions("first-primary")
// Assert tokens sent by the DB.withSession("first-primary")
await resetCommitTokens(envD1MockFetcher);
await testD1ApiQueriesHappyPath(DB.withSession('first-primary'));
await assertTokensSentReceived('first-primary');
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ const unitTests :Workerd.Config = (
compatibilityDate = "2023-01-15",

# NOTE: We provide the extra compatibility flag to enable the Sessions API.
compatibilityFlags = ["nodejs_compat", "enable_d1_with_sessions_api"],
compatibilityFlags = ["nodejs_compat"],

bindings = [
(
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
// https://opensource.org/licenses/Apache-2.0

import assert from 'node:assert';
import { PipelineTransformationEntrypoint } from 'cloudflare:pipeline-transform';
import { PipelineTransformationEntrypoint } from 'cloudflare:pipelines';

// this is how "Pipeline" would be implemented by the user
const customTransform = class MyEntrypoint extends PipelineTransformationEntrypoint {
File renamed without changes.
Loading