Skip to content

docs: runtime migration plans (move quarto-cli off Deno) - #15133

Merged
cderv merged 86 commits into
mainfrom
runtime-migration-plans
Oct 20, 2026
Merged

cderv merged 86 commits into
mainfrom
runtime-migration-plans

Conversation

@cderv

@cderv cderv commented Oct 20, 2026

Copy link
Copy Markdown
Member

Description

Planning record for moving quarto-cli off Deno onto Node, as documentation only. No application code, no build change. It adds dev-docs/runtime-migration/: the decision record, the validating spike, two reviews with their triage, and one self-contained implementation plan per PR across four phases.

The work is organized as 45 PRs plus two time-boxed spikes and one upstream milestone (the Julia engine, ported by PumasAI), executed one at a time against main:

  • Phase 0, de-risk dependencies: a CI ratchet counting Deno.* call sites and direct std imports (PR 02), the Deno 2.9 bump and a committed --frozen lockfile, and swapping deno.land/x/skypack/cliffy/deno_dom dependencies for npm/jsr equivalents.
  • Phase 1, close the runtime boundary: route every Deno.* and std import through a new src/deno_ral/ layer, via mechanical codemods, while still shipping on Deno.
  • Phase 2, Node implementations, still on Deno: build the Node versions of the layer's modules behind a real-Node CI job with a shrink-only known-failures list. Two spikes settle Deno/Node compatibility and the test runner.
  • Phase 3, flip then remove Deno: switch the CLI launchers to Node (with a one-cycle dual-runtime window if the spike passes), move user scripts and build-ts-extension, then stop downloading Deno.

README.md is the execution index (the ordered PR table, dependency graph, ground rules, roles, release calendar). HANDOFF.md is the start-here for a fresh session. Every plan carries its own spec, files, checkbox tasks, verification commands, risks, and a suggested executor.

Merging this first puts the plans on main so each implementation PR can branch from main and reference them. The first plan to execute is PR 02 (the runtime-boundary ratchet). Its baseline numbers are re-measured against the merge-base at execution time, since main has moved since the plans were written.

No user-facing change, so no changelog line and no website PR.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude (planning sessions), recorded in REVIEW-*.md and TRIAGE-*.md
  • Codebase grounding: local clone. Plans measured against main at b86f98d
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

cderv and others added 30 commits October 20, 2026 15:23
Decision record for moving quarto-cli off Deno after Cloudflare's
acquisition, the Node 22 spike that validated the render path, a plan
template with the shared deno_ral vocabulary, and the ordered index of
the per-PR plans (01-39).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
net, http, watch, kv, platform/main, deno_dom FFI removal, type sweep,
std import seams, tests and package/src codemods, boundary-zero.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Align the ratchet exclusion list (PR 02/25), extend the shared vocabulary
with the names later plans rely on, make isMainModule runtime-neutral in
PR 19, align the test harness call shape (PR 23/31), correct the enum and
parameter-property counts, and record the conventions the plans decided.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Consolidates six independent reviews of plans 01-39 against the code:
structural findings that change the plan's shape (hidden Deno uses in
bundled JS, type-only imports under Node strip-types, unported layer
modules, ordering defects at the flip, env and proxy contract, shared
cache files, codemod mechanics, backports), per-plan defects with
severity, the recommended landing strategy, the rework list and the
decisions the team needs to make before execution.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…e rework

