Repository navigation
ci(test): the Worker's wasm32 unit tests and a new workers job (Test phase, stage 8, G-6) - #345
Merged
Merged
Conversation
…ge 8, G-6) The Worker's configuration reading, composition root, queue consumer and fetch entry point exist only on wasm32, so nothing native reached them: only the worker-memory and worker-cf cells did, over HTTP. crates/worker/src/wasm_tests.rs holds 14 #[wasm_bindgen_test] functions, run by wasm-bindgen-test-runner on Node through nextest's new `workers` profile (scripts/wasm-tests.sh: one runner process per test, and a count guard that every declared test ran). cargo-mutants on crates/worker/src/lib.rs through the same runner, by hand (.cargo/mutants-wasm.toml): 52 mutants, 43 caught, 8 unviable, 1 missed (`scheduled`, whose only effect is a log line; the contract suite's cron pass covers it). Before the fetch and queue tests it was 33 caught and 11 missed. scripts/wasm-test-runner.sh is cargo's runner for wasm32: it refuses a runner that is not the lock's wasm-bindgen exactly (asked of `cargo pkgid --locked`) and loads scripts/lib/workerd-stubs.cjs, which stands in for the workerd-only modules, and the FixedLengthStream global, that the Worker's wasm imports. [profile.wasm-test] drops debug info: 20 s a test with it, 1.85 s without. The host is Node, not workerd as ADR-0123 names: no public runner hosts Rust unit tests inside workerd. Cargo.lock gains 10 packages, all from wasm-bindgen-test, a wasm32-only dev-dependency of thrust-worker. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… and the gate (Test phase, stage 8) A job in test.yml that runs scripts/wasm-tests.sh: Node from web/.node-version, the wasm32 target, and wasm-bindgen-test-runner installed at the version `cargo pkgid --locked wasm-bindgen` reads from Cargo.lock (taiki-e/install-action, checksummed). Cache key wasm-workers, saved on main only. ADR-0102 allows no advisory job in a called workflow, so it is in the planner from the start (JOBS, WORKFLOWS, planned when thrust-worker is affected, and a rule for its scripts), in the verdict's needs and jobs, and in the dispatch default plan. Tests, each with controls: test-wasm-tests.sh (46 checks, in the ci-scripts list; sh and dash), test_plan_ci.py, test_workflow_wiring.py, test-ci-scripts.sh (workers among test.yml's jobs: 209 cases) and mutate_gate.py (270 of 270 mutants killed, none survived). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
running.md (the workers profile, the script, the job and a runbook for a red one), cicd.md (the job, how it is planned, and the examples table run again through the planner, which showed two rows already out of date), status.md G-6 (what is built, the cargo-mutants result with its one survivor, what is still open, and the departure from ADR-0123), the defect matrix X8, real-backends.md, AGENTS.md's Commands table and the workflows README. The phase document gets its stage 8 section: the survey, the custom code with its probes, the measurements and the pass log. The plan's status lines said no stage of the phase had started; they now say where it stands. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Two things came with it: - docs/src/architecture/cicd.md: both sides edited the test.yml row (mine: the workers job and 47 commands; main's: 65 mutant rows). Kept mine, with 65. - crates/worker/src/wasm_tests.rs: #340 made `core_config` return a Result (a retention window that is not a number of days stops the Worker from building its app), so the configuration test now reads through `configured`, and a new test covers the two windows: each into its own field, every word over an alphabet and the u32 boundaries against the test's own decimal reference, a bad window named and the good one beside it not, and the composition root refusing one. 15 tests now. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ion windows) 15 tests and not 14: the new one covers the two retention windows #340 added to the Worker's configuration. Run again on the merged tree: 15 of 15 pass, and cargo-mutants on crates/worker/src/lib.rs has the same result (52 mutants, 43 caught, 8 unviable, 1 missed, `scheduled`, now at line 428). The times are recorded as measured, both runs: the same script took 4.5 s on 14 tests and 7.6 s on 15, and the same 52 mutants 6 m 25 s and 11 m 32 s, and the phase document says that it is not known whether that is load or the merged code. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aRustyDev
temporarily deployed
to
preview-control-plane
November 20, 2026 21:42 — with
GitHub Actions
Inactive
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
… cloudflare: imports
The first CI run of the job failed all 15 tests on Node 22.22.0, the web jobs' pin (web/.node-version), with ERR_INTERNAL_ASSERTION ("a bug in Node.js") at ModuleLoader.getModuleJobForRequire. Everything had passed locally, on Node 26.9.0.
The runner's glue is CommonJS and require()s the Worker's inline JavaScript snippets, which are ES modules that import `cloudflare:workers` and its like. Node's require(esm) path asserts that an import specifier's protocol is file:, node: or data:, before any resolve hook is asked, so scripts/lib/workerd-stubs.cjs cannot help. Reading lib/internal/modules/esm/loader.js of every release from 22.15 to 25.9: every 22 and 23 asserts (22.23.5 is the last 22), 24 asserts before 24.12.0, 25 before 25.2.0, and 26 has no such code.
The job pins Node 26.13.1. scripts/wasm-test-runner.sh refuses an older Node in words, so that nobody reads "a bug in Node.js"; test-wasm-tests.sh holds each boundary with stand-in nodes and a broken copy of the wrapper for each (66 checks), test_workflow_wiring.py holds the pin to 26 or later, and mutate_gate.py changes it three ways (272 of 272 mutants killed). The runbook, the status row and the phase document say what happened.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aRustyDev
temporarily deployed
to
preview-control-plane
November 20, 2026 22:01 — with
GitHub Actions
Inactive
Run 44825424412, green in every job, gate included: the workers job took 92 s with a cold cache (the cache is saved on main only), 35 s of it the wasm build and 19 s the 15 tests on the runner's 4 cores; it is on no critical path (the run took 8 m 41 s, set by the cells). The first run, 44822700250, failed workers alone on Node 22.22.0; that is in the phase document already. Passes 2 and 5 of the stage are updated: 2 holds, 5 has its cold number and waits for a run on main for the warm one. The helper counts are the ones after the Node guard (66 checks, 168 wiring checks, 272 mutants). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aRustyDev
temporarily deployed
to
preview-control-plane
November 20, 2026 22:12 — with
GitHub Actions
Inactive
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… stage 8) #343 made the Worker's cron handler hand the trigger's own cron string to thrust_core::run_cron, so the sentence that said its only effect is a log line over the sweeper was no longer exactly right. What a trigger runs is tested natively (crates/core/usecases/tests/schedules.rs and outbox.rs) and by the contract suite's cron pass on the Worker, which now also has worker_cron_scheduled_handler_runs_the_hard_delete. `cargo mutants --list` on the merged tree gives the same 52 mutants as before, with only scheduled's line moved (428 to 432); they were not run again, and the documents say so. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aRustyDev
temporarily deployed
to
preview-control-plane
November 22, 2026 23:06 — with
GitHub Actions
Inactive
url 2.5.8 and earlier overflow the stack in `Url::origin()` on a nested `blob:` URL, which aborts the process and which catch_unwind does not catch. The advisory appeared after the last green run, so `cargo deny` fails on main's own Cargo.lock too: security / deny, and so gate, is red for any change that touches Cargo.lock or a manifest. `cargo update -p url --precise 2.5.9`: a plain `cargo update -p url` locks nothing, and the precise form moves url and its one dependency form_urlencoded (1.2.2 to 1.2.3), four lines each way in the lock and no other package. url is reached through ammonia, bollard, lettre and oauth2. It is unrelated to the stage-8 work of this pull request and was folded in at the owner's word, as its own commit. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nged no package (stage 8) The phase document's Cargo.lock row said no existing package changed. The stage still changed none; the url and form_urlencoded bump for RUSTSEC-2026-0592 is in the same pull request, as its own commit, and the row says so and says why. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aRustyDev
temporarily deployed
to
preview-control-plane
November 22, 2026 23:18 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 8 of the Test phase (
.agents/plans/ci-workflows/phases/0003-test.md, "Stage 8 in detail"): G-6, the Worker's wasm32 unit tests, and a newworkersjob intest.ymlthat runs them.What it adds
#[wasm_bindgen_test]tests incrates/worker/src/wasm_tests.rs, for the Worker's own glue that only a wasm32 build has: readingEnv(the retention windows of feat(retention): run_retention, its windows and its admin routes #340 included), the composition root, the queue consumer, and thefetchentry point with its 8 MiB body ceiling. Inputs are generated where a domain can be (words over an alphabet for the six spellings of a flag and for the retention windows, decimal digits and bit boundaries for the number reader, every sign-in rate window to 200 s, every subset of the OIDC settings, bodies at the ceiling); the exceptions are named in the test and in status G-6.workersjob (test.yml): nextest's newworkersprofile, one wasm-bindgen runner process per test, on Node. It is in the plan, theverdictand the gate from this PR on (ADR-0102 allows no advisory job intest.yml), and runs whenthrust-workeris affected.scripts/wasm-tests.sh(nextest and a count guard: every declared test must have run),scripts/wasm-test-runner.sh(cargo's runner for wasm32; refuses awasm-bindgen-test-runnerthat is not the lock'swasm-bindgenexactly),scripts/lib/workerd-stubs.cjs(see below),[profile.wasm-test](no debug info),.cargo/mutants-wasm.toml(cargo-mutants through the same runner, by hand).Cargo.lock: +10 packages (all fromwasm-bindgen-test, a wasm32-only dev-dependency ofthrust-worker); the stage changes no existing package.url2.5.8 → 2.5.9 andform_urlencoded1.2.2 → 1.2.3. A new advisory, RUSTSEC-2026-0592 (a stack overflow inUrl::origin()on nestedblob:URLs), turnedcargo denyred onmain's own lock, sosecurity / denyandgatewent red for any PR that touchesCargo.lock.cargo update -p url --precise 2.5.9(a plaincargo update -p urllocks nothing); four lines each way in the lock. It is its own commit, so it can be lifted out.Evidence
main(7.6 s wall, 6.6 s in nextest; 14 of 14 took 4.5 s before the merge: one process per test, all started at once, so the load of the machine moves it).crates/worker/src/lib.rsthrough the same runner, on the merged tree: 52 mutants, 43 caught, 8 unviable, 1 missed, 0 timeouts. Before thefetchandqueuetests: 33 caught, 11 missed. The one missed isscheduled → (): it hands the trigger's cron string tothrust_core::run_cronand logs the report, so over an empty memory store its only visible effect is a log line. What a trigger runs is tested natively (schedules.rs,outbox.rs) and by the contract suite'scronpass on the Worker, which since feat(jobs): schedule the daily hard delete on the Worker and the server #343 also covers the hard delete. feat(jobs): schedule the daily hard delete on the Worker and the server #343 changed that one function;cargo mutants --liston the merged tree gives the same 52, with only its line moved, and I did not run them again.test-wasm-tests.sh(66 checks,shanddash),test_plan_ci.py(7,038),test_workflow_wiring.py(168),test-ci-scripts.sh(209 cases),mutate_gate.py(272 of 272 killed, none survived, on the merged tree).depsguard but one,cargo deny(the ten new packages included),cargo fmt, the lint job's clippy runs, and the book build pass.check-openapi.shwas not run: Docker is not running on my machine, so itsoasdiffstep cannot start. This PR does not touchthrust-api-v1, where that document comes from, and CI'sdepsjob runs it.mainmoved while this was open (feat(retention): run_retention, its windows and its admin routes #340, retention): merged in, and the one source conflict handled:core_confignow returns aResult, so the configuration test reads through a helper and a new test covers the two retention windows. feat(jobs): schedule the daily hard delete on the Worker and the server #343 touchestest.yml,crates/worker/src/lib.rs,cicd.mdandstatus.mdtoo; whichever of us merges second mergesmain.Things you should look at
vitest-pool-workersand Miniflare would only repeat the HTTP cells). What a test sees ofRequest,Responseand streams is Node's. Recorded in status G-6, the defect matrix (X8) andreal-backends.md.scripts/lib/workerd-stubs.cjsis hand-written custom code. The Worker's wasm imports four modules that exist only in workerd (cloudflare:workers|sockets|node|email), so plain Node fails to load it. The file answers them with Node'smodule.registerHooks(Node 22.15 or later; CI pins 22.22.0), and defines the one workerd global the entry points use (FixedLengthStream).tracinganswers as workerd does outside an invocation. Each entry has a check and a control intest-wasm-tests.sh; the first run of the entry-point tests found two of them.Cargo.lockfor the runner's version, without checking for one.cargo pkgid --locked wasm-bindgendoes it (same answer, fails on none and on two versions), so the script is gone.wasm_tests.rs.lint.yml's Worker clippy step has no--all-targets. I ran it by hand, found onetype_complexityerror and fixed it. A step inlint.ymlwould keep it clean, but that is the Lint phase's file, so I left it for you to decide (recommended for Phase 5).ERR_INTERNAL_ASSERTION("a bug in Node.js"), though everything had passed locally on 26.9.0. Node'srequire(esm)path asserts that an import specifier's protocol isfile:,node:ordata:before any hook is asked, and the runner's CommonJS gluerequire()s the Worker's inline snippets, which importcloudflare:workers. I readlib/internal/modules/esm/loader.jsof every release from 22.15 to 25.9: every 22 and 23 asserts, 24 before 24.12, 25 before 25.2; 26 has no such code.scripts/wasm-test-runner.shnow refuses an older Node in words, with a control for each boundary. 24.12 and later were read in source, not run.THRUST_V1_RATE_LIMITspellings (Rule 9 (b)) and the queue consumer's few fixed batches are not generated; the second is a recorded Rule 9 gap.Not covered
The edge Worker's
runtime.rs(G-41) and the two preview Workers (your decision:thrust-workeronly); a binding that is JavaScriptnull; a--no-default-featuresrun (the tests need thememoryfeature, and the count guard says so).CI evidence
44822700250(first):workersalone failed, all 15 tests, on Node 22.22.0 (above). Every other job was green andgatewas red, as designed.44825424412(on Node 26.13.1): green in every job,gateincluded.wasm32 tests: 15 of 15 declared, all passed. Theworkersjob took 92 s, cold (No cache found: the cache is saved onmainonly):setup-rust16 s, the runner install 2 s, thewasm-testbuild 35 s, nextest 19 s on 4 cores. It is on no critical path: the run took 8 m 41 s, set by the cells.ci-scriptsrantest-wasm-tests.shthere too (66 of 66, none skipped), anddepsrancheck-openapiwith Docker, which I could not run locally.main; it goes in the record of this stage after the merge.🤖 Generated with Claude Code