Skip to content

[build] Address aspect-build/rules_ts#664, drop Windows workaround#6797

Open
fhanau wants to merge 1 commit into
mainfrom
felix/060326-drop-windows-workaround
Open

[build] Address aspect-build/rules_ts#664, drop Windows workaround#6797
fhanau wants to merge 1 commit into
mainfrom
felix/060326-drop-windows-workaround

Conversation

@fhanau
Copy link
Copy Markdown
Contributor

@fhanau fhanau commented Jun 4, 2026

Finally figured out how to solve this. We need to ensure that rules_ts enables the composite setting and avoid writing to the same path twice since Windows does not have a proper Bazel sandbox.
Also update to the latest Bazel release and enable --rewind_lost_inputs, both of these should help with the Bazel remote cache issues we've seen.

=============

This issue has hounded workerd CI and made the Windows build slower than it needs to be for more than a year, glad that we can get rid of the workaround. I did a bunch of testing on #1528 (my perpetual build systems draft PR) to ensure that this being solved is not just a mirage based on getting the right outputs from the remote cache, but also happens when caching is disabled.
As a fun side effect, we also get to re-enable a test that was disabled due to the same root cause.

@fhanau fhanau requested review from a team as code owners June 4, 2026 01:26
@fhanau fhanau requested a review from edmundhung June 4, 2026 01:26
Comment thread build/wd_test.bzl
name = src.removesuffix(".capnp").removesuffix(".wd-test").removesuffix(".ts-wd-test")

if len(ts_srcs) != 0:
# NOTE: We intentionally do not use isolated_typecheck here. While isolated_typecheck can
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm dropping this comment on purpose: isolated_typecheck would allow us to get rid of a type check action in cases where it is not needed which is why I was interested in it, but as the comment states this would require quite a bit of work and the gain is relatively small. This comment is an AI-generated replacement for a comment I originally wrote. There is no need to describe it in this much detail and for our purposes not having isolated_typecheck is not a big loss.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Jun 4, 2026

Both callers that used wd_ts_project already explicitly set composite = True, so the default change is safe. The wd_ts_test calls from types/BUILD.bazel also explicitly set composite = True.

Now let me look at the src/wpt/BUILD.bazel -- it uses wd_ts_project but does NOT pass composite. It was previously defaulting to False, and now will default to True. This is a behavioral change. Let me verify if this is safe:

The wd_ts_project at src/wpt/BUILD.bazel:15 does not pass composite, so it gets the default. Before this PR, default was False; after this PR, default is True. This might affect the WPT build. However, the PR is specifically enabling composite everywhere to fix the rules_ts issue, so this is intentional.

Let me now do a final review of all the changes as a whole. The changes look correct and well-motivated. Let me verify the types/tsconfig.json diff is purely a cleanup (composite is inherited from base):

The types/tsconfig.json removes:

  1. "composite": true -- now inherited from base.tsconfig.json (no behavioral change)
  2. An empty line -- cosmetic cleanup

Both are correct.

This PR looks clean. The key changes are:

  1. Bazel 9.1.0 -> 9.1.1
  2. --rewind_lost_inputs for CI cache resilience
  3. composite = true enabled globally for TypeScript (fixing rules_ts#664)
  4. Per-test ts_project in wd_test.bzl replaced with a single consolidated ts_project in BUILD.bazel
  5. Windows workaround build step removed from CI
  6. form-data-test-ts re-enabled

All changes are build-system-only, no runtime behavior changes, no backward compatibility concerns.

LGTM

github run

Finally figured out how to solve this. We need to ensure that rules_ts enables
the composite setting and avoid writing to the same path twice since Windows
does not have a proper Bazel sandbox.
Also update to the latest Bazel release and enable --rewind_lost_inputs, both of
these should help with the Bazel remote cache issues we've seen.
@fhanau fhanau force-pushed the felix/060326-drop-windows-workaround branch from b200fa6 to 3f1de20 Compare June 4, 2026 01:36
@fhanau fhanau requested a review from mikea June 4, 2026 02:13
@npaun
Copy link
Copy Markdown
Member

npaun commented Jun 4, 2026

The WPT test config is also TS. Was the trick already used there?

@fhanau
Copy link
Copy Markdown
Contributor Author

fhanau commented Jun 4, 2026

The WPT test config is also TS. Was the trick already used there?

Likely more as a lucky accident, but yes – it has a single ts_project, so there's no concern about files being generated twice. We still had //src/wpt:wpt-all@tsproject in the set of targets where the prior workaround was being applied – I think it might not have been needed for all of them, or it might have been needed for importing node correctly since composite needs to be set.

@npaun
Copy link
Copy Markdown
Member

npaun commented Jun 4, 2026

@fhanau

Putting it all into one project was intentional, but I didn't know I needed composite. Thanks for getting this sorted out.

Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Approving on behalf of wrangler for the "typings" files.

@petebacondarwin petebacondarwin removed the request for review from edmundhung June 5, 2026 11: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.

4 participants