🔬 Spike: bundle workerd into the compiled XMD host (#347) - #348
Closed
taras wants to merge 2 commits into
Closed
Conversation
spikes/347-workerd is a self-contained proof: deno compile embeds a pinned, digest-verified workerd plus a Worker with one Durable Object; the compiled host materializes them into a version-addressed cache, supervises workerd with readiness over --control-fd, and proves DO SQLite and Cloudflare Computer Workspace state survive full restarts, with state-dir and identity isolation, worker-shell and worker-javascript backend execution, and the teardown contracts (clean stop kills the child; SIGKILL orphans it). Excluded from the workspace so every verification gate keeps its scope; findings in evidence/EVIDENCE.md.
#347) All three Computer execution backends now have evidence-backed results: the Cloudflare Container backend works under standalone workerd via containerEngine localDocker, with the Dockerfile, workerd config, and Worker wiring that ran committed under evidence/container/. Requires a Docker daemon, so it stays out of the default test suite.
This was referenced Aug 6, 2026
PR #348: 🔬 Spike: bundle workerd into the compiled XMD host (#347)20 files, +2079 / -2 Scope🔴 PR has 2081 lines changed. Split into focused PRs. 🟡 2081 lines changed. PRs under 400 receive more thorough review. 🟡 PR mixes config and source changes. Structural🟡 7 console statements. Slop✅ Slop indicators look low. Static Analysis✅ Oxlint found no issues. CorrectnessNo extraneous code patterns detected. |
This was referenced Aug 6, 2026
Owner
Author
|
We're not doing this anymore. |
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.
Why
#347 asks for evidence: can Executable.md ship one compiled executable that carries a Cloudflare Worker and a platform
workerd, launch that Worker locally, and keep a Durable Object Workspace across restarts? #346 needs that evidence to select, reject, or limit the bundled-local-host topology. This PR commits the reproducible spike and its findings.What changes
Before: the repository had no Cloudflare artifacts and no answer to whether the bundled-local-host topology is feasible.
After:
deno task spike:347fetches a digest-pinnedworkerd, builds a 191 MB proof executable that embeds workerd + a Worker with one Durable Object + capnp configs, and runs a 7-scenario suite proving packaging, supervision, persistence, isolation, the@cloudflare/computerfilesystem Workspace, and two of three execution backends under standalone workerd. Findings are written up inspikes/347-workerd/evidence/EVIDENCE.md.How it works
Every
proof doinvocation is a complete start/op/stop cycle, so consecutive invocations prove restart persistence by construction.Key findings (full detail in EVIDENCE.md)
localDiskDO storage (the same mechanism miniflare uses) — but the schema marks it experimental, subject to backwards-incompatible change.nodejs_compat,@platformatic/vfsas only loaded peer). Its SQLite schema refuses downgrades → exact pin mandatory.workerLoaderbinding, aWorkspaceServiceProxyre-export (ctx.exports loopback), andwaitUntilwiring. Container backend also works through workerd'slocalDockerengine (Docker daemon required): computerd workload + egress-proxy sidecar created by workerd itself, bidirectional/workspacesync, and a fresh container restored from DO SQLite after restart — the exact Dockerfile/config/wiring that ran are committed underevidence/container/; workerd leaks its containers on SIGTERM (recorded).@effectionx/processdaemon teardown alone never terminated the child on natural exit under Deno — the host registers an explicit child SIGTERMensurefirst.What must stay true
spikesis in the rootdeno.jsonexclude, the spike pins its owndeno.lock, and no root dependency changed. Verified by running lint/check/test/check:jsr at root.fetchtask, never inbuild.packages/*file changed.How to verify it
deno task spike:347from the repo root (macOS arm64 or any pinned platform; first run downloads ~32 MB from npm).counter survives full restarts…proves DO SQLite persistence + state-dir/identity isolation; fails iflocalDiskor identity derivation regresses.workspace filesystem frontier…proves the Computer Workspace frontier (incl. create/delete/create) across restarts; fails if the vfs schema or storage wiring breaks.worker-shell and worker-javascript backends…fails if the loader/proxy/waitUntil wiring regresses.evidence/container/holds the artifacts; reproducing needs Docker running,docker pull cloudflare/proxy-everything:main, anddocker build -t probe-computerd.clean stop…/SIGKILL…assert the teardown contract both ways with child-pid liveness probes.Scope
Included
spikes/347-workerd/(self-contained project), root task aliases,.gitignoreentry forvendor/.Intentionally unchanged
<Workspace>API, no provider, no topology selection — Define the local Workspace host topology #346 records the decision from this evidence; Implement retained Workflow Workspace restoration #218 moves only after that.manifest.ts) but not wired intorelease.yml.New dependencies
deno.json+ lock, invisible to the workspace):@cloudflare/computer@0.1.1,@platformatic/vfs@0.4.0,esbuild@0.28.1, plus the already-pinned effection stack. Theworkerdbinary is fetched, digest-verified, and gitignored — not an npm dependency, deliberately (cross-compiledeps:targetfragility, see EVIDENCE §1).Risks and limitations
worker/worker.mjsuses async/await — the Workers platform contract mandates it; host and tests are Effection generators.localDiskpersistence format and Computer 0.1.1 are both explicitly unstable; every version is pinned and digest-checked, and upgrade behavior is documented in EVIDENCE §3-4.deno task spike:347(not in CI) — it downloads a binary and needs ~200 MB scratch, which CI jobs shouldn't pay per-push during a spike.