Skip to content

[build] Break JSG dependency on kj-http - #8694

Merged
fhanau merged 4 commits into
mainfrom
felix/101726-util
Nov 20, 2026
Merged

fhanau merged 4 commits into
mainfrom
felix/101726-util

Conversation

@fhanau

@fhanau fhanau commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

This was intended to also cover zlib but that doesn't work atm due to a transitive dependency via autogate

@fhanau
fhanau requested a review from npaun November 19, 2026 21:59
@fhanau
fhanau requested review from a team as code owners November 19, 2026 21:59

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of cc6ec525.

This review, of a9c4fea6

💬 Approved with comments — One WARNING: worker-interface-test and bench-revocable-worker-interface no longer get //src/workerd/util (wait-list.h), so both will fail to build. The shipped targets look correctly wired.

Findings: 1 warning (1 is an inline comment on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.

🔧 Fix with your agent

Paste the following into your coding agent to investigate and fix these issues.

Fix the following code review issues found in pull request #8694.

Before making changes, review each issue and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g., the fix would require disproportionate changes
  for minimal ROI, or the finding is factually incorrect), explain why
- If you need to clarify something before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

## WARNING (1)

### [Code Quality] `worker-interface-test` and `bench-revocable-worker-interface` use `wait-list.h` / `CrossThreadWaitList` but no longer get `//src/workerd/util` through `:worker-interface`, so both will fail to build.
- **File:** src/workerd/io/BUILD.bazel:525

📋 Code Quality: ⚠️ 1 warning

The worker-interface test and benchmark lose their only path to wait-list.h and will fail to build.

Recommendation: 📝 Minor Comments

  • [WARNING] worker-interface-test and bench-revocable-worker-interface use wait-list.h / CrossThreadWaitList but no longer get //src/workerd/util through :worker-interface, so both will fail to build. (src/workerd/io/BUILD.bazel:525)
View full review

src/workerd/io/BUILD.bazel:525 (and the dependents at :533-541)

worker-interface now depends on //src/workerd/util:stream-utils instead of the whole //src/workerd/util target. That is correct for the library: worker-interface.c++ only includes stream-utils.h.

Two targets depend on nothing but :worker-interface, and both still use CrossThreadWaitList:

  • worker-interface-test.c++:8 includes <workerd/util/wait-list.h> and uses CrossThreadWaitList at line 101.
  • bench-revocable-worker-interface.c++:13 includes the same header and uses CrossThreadWaitList at line 75.

wait-list.h and wait-list.c++ come only from //src/workerd/util:util. No remaining transitive dependency provides that target: not :trace, not the capnp targets, not stream-utils. Both targets will fail to compile or link.

Fix: add //src/workerd/util to the deps of worker-interface-test and bench-revocable-worker-interface. Don't put it back on the library.

The rest of the re-plumbing looks correct. This covers moving wrapped-binding, access-info, invocation-span, http-util, abortable and stream-utils into their own targets, and the new direct dependencies in api, server and factory.


✅ All other checks passed

🔒 Security: ✅ LGTM

Only build files and include lines change; nothing here affects security.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md updates needed.


⚡ Performance: ✅ LGTM

Only the build is refactored; runtime performance is unaffected.


📝 Documentation: ✅ LGTM

No documentation concerns.


Reviewed commit: a9c4fea6

Comment thread src/workerd/io/BUILD.bazel Resolved

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 2f05d09a.

This review, of cc6ec525

✅ Approved — The only earlier finding, the missing //src/workerd/util dependency on the worker-interface test and benchmark, is fixed, and the rest of the dependency changes look correct.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

Only build files and include lines change; nothing here affects security.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md updates needed.


📋 Code Quality: ✅ LGTM

The earlier warning is fixed: worker-interface-test and bench-revocable-worker-interface now list //src/workerd/util in their deps. The rest of the target splits and dependency narrowing (http-util, stream-utils, abortable, wrapped-binding, autogate, thread-scopes) look correct.


⚡ Performance: ✅ LGTM

This is a build-only refactor, so runtime performance is unaffected.


📝 Documentation: ✅ LGTM

No documentation concerns.


