🔬 Spike: host Cloudflare DOFS directly in Deno with SQLite (#349) - #350
Merged
Conversation
spikes/349-dofs hosts Cloudflare's unmodified DOFS filesystem layer in the Deno process: a ~100-line file-backed DurableObjectStorageLike over node:sqlite drives Database → initializeSchema → WorkspaceFilesystem, and the compiled proof passes a restart-persistence suite (frontier incl. create/delete/create, rename, symlinks, db-path isolation, loud newer-schema refusal, WAL checkpoint on close). The reuse boundary is settled by independent evidence: the published package cannot be imported or tree-shaken into the DOFS layer, so packages/dofs is vendored at v0.1.1/63d3636 with MIT notice and provenance, and the 3-line upstream export change that would replace vendoring is drafted in the probe ledger.
Vendors upstream's shim.ts byte-identical (subset package with provenance and a type-only stub for its one internal import), ports the vfs wiring with an explicit MemoryProvider-fallback guard, and compiles proof-shim: a subprocess executed with the upstream cd-prefix technique reads an API-written file through the mount and its writes land in SQLite; an emptied mount directory rematerializes from the persisted frontier. Probe ledger with latency medians, demonstrated limitations, and the darwin-arm64/macFUSE record lands in evidence/probes/slice6-shim.md.
Real FUSE works over the file-backed DOFS stack but not in-process under Deno today: the addon loads, and fuse.mount() aborts in Deno's uv polyfill (minimal repro committed); the identical stack mounts under a Node sidecar in ~120ms sharing the WAL database with a Deno writer. The durability matrix pins the commit boundary to observed release — fsync is a no-op and close() alone races an async RELEASE — and the forbidden cwd-inside-mount spawn deadlock plus its fusermount recovery are captured. COMPARISON.md sets both topologies side by side and recommends limit for #346: Deno-local DOFS for the filesystem-only Workspace, bundled workerd for Computer execution backends, subprocess access explicitly limited meanwhile.
This was referenced Aug 6, 2026
PR #350: 🔬 Spike: host Cloudflare DOFS directly in Deno with SQLite (#349)136 files, +18703 / -2 Scope🔴 PR has 18705 lines changed. Split into focused PRs. 🟡 18705 lines changed. PRs under 400 receive more thorough review. 🟡 136 files changed. Are all changes related? 🟡 PR mixes config and source changes. 🟡 New abstraction files: spikes/349-dofs/vendor/dofs/src/provider.ts. Verify 3+ consumers. Structural🟡 12 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
This was referenced Aug 7, 2026
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
#349 asks for the alternative evidence path to #347/PR #348: can Executable.md host a persistent SQLite Workspace directly in Deno by reusing Cloudflare Computer's DOFS filesystem, expose it to native subprocesses without workerd, and how does that compare? #346 needs both evidence sets to decide the local Workspace topology.
What changes
Before: only the bundled-workerd topology had evidence.
After:
deno task spike:349builds and tests a Deno-local DOFS spike — Cloudflare's unmodifiedDatabase/initializeSchema/WorkspaceFilesystemover a ~100-line file-backednode:sqliteadapter, a compiled 110 MB proof, a vendored+tested userspace-shim bridge for native subprocesses, and probe-backed verdicts for real FUSE, packaging, durability, and all four reuse boundaries.evidence/COMPARISON.mdsets #349 against #347 on the issue's ten axes and recommends limit for #346.How it works
Key findings (full detail in evidence/EVIDENCE.md)
node:sqlitesatisfies DOFS's storage contract with zero schema changes; frontier (incl. create→delete→create, rename, symlinks) survives restarts; newer-schema databases are refused loudly; WAL checkpoints to a single file on close. 110 MB artifact, 0.08 s full op cycle vs Spike: bundle workerd into the compiled XMD host #347's 191 MB / 0.27 s.fuse.mount()aborts in Deno's uv polyfill (minimal upstream-ready repro committed). Durability boundary pinned by experiment: commit happens at observed RELEASE only;fsyncis a no-op andclose()races an async release. The cwd-inside-mount spawn deadlock (unrecoverable by SIGKILL) is captured with its recovery runbook.deno compilecan carry and load the addon (142 MB). Platform matrix tested, not inferred: linux-x64 via sidecar; darwin-arm64 dead end at this pin; Windows unsupported.What must stay true
spikesis root-excluded, the spike owns its deps (nodeModulesDir: "manual", npmfile:deps, committedpackage-lock.json), no root dependency changed. Verified by running all four at root.vendor/*/PROVENANCE.mdlists every manifest edit;src/files are byte-identical, shim sha1-recorded).How to verify it
deno task spike:349from the repo root (needsnpm install --install-linksin the spike dir once; README documents it).evidence/fuse-linux/(container recipe + minimal repro) — not wired into the test suite because they need Docker +/dev/fuse.Scope
Included
spikes/349-dofs/(self-contained), root task aliases +spikesexclude,.gitignoreentry.Intentionally unchanged
<Workspace>API, no provider, no topology selection (Define the local Workspace host topology #346 decides); no upstream filing yet (the Deno uv repro and the dofs export diff are drafted in evidence for follow-up).deno.jsonexclude/task edits overlap textually with PR 🔬 Spike: bundle workerd into the compiled XMD host (#347) #348; whichever merges second rebases trivially.New dependencies
@cloudflare/dofs(source, pinned) and@xmd-spike/computerd-shim(shim subset) asfile:deps;@platformatic/vfs@0.4.0; the effection stack at root-matching pins. Nothing enters the workspace graph.Risks and limitations
.js/.d.tspairing gap forfile:packages is bridged with a typed facade (host/types/) that mirrors the consumed surface; drift is possible and documented in-file.