Consistency pass across all plans: run-tests.sh is given files, never
directories; vocabulary additions in the template; assessment KV
signature; PR 02 allow-list wording. README carries the new sequence
(46 PRs, two spikes, milestone J), dependency graph, decisions and the
measured ratchet baseline.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Verify findings R01-R21 against the plan text and split the follow-up into
maintainer decisions, a cross-plan reconciliation pass and per-plan local
corrections. Link the triage from the handoff and the README.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
PR 02 owns the rule: direct std imports of the import-map seams PR 22's
inventory marks "import map" (async, crypto, datetime, streams, io/*,
log minus log/file-handler, fmt/printf, dotenv/stringify) are allow-listed
by the scanner (kStdAllowListed, kStdCountedExceptions); every other std
import, URL or jsr specifier counts. The baseline numbers are re-measured
under the rule with a port of the scanner (src 49, package/src 3; the
unfiltered run reproduces the earlier 62 and 4), the fixture gains a
permitted-only file and the log/file-handler exception, and PR 22, PR 25,
the README ground rule, the progress metric and the template say the same
thing by reference. PR 25's zero is now zero counted std imports and its
inventory grep no longer rejects plain `log` importers.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…arrowed

PR 25 now owns one runtime residue table (item, runtime it runs on, owner
task, removal PR, gate) covering the resource scripts, ast-diagram, the
engine create template, the tinitex deno-compile files, the Deno CLI dev
utilities, deno fmt/check in src, the quarto run and build-ts-extension
paths, the built editor artifacts, the test fixtures, tools/*.ts and the
Julia subtree. PR 39 becomes a Phase 1 prerequisite of PR 25 and the
conditional quarto-latexmk allow-list entry is gone. PR 33's shim-removal
gate is src and src-js only, with resources at the residue value, and a
new Task 16 ports or retires the deno info / deno run / deno fmt / deno
check callers (decisions 4 and 5 recorded). PR 35 gains Task 6 (juice.ts
and ast-diagram on Node APIs, check-usage retired); the engine template
line moves to PR 36; PR 24, 37 and the README table and graph refer to
the table.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The template now states the env key contract PRs 14 and 27b implement
(TypeError on an empty key or one containing = or NUL, and on a NUL value),
the exit contract PR 28 decided (stdio made blocking at load, exitCode set,
immediate exit, broken pipe ends quietly with the current code) and the KV
file rule (one JSON backend on both runtimes from PR 30). PR 08's exit
comments, PR 28's broken-pipe acceptance line (status 0, not 7), PR 34's
contract row 2 and PR 14b's inspect-pipe header follow it. PR 33 drops the
--unstable-kv flag and the "PR 30 keeps the Deno KV backend until PR 37"
sentence from the QUARTO_RUNTIME=deno launchers; PR 37 no longer plans to
remove a kv.ts Deno backend that does not exist.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…both

PR 26's Interfaces now state bundle()'s inputs once (entry, outfile,
banner, define, shim until PR 33, sourcemap, writeMeta), the interop
prelude every bundle starts with (require, __filename, __dirname, PR 20b's
tree-sitter requirement) and the two modes, CLI and fixture, with their
callers and lifecycle through PRs 31, 32 and 33. PR 33's rewrite keeps
banner, define and writeMeta and the prelude, so build-test.mjs is
unchanged by the flip; --write-meta writes <outfile>.meta.json, which
PR 33's module-graph task reads. PR 20b, PR 32 and the template refer to
the contract instead of restating it.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
PR 37 now carries the event-to-job graph it leaves behind (events, OSes,
bucket generation, the reusable-workflow callers and the required check
names) and its Task 3 keeps the schedule trigger, node-macos, render-parity
and node-binary while deleting only the Deno jobs and the parity compare;
test-smokes-parallel.yml goes. render-parity gets a Node-only meaning
(dev bundle versus distribution bundle, decision 5). The acceptance checks
the graph, not just a grep for "deno", and deno-sanity leaves the required
list only after the first green main run. PR 32 points at the graph.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
SPIKES.md moves Spike V after PR 30 (its ten files spawn processes, serve
HTTP, open the KV store and render, so the ports 27-30 are inputs), adds a
failure-classification step that sets runtime gaps aside against their
owning PR, and replaces "choose node:test if neither is eligible" with an
inconclusive outcome with node:test as a provisional choice that blocks
PR 32's required gate until a re-run. PR 31's dependencies and checklist
and the README table and graph follow.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ckaging and version decisions

PR 35 owns the matrix (rows: internal API, prebuilt engines, rebuilt
engines, plain scripts, stdlib/* scripts, Deno-native scripts), the
"not available on Node" table, the version rule and the governing-lockfile
table; its stdlib bundles get a module-local Deno binding and the member
table covers what @std/fs 1.0.16 reaches. PR 36 refers to rows 2-3,
serves log/ and fs/ of the default engine import map as @quarto/std-*
packages built by PR 35's builder (Decision 3), resolves them at the root
lockfile versions with the version rule as a warning (Decision 4), and
gains the fs/log engine fixtures. PRs 00c, 34 and 37 refer to the matrix;
README graph: 35 -> 36.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
… 28, 35, 36, 37

One table in PR 33 (after Task 13) of the CLI runtime (QUARTO_RUNTIME) x
script runtime (QUARTO_RUN_RUNTIME) combinations supported until PR 37, with
the executable each uses and the test that validates it, plus the rule:
src/ spawns Node on architectureToolsPath("node") and Deno on
requireDenoToolBinary(), never on execPath(), which is only the executable
running the current process.

Audit of the post-PR-33 Node subprocess callers: PR 35 runOnNode() and PR 36
typeCheck() used execPath() with Node flags and broke under
QUARTO_RUNTIME=deno (review R08); both now use architectureToolsPath("node").
Doc comment on execPath() in PR 28 and _TEMPLATE.md; references and
acceptance greps in 33, 35, 36 and 37.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
cderv and others added 4 commits October 20, 2026 15:25
…f PR 34 has not landed (organisation review 2026-10-17)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Replace the placeholder 'to fill in' Roles table with the actual
assignment: Chris holds every maintainer/reviewer/release-manager/
spike-decider role; the plan coordinator is a fresh LLM session per
plan; the plan executor is a sub-agent-driven LLM (Chris runs the
reserved gh pr create / push / workflow_dispatch steps).

Update HANDOFF to note the Roles table is filled in; the cut dates
remain Chris's to confirm. Rename 'worker' to 'executor' in README's
'How to execute a plan' to match the new table.
@posit-snyk-bot

posit-snyk-bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv merged commit 7063e04 into main Oct 20, 2026
7 of 9 checks passed
@cderv
cderv deleted the runtime-migration-plans branch October 20, 2026 18:45
@gordonwoodhull

gordonwoodhull commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

@cderv, note that you’ll need to use my fork and branch of the Julia engine, for now, to be Node compatible.

https://github.com/gordonwoodhull/quarto-julia-engine/tree/q2/node-port

I’m waiting until

is merged to a stable Quarto 1 release, before submitting a PR upstream.

@cderv

cderv commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Oh you did the work ! Nice!

@cderv

cderv commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

@gordonwoodhull I see #14936 is schema only change - so would it be safe to backport in v1.10 so it gets out in next patch release which will be before v1.11 is out ?

@gordonwoodhull

Copy link
Copy Markdown
Member

Yes, it should be safe. And I think it would be a good idea.

I’m away from computer this week, but I could file the backport Monday. Or please do it if you need it sooner.

When I filed it I didn’t think there was any rush, but I guess the news makes it more important now… even though it isn’t directly related to Deno, just v1-v2 engine compatibility.

If v1.11 will run on Node instead of Deno, then having the schema change in v1.10 will mean there is a stable version of Quarto that still runs on Deno and accepts v2 engines.

Most people shouldn’t notice or care, but that feels safer.

@cderv

cderv commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

I am planning on v1.11 to run on Deno still, and Node on v1.12 unless we decide differently.

cderv added a commit that referenced this pull request Oct 22, 2026
The plans themselves merged to main in #15133, so HANDOFF.md no longer
points readers at the fork branch they were drafted on, and "How to
resume" starts from main.

PR 02 merged in #15135 and PR 02c in #15153. The README sequence row
for 02 still said "in progress", and HANDOFF.md still named PR 02 as
the first plan to open. Plans check their dependencies against that
table at step 0, so it now says merged, and the handoff names 00a
then 00b as the next plans in README order.

docs: runtime migration, wrap-up checklist for agents

The README already says who moves a row in "The sequence" and when,
but a merge on GitHub runs no session, so the status column and
HANDOFF.md drifted: PR 02 still read "in progress" after it merged.
Findings made while executing one plan that change another plan's
prerequisites were also left only in PR threads.

An AGENTS.md in this directory is read by any agent working on the
plans, the implementer included, so the reminder sits where the work
happens. Findings go to README "Open decisions with an owner" rather
than into the affected plan, which its step 0 re-reads anyway. The
file is removed with the directory when the migration ends.
cderv added a commit that referenced this pull request Nov 3, 2026
…5223)

Add the runtime layer's filesystem, temp-file and error surface in
src/deno_ral/, so callers can move off Deno.* one directory at a time.
The layer keeps the behavior of the monkey-patched Deno calls it
replaces: read errors keep their "Path:" annotation, and temp-file
creation retries only on AlreadyExists. No caller moves in this
change, so CLI behavior is unchanged.

- fs.ts: read, write, stat, mkdir, remove, rename, copy, symlink,
  truncate and open wrappers, typed with the layer's own FileInfo,
  DirEntry, FsFile and option types. readDir returns entries sorted
  by name.
- temp.ts: makeTemp{Dir,File}{,Sync} with the retry policy above.
- errors.ts: predicates (isNotFound, isPermissionDenied, ...) that
  replace instanceof checks on Deno.errors, plus errorWithPath.
- canonicalPathSync resolves symlinks. It replaces realPathSync,
  which the monkey patch redefines to a non-resolving normalizePath.
- tools/codemod-deno-ral.ts rewrites Deno.* calls to the layer and
  back for stable-branch backports (--reverse). It skips files that
  patch Deno itself rather than rewriting them.

Related to #15133
cderv added a commit that referenced this pull request Nov 24, 2026
Route the Deno fs, temp-file and error calls in src/core and
src/quarto-core through the deno_ral layer, so those modules no
longer call them on Deno directly. The layer still calls Deno
underneath, so the CLI behaves the same. instanceof checks on
Deno.errors now use the layer's predicates, such as isNotFound().

- Codemod rewrite of the Deno fs and temp calls
- Hand fixes for two name clashes (copy.ts, qualified-path.ts) and
  console.ts, which writes a file to stdout
- Runtime boundary check: baseline lowered, and each hint names the
  deno_ral function to use in place of the Deno call

Related to #15133
cderv added a commit that referenced this pull request Nov 24, 2026
Blocking errors for covered Deno APIs now net only over files that can
import deno_ral. The scope-wide net also counted src/core/lib and
src/resources/tools, which cannot import the layer, so a call moved
between regular files became an unclearable error when an identical
call was added in an exempt file. A call moved out of an exempt file
netted to zero and went unreported. Warnings keep the scope-wide net,
the counts are unchanged, and a PR that lowers a scope's total is still
never flagged.

- Net blocking errors only over files that can import deno_ral
- Match each added line with the counter's own rules, so a new
  Deno.readTextFile no longer points at a Deno.readTextFileSync line

Related to #15133
cderv added a commit that referenced this pull request Nov 25, 2026
Route the fs and temp calls in src/command through the deno_ral layer
instead of calling Deno directly. The change is a mechanical codemod, so
Deno.readTextFileSync(path) becomes readTextFileSync(path) imported from
deno_ral/fs.ts. The layer still calls Deno underneath.

- Two call sites were edited by hand. pull-git-subtree renames the
  import to fsStat to avoid clashing with a local stat variable. The
  pandoc font cache now checks isNotFound() instead of
  instanceof Deno.errors.NotFound, and still rethrows other errors.
- The layer's readDir returns entries sorted by name, where Deno returns
  them in filesystem order. Listings that depend on that order change,
  and when a source holds several brand extensions, quarto use brand
  picks the first one in sorted order. A single brand extension is
  unaffected.

Related to #15133
cderv added a commit that referenced this pull request Nov 25, 2026
Run the Deno.* codemod over src/project and src/format, so file and
temp-file calls go through the runtime layer in deno_ral/fs.ts instead
of Deno directly, as part of the move off Deno (#15133). The layer
still calls Deno underneath.

- Replace 159 Deno.* calls in 51 files with their deno_ral/fs.ts
  equivalents.
- Replace three instanceof Deno.errors.X checks with the
  isPermissionDenied() and isNotFound() predicates from
  deno_ral/errors.ts, and stop InputWalkError from extending
  Deno.errors.PermissionDenied. The predicates also look through one
  level of cause, so these checks now accept a wrapped error.
- Lower the runtime boundary baseline for src from 670 to 507 calls.

One behavior changes: the layer's readDirSync returns entries sorted
by name, where Deno returns them in filesystem order. This affects
the order in which bslib component SCSS files are concatenated into
the theme and the order of items in the manuscript MECA bundle.

See #15133
cderv added a commit that referenced this pull request Nov 25, 2026
Coherence check of the plans against main at 75452bd.

- Step 0 gains a fourth code-block check: no listing meant for src or
  package/src restores a Deno call the layer already covers
- Add a row for PR 04 (readSitemap listing) and one carrying what
  PRs 10-12 found for PRs 13 and 14, including the owed changelog entry
- PR 01 shrinks to its regression test and no longer gates PR 26: the
  sorted bslib order landed with #15426
- Retire rows for merged PRs (10, 00a), fold the kRalDenoReplacements
  row, move the PR 02c rule to conventions
- Rule 7 and Roles point to AGENTS.md instead of requiring a skill
- Worktrees are created from upstream/main
- HANDOFF: the 00b remainder is the critical path and has not started

Related to #15133
cderv added a commit that referenced this pull request Nov 26, 2026
Move the file and temp-directory calls in the remaining src directories
from Deno.* to the deno_ral/fs.ts layer. The layer still calls Deno
underneath, so the one behavior change is ordering: readDirSync now
returns entries sorted by name, where Deno returns them in filesystem
order. Extension discovery reads those listings, so the result of an id
clash or a conflicting project option no longer depends on the
filesystem.

- Codemod src/execute, src/publish, src/tools, src/extension,
  src/preview, src/inspect and src/render.
- Declare readFile, readFileSync and FsFile.readable as returning
  Uint8Array<ArrayBuffer>, which is what Deno returns. Bytes then pass to
  Blob, crypto.subtle.digest and CompressionStream without a cast.
  Type-only change.
- Sort directory listings by name.

Related to #15133
cderv added a commit that referenced this pull request Nov 27, 2026
Route every Deno.env call in src through a new deno_ral/env object
with get, set, delete and toObject, so src no longer reaches Deno
directly for environment variables. The layer still calls Deno
underneath, and nothing changes for users.

- Codemod rewrites 148 calls in 50 files. Six files that already bind
  a local `env` import the layer as `env as runtimeEnv` instead.
- The methods use no `this`, because dotenv passes env.delete as a
  callback.
- get, set and delete reject an empty name or one containing `=` or
  NUL with a TypeError. Deno already throws on these names and Node's
  process.env does not, so the check keeps both runtimes in agreement.
- The runtime boundary check reports Deno.env calls in src and
  package/src as covered by the layer. The src baseline drops from
  384 to 219 Deno.* calls.

Related to #15133
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.

3 participants