Reviewed commit: cc6ec525

@codecov-commenter

codecov-commenter commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.33%. Comparing base (7545be6) to head (11dc10b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8694      +/-   ##
==========================================
- Coverage   67.34%   67.33%   -0.01%     
==========================================
  Files         836      836              
  Lines      213706   213706              
  Branches    32485    32485              
==========================================
- Hits       143922   143907      -15     
- Misses      50687    50702      +15     
  Partials    19097    19097              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 9b752ea8.

This review, of 2f05d09a

✅ Approved — This is a build-only refactor. The new target splits and dependency changes are consistent: each split-off header has a matching target, and its consumers declare it as a dependency. The finding from the earlier review, the missing util dependency on the worker-interface test and benchmark, has been fixed.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

Only build files and include lines change, so nothing here affects security.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md updates needed.


📋 Code Quality: ✅ LGTM

The util package now has separate stream-utils, canceler, abortable and http-util targets. The io package now has separate async-trace-inspector, async-trace-stacks, access-info and invocation-span targets. The api package now has separate wrapped-binding and crypto-endianness targets. The targets that use each of them depend on them. abortable.h now includes canceler.h by its workspace-rooted path. worker-interface-test and bench-revocable-worker-interface now list //src/workerd/util in their deps. The includes removed from the source files are not used there.


⚡ Performance: ✅ LGTM

This is a build-only refactor and has no runtime performance impact.


📝 Documentation: ✅ LGTM

No documentation concerns.


Reviewed commit: 2f05d09a

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 136d7f1d.

This review, of 9b752ea8

✅ Approved — This is a build-only refactor with no issues found. The new .bazelrc change sets one consistent Windows API level in place of hiding macro-redefinition warnings.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

Only build configuration and include lines change, so nothing here affects security.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md updates needed.


📋 Code Quality: ✅ LGTM

The target splits and dependency changes are consistent. The new .bazelrc setting gives all Windows compilation units one _WIN32_WINNT value (0x0A00), and the comment explains why.


⚡ Performance: ✅ LGTM

This is a build-only change and has no runtime performance impact.


📝 Documentation: ✅ LGTM

No documentation concerns.


Reviewed commit: 9b752ea8

@KirillTim

Copy link
Copy Markdown
Contributor

Nit:
My clanker noticed that we can cleanup build graph even more by moving "//src/workerd/util:stream-utils" from deps to implementation_deps in targets that were changed in the MR.
There five different places, so instead of leaving five comments, here is the whole patch:

$ cat workerd-dependency-cleanup.patch
diff --git a/src/workerd/api/BUILD.bazel b/src/workerd/api/BUILD.bazel
index 7d8e48a59d3e46f11859675b8e699e81014c8ecf..e12a9c89059bb25f0adcdfa99b9a14b79e4f7879 100644
--- a/src/workerd/api/BUILD.bazel
+++ b/src/workerd/api/BUILD.bazel
@@ -913,6 +913,7 @@ kj_test(
     deps = [
         "//src/workerd/io",
         "//src/workerd/tests:test-fixture",
+        "//src/workerd/util:stream-utils",
     ],
 )
 
diff --git a/src/workerd/io/BUILD.bazel b/src/workerd/io/BUILD.bazel
index 419bf4ca4116a12eec890e1674c40814b215dd42..e56a8431d26225902879f475cdf0b66215ce6582 100644
--- a/src/workerd/io/BUILD.bazel
+++ b/src/workerd/io/BUILD.bazel
@@ -137,8 +137,8 @@ wd_cc_library(
         "//src/workerd/util:abortable",
         "//src/workerd/util:completion-membrane",
         "//src/workerd/util:entropy",
-        "//src/workerd/util:http-util",
         "//src/workerd/util:perfetto",
+        "//src/workerd/util:stream-utils",
         "//src/workerd/util:string-buffer",
         "//src/workerd/util:strings",
         "//src/workerd/util:uuid",
@@ -197,7 +197,6 @@ wd_cc_library(
         "//src/workerd/util:small-weak-vector",
         "//src/workerd/util:sqlite",
         "//src/workerd/util:state-machine",
-        "//src/workerd/util:stream-utils",
         "//src/workerd/util:strong-bool",
         "@capnp-cpp//src/capnp:capnp-rpc",
         "@capnp-cpp//src/capnp/compat:http-over-capnp",
@@ -517,13 +516,15 @@ wd_cc_library(
     name = "worker-interface",
     srcs = ["worker-interface.c++"],
     hdrs = ["worker-interface.h"],
+    implementation_deps = [
+        "//src/workerd/util:stream-utils",
+    ],
     visibility = ["//visibility:public"],
     deps = [
         ":bench_capnp",
         ":frankenvalue_capnp",
         ":trace",
         ":worker-interface_capnp",
-        "//src/workerd/util:stream-utils",
         "@capnp-cpp//src/capnp:capnp-rpc",
         "@capnp-cpp//src/capnp:capnpc",
         "@capnp-cpp//src/capnp/compat:http-over-capnp",
@@ -535,6 +536,7 @@ kj_test(
     deps = [
         ":worker-interface",
         "//src/workerd/util",
+        "//src/workerd/util:stream-utils",
     ],
 )
 
@@ -544,6 +546,7 @@ wd_cc_benchmark(
     deps = [
         ":worker-interface",
         "//src/workerd/util",
+        "//src/workerd/util:stream-utils",
     ],
 )
 
diff --git a/src/workerd/server/BUILD.bazel b/src/workerd/server/BUILD.bazel
index a2feccfdfbc740760ac8fb835b2fc913398274f7..360f5c1712bca97c59073d2f9879c1421e1341a7 100644
--- a/src/workerd/server/BUILD.bazel
+++ b/src/workerd/server/BUILD.bazel
@@ -312,6 +312,9 @@ wd_cc_library(
     name = "container-client",
     srcs = ["container-client.c++"],
     hdrs = ["container-client.h"],
+    implementation_deps = [
+        "//src/workerd/util:stream-utils",
+    ],
     visibility = ["//visibility:public"],
     deps = [
         ":channel-token",
diff --git a/src/workerd/server/factory/BUILD.bazel b/src/workerd/server/factory/BUILD.bazel
index 4885350c85f0a3f4ae17f2fa0cdb6dabc249df5c..37d7c42223ad8a9368ea0ac4ba2178a25b9e36e5 100644
--- a/src/workerd/server/factory/BUILD.bazel
+++ b/src/workerd/server/factory/BUILD.bazel
@@ -55,6 +55,9 @@ wd_cc_library(
         "worker-factory-otlp.c++",
         "worker-factory-rpc.c++",
     ],
+    implementation_deps = [
+        "//src/workerd/util:stream-utils",
+    ],
     linkstatic = CC_LIBRARY_LINKSTATIC,
     deps = [
         ":otlp-export-queue",
diff --git a/src/workerd/tests/BUILD.bazel b/src/workerd/tests/BUILD.bazel
index 238c711bdb360336bc59b7c23ec2dd5a37909648..516825f0c32319e132f6fe7e0369589f9cebe9db 100644
--- a/src/workerd/tests/BUILD.bazel
+++ b/src/workerd/tests/BUILD.bazel
@@ -57,6 +57,9 @@ wd_cc_library(
     name = "test-fixture",
     srcs = ["test-fixture.c++"],
     hdrs = ["test-fixture.h"],
+    implementation_deps = [
+        "//src/workerd/util:stream-utils",
+    ],
     visibility = ["//visibility:public"],
     deps = [
         "//src/workerd/io",

@KirillTim

Copy link
Copy Markdown
Contributor

Nit:
in

we need to add the new targets if we still want them to be checked:

        if: inputs.parse_headers
        run: |
          bazel build --config=parse_headers ${{ env.BAZEL_REMOTE_ARGS }} ${{ env.DEVELOPER_FLAGS }} --config=ci ${{ env.EXTRA_BAZEL_ARGS }} \
            //src/workerd/util \
            //src/workerd/util:abortable \
            //src/workerd/util:canceler \
            //src/workerd/util:http-util \
            //src/workerd/util:stream-utils

@fhanau
fhanau requested a review from a team as a code owner November 20, 2026 18:07

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 62a034a6.

This review, of 136d7f1d

✅ Approved — This is a build-only refactor and no issues were found. Recent changes follow the approver's suggestions on implementation_deps and on the parse_headers CI step.

Not opened by the correctness review: 4 changed files it was meant to read
  • src/workerd/api/BUILD.bazel
  • src/workerd/io/BUILD.bazel
  • src/workerd/server/BUILD.bazel
  • src/workerd/server/factory/BUILD.bazel

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

Only build configuration and include lines change, so nothing here affects security.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md updates needed.


📋 Code Quality: ✅ LGTM

Each removed http-util.h include is in a file that does not use the helpers. stream-utils, canceler and abortable are declared by every target that includes them. autogate can depend on sentry and zlib-router through implementation_deps because its header includes neither. The .bazelrc change sets one _WIN32_WINNT value in place of hiding macro-redefinition warnings. The parse_headers CI step now lists the new util targets.


⚡ Performance: ✅ LGTM

This is a build-only change and has no runtime performance impact.


📝 Documentation: ✅ LGTM

No documentation concerns.


Reviewed commit: 136d7f1d

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 11dc10b4.

This review, of 62a034a6

✅ Approved — This is a build-only refactor: it splits Bazel targets, removes unused includes and makes the Windows API level definition consistent. No issues were found, and the latest change to the test fixture BUILD deps matches what the fixture includes.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

Only Bazel targets, .bazelrc, the CI workflow and #include lines change. Nothing here affects security.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md updates are needed.


📋 Code Quality: ✅ LGTM

I compared the util target split and the removed http-util.h includes against every file that includes the affected headers.

  • New util targets: Every file that includes stream-utils.h, abortable.h, canceler.h or http-util.h has a matching BUILD dependency.
  • worker-interface: Dropping //src/workerd/util is safe, because the header no longer needs it. kj-http still comes in through http-over-capnp.
  • Removed http-util.h includes: None of the files that lost the include still use its helpers.
  • autogate: Moving sentry and zlib-router to implementation_deps matches what its header includes.
  • tests/BUILD.bazel: The new stream-utils implementation_deps on the test-fixture targets match the include in test-fixture.c++.

⚡ Performance: ✅ LGTM

This is a build-only change and has no runtime performance impact.


📝 Documentation: ✅ LGTM

No documentation concerns.


Reviewed commit: 62a034a6

There's no reason for this to be included
Hopefully the comment will encourage people to not add files to io that don't
need to be there
This fixes an implicit dependency of api/crypto/endianness.c++ on V8 since it
depends on a recent API level for some functions it uses. rules_cc expects us to
pass the full /D argument instead of just the value.

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — This is a build-only refactor: it splits Bazel targets, removes unused includes and makes the Windows API level definition consistent. No issues were found, and the latest change to the test fixture BUILD deps matches what the fixture includes.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

Only Bazel targets, .bazelrc, the CI workflow and #include lines change. Nothing here affects security.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md updates are needed.


📋 Code Quality: ✅ LGTM

I compared the util target split and the removed http-util.h includes against every file that includes the affected headers.

  • New util targets: Every file that includes stream-utils.h, abortable.h, canceler.h or http-util.h has a matching BUILD dependency.
  • worker-interface: Dropping //src/workerd/util is safe, because the header no longer needs it. kj-http still comes in through http-over-capnp.
  • Removed http-util.h includes: None of the files that lost the include still use its helpers.
  • autogate: Moving sentry and zlib-router to implementation_deps matches what its header includes.
  • tests/BUILD.bazel: The new stream-utils implementation_deps on the test-fixture targets match the include in test-fixture.c++.

⚡ Performance: ✅ LGTM

This is a build-only change and has no runtime performance impact.


📝 Documentation: ✅ LGTM

No documentation concerns.


Reviewed commit: 11dc10b4 — same changes as 62a034a6, so this is that commit's review (no new review was run; line numbers are as of 62a034a6)

@fhanau
fhanau merged commit 1a676ed into main Nov 20, 2026
23 of 24 checks passed
@fhanau
fhanau deleted the felix/101726-util branch November 20, 2026 23:56
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.

5 participants