Skip to content

test(browser): boot browser:check and act:check in bare workerd, with no Miniflare - #2060

Open
oddharsh wants to merge 5 commits into
mainfrom
claude/browser-act-workerd
Open

oddharsh wants to merge 5 commits into
mainfrom
claude/browser-act-workerd

Conversation

@oddharsh

@oddharsh oddharsh commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Stacked on #2055, which is stacked on #2052: merge those first, and this diff shrinks to the last commit.

browser:check and act:check boot wrangler's createTestHarness with the site and aadhar-counter, which holds them on node (gotcha 38, bun#39247). Plain workerd serve can't carry them: COUNTER binds a class in aadhar-counter, and browser:check seeds Serendipity's D1 through the harness's getEnv().

So tools/lib/workerd-boot.ts boots the whole site as one capnp config. siteCapnp (replacing #2052's 2-row crossScriptCapnp) wires vars, KV, R2, D1, rate limits, the Cache API and assets the way serve wires them in workerd's wrangler.rs, loads aadhar-counter beside the site, and can add a seeder Worker on its own socket that shares the site's D1. The seeder exists only in this config, so the site Worker gains no write route. With no bundle handed to it, the boot runs wrangler's dry run first, which restages .build/public the way the harness's build did. Both checks now run under bun.

routes:check's second boot moves onto the same config and runs all 421 rows instead of the 2 gaps. That's the guard on the copied wiring: every CI run compares it against serve itself, and it passes 421 of 421. VERIFY_ONLY loses its one caller and goes.

I passed on seeding D1 by writing SQLite files under --data-dir, since that layout is workerd's to change; the seeder goes through workerd's own D1 Worker.

On one tree, both boots read the same: act:check operated 488 controls on 73 pages with 0 failures and all 10 plants caught on each, and browser:check read 76 pages at desktop with 0 failures and every control caught on each. On workerd it also passed at phone in Chrome and WebKit. The 5 controls that go through these checks are all caught, including gotcha 125's guestbook plant, which only fires if the seed lands.

Limits: the copied wiring comes from workerd source (v1.20261202.1, and 2026-11-27, which agree) while the pin is 1.20261129.1, so a workerd bump can break it; routes:check will say so on that PR. Workflows and cron triggers are left out of the config because no page or route reads them. Only ran on macOS arm64, and one act:check run at load 108 read one control at 304 ms over its 300 ms limit (it passed on the rerun).

Measurements

routes:check: serve 421 rows with 2 known gaps; the whole-site boot 421 of 421
workerd serve vs the oracle: 421 rows, 2 known gap(s), 0 new failure(s), 0 stale gap(s); the whole site with its owning Workers: 421 of 421 rows pass.
act:check, Miniflare vs workerd, same tree: 488 controls, 0 failures each
== bun tools/check-interactions.ts          (workerd)
act:check: 488 control(s) operated on 73 pages at 390px, 0 failure(s), 0 stale exception(s); all ten planted controls were caught.
real 219.18
== node tools/check-interactions.ts at origin/main   (Miniflare)
act:check: 488 control(s) operated on 73 pages at 390px, 0 failure(s), 0 stale exception(s); all ten planted controls were caught.
real 205.11
browser:check: 76 pages, 0 failures at desktop on both boots; phone Chrome and WebKit on workerd
Miniflare, desktop: browser:check: 76 pages at desktop in Chrome against the local build, 0 failure(s), 0 stale budget(s); every planted control was caught.
workerd, desktop:   browser:check: 76 pages at desktop in Chrome against the local build, 0 failure(s), 0 stale budget(s); every planted control was caught.
workerd, phone:     browser:check: 76 pages at phone in Chrome against the local build, 0 failure(s), 0 stale budget(s); every planted control was caught.
workerd, WebKit:    browser:check: 76 pages at phone in WebKit against the local build, 0 failure(s), 0 stale budget(s); every planted control was caught. NOT READ in WebKit: shift, csp.
bun run controls: 5/5 caught
CAUGHT        guestbook-entry-text-unwrapped (51.3s): FAIL  scroll /guestbook  320px: main#main.content is 1522px in a 288px box: b text +213px, div.tg text +18px, blockquote.w2 text +1259px
CAUGHT        origin-trial-stamped-on-the-wrong-type (25.0s): /garage/horizon   <- origin-trial is missing a token from ORIGIN_TRIALS
CAUGHT        workerd-serve-gap-undeclared (32.5s): NEW    /coffee/pick   <- fails under workerd serve
CAUGHT        workerd-serve-cross-script-unbound (38.8s): FAIL   /coffee/pick   <- fails on the whole-site boot
CAUGHT        served-shell-unminified (25.0s): /nav-tips.js   <- size 11405B > 9076B, 0.8 of src/client/nav-tips.ts
controls: 5/5 caught across 2 checks in 124.8s (clones, 4 at a time); gotchas covered: 125
check:fast: lint, format, typecheck clean; 2,062 tests pass

…unter beside the site

workerd serve refuses a Durable Object binding with script_name
(cloudflare/workerd#9023), so /coffee/slots.html and /coffee/pick were gaps
the arm only proved fail. A capnp config can bind a class across Workers in
one process (serviceName), so the arm now boots one: the site bundle with its
vars, KV and Cache API wired as serve wires them, plus aadhar-counter bundled
from counter/wrangler.jsonc, and reruns the gap rows there with VERIFY_ONLY.
Each must pass, so a gap can no longer hide a real failure. Both pass on
0d22871; the new control drops the binding and the arm fails both rows.
routes:check booted the Worker through wrangler's createTestHarness
(Miniflare) on node, and since #2042 a bare `workerd serve` run of the same
oracle sat beside it in validate. Both route steps were green on all 8 CI runs
that had both, and the 2 rows serve cannot boot alone (/coffee/slots.html,
/coffee/pick) pass on the cross-Worker capnp rerun from the commit before.
So routes:check is now that workerd arm, under bun, and validate runs it once.

routes:check:remote stays on Miniflare, the only thing with a proxy to
production bindings, and canary-wrangler.ts still boots the candidate's own
harness through check-routes-harness.ts. The 4 controls that ran routes:check
now run perf-budget first, whose dry run rebuilds .build/public, and all 4
are caught.
… no Miniflare

Both booted wrangler's createTestHarness with the site and aadhar-counter,
which held them on node (gotcha 38). serve cannot carry them: COUNTER binds a
class in aadhar-counter, and browser:check seeds Serendipity's D1 through the
harness's getEnv(). So tools/lib/workerd-boot.ts boots the whole site as one
capnp config (siteCapnp, which replaces the 2-row crossScriptCapnp): KV, R2,
D1, rate limits, the Cache API and assets wired as serve wires them, the owning
Worker beside the site, and a seeder Worker on its own socket that shares the
site's D1 and that only this config has. With no bundle it runs wrangler's dry
run first, which restages .build/public the way the harness's build did.

routes:check's second boot moves onto it and runs all rows, not the 2 gaps:
421 of 421 pass, so CI checks the copied wiring on every run, against the
serve run beside it. VERIFY_ONLY loses its one caller and goes.

Same tree, both boots: act:check operated 488 controls on 73 pages with 0
failures and all 10 plants caught on each. browser:check read 76 pages at
desktop with 0 failures and every control caught on each, and on workerd also
at phone in Chrome and WebKit. Both run under bun; Playwright launched Chrome
with CDP and WebKit under bun. 5 controls through these checks are caught,
including gotcha 125's guestbook plant, which needs the seed to land.
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Wire-size diff vs merge base

24341e0bd0a9b4370c71053fa27091c664300fb6 → 71d931f4e49837fb38a81a87cc29d911a36d1f28

Brotli q11, the quality the edge serves. Every number here is deterministic:
an unchanged file produces no row. Advisory — this check fails on nothing.

Client assets

No change. 42 files, 203.00 KiB Brotli total.

Pages

No change. 74 files, 902.00 KiB Brotli total.

Worker bundle

No change. 318.71 KiB gzip.

Dictionary transport

Family dictionary acquisition: no change, 16.24 KiB q11.

pd/: no change. 889 deltas, 990.84 KiB total.

Head tags vs merge base

No change. 74 documents, every title, description, canonical, robots, og:*, twitter:*, alternate, JSON-LD type and oracle status identical.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

First paint, layout shift and first byte vs merge base

No page serves a different document, so no changed page was read.
0 page(s) serve a different document.

Pages that serve the same document

3 sampled page(s) with identical bytes on both sides read flat, alone and pooled.

page FCP base FCP HEAD change CLS base CLS HEAD change TTFB base TTFB HEAD change
/garage/dictionary 256 ms 268 ms +8 ms 0.000 0.000 +0.000 10 ms 14 ms +1 ms
/restore 292 ms 296 ms +4 ms 0.000 0.000 +0.000 13 ms 13 ms +1 ms
/lwe/pcrypto 340 ms 344 ms -16 ms 0.000 0.000 +0.000 13 ms 14 ms -1 ms
all 3, pooled 288 ms 288 ms +8 ms 0.000 0.000 +0.000 13 ms 14 ms +1 ms
How a change is called moved, and the controls (232 s)

Each change is the median of HEAD minus base over the 9 pairs. It is moved when a sign test puts the split under p 0.05 and the median is at least 16 ms of FCP, 0.005 of CLS or 5 ms of TTFB (tools/lib/paint-diff.ts). TTFB is how long the Worker takes to send a document's headers, timed from Node before each load, since Chrome's emulated latency hides anything under it. Advisory: nothing here fails the PR.

The same-document pages are a slice of the unchanged ones, turned by the HEAD commit so each push reads different ones. Identical bytes make them a placebo: a move there is the runner or the serving path, never the document.

Controls on /__paint-control, HEAD against itself. A planted control must move its own metric; only the unplanted one judges both:

  • nothing planted: FCP -8 ms, CLS +0.000, TTFB +5 ms
  • every stylesheet held 150 ms: FCP +140 ms (moved), CLS +0.000, TTFB -1 ms
  • a 300px block pushed in above the content and each document held 60 ms: FCP +4 ms, CLS +0.026 (moved), TTFB +57 ms (moved)

#2059 moved every inline control into tools/lib/controls/<id>.ts. This
branch's 5 control edits move with them: origin-trial-stamped-on-the-wrong-type
and served-shell-unminified run perf-budget first, workerd-serve-gap-undeclared
calls routes:check, guestbook-entry-text-unwrapped runs check-browser.ts under
bun, and workerd-serve-cross-script-unbound becomes its own file planting the
missing COUNTER binding in siteCapnp. All 5 are caught after the merge.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
aadhar-sh 692f658 Commit Preview URL

Branch Preview URL
Dec 04 2026, 10:07 PM

This branch has not been deployed

No deployments
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.

1 participant