Skip to content

Fix quarto run resetting the shared deno_std cache across Quarto installs - #15386

Merged
cderv merged 1 commit into
mainfrom
fix/check-runtime-boundary-pr-mode-unit-test-fails-on-windows-os-error-32-resetting-user-deno-std-cache
Nov 17, 2026
Merged

cderv merged 1 commit into
mainfrom
fix/check-runtime-boundary-pr-mode-unit-test-fails-on-windows-os-error-32-resetting-user-deno-std-cache

Conversation

@cderv

@cderv cderv commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

When two Quarto checkouts or installs share a machine, each quarto run of a .ts script from one of them wipes and recopies the shared user copy of the bundled deno_std cache (%LOCALAPPDATA%/quarto/deno_std on Windows) if another one copied it last. The wipe also loses the npm packages scripts downloaded there. On Windows, when another Deno process has files of that cache open (for example a quarto run server started from an installed Quarto), the wipe fails and quarto run errors:

ERROR: The process cannot access the file because it is being used by another process. (os error 32): remove 'C:\Users\<user>\AppData\Local\quarto\deno_std'

This made tests/unit/tools/check-runtime-boundary.test.ts fail locally, as its PR-mode test spawns quarto run --dev.

Root cause

Before each run, initDenoCache in src/core/run/deno.ts recopies the user copy when a file of the bundled seed is missing from it. The seed is built by deno cache on package/scripts/deno_std/deno_std.ts, and Deno writes the transpiled output of that local file under a path that includes the absolute path of the checkout that built it: cache/gen/file/<checkout path>/package/scripts/deno_std/deno_std.ts.js. A dev worktree and the Windows release (built under D:/a/quarto-cli/quarto-cli) each have their own entry, while sharing one user copy. So the copy only satisfies the Quarto that wrote it last, and the other one resets it every time.

It does not show on CI, where the seed and the user copy come from the same checkout.

Fix

directoryListingsMatch now skips the cache/gen/ subtree, the same way #15227 skips SQLite -shm/-wal files. gen/ only holds derived output that Deno regenerates on demand. A reset still happens when deno_std.lock or the import maps change.

The PR 37 inventory row of the runtime migration README now also names kGenOutput, deleted with directoryListingsMatch and its test file.

Test plan

  • New unit tests in tests/unit/core/deno-std-cache.test.ts: missing gen/ entries don't trigger a reset (fails without the fix), a gen folder elsewhere in the cache still counts.
  • On Windows with an installed prerelease holding the shared cache open, check-runtime-boundary.test.ts failed with os error 32 before the fix and passes after.

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 Code
  • Codebase grounding: local clone
  • 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.

@posit-snyk-bot

posit-snyk-bot commented Nov 17, 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.

initDenoCache wipes and recopies the user copy of the deno_std seed when
any seed path is missing from it. The seed is built by `deno cache` on
package/scripts/deno_std/deno_std.ts, and Deno writes that file's
transpile output under cache/gen/file/<absolute path of the build
checkout>/. Every checkout, worktree and build machine therefore has a
seed entry no other one has, while they all share one user copy. Each
`quarto run` from a different Quarto than the one that copied last wiped
the cache, which also loses downloaded npm packages.

On Windows the wipe fails with os error 32 when another Deno process has
files in that cache open, for example a long-running `quarto run` server
from an installed Quarto. That made the check-runtime-boundary PR-mode
unit test fail locally, since it spawns `quarto run --dev`.

gen/ holds only derived output that Deno regenerates on demand, so it is
skipped like the SQLite sidecars. Resets still happen when the lock or
import maps change.

The runtime-migration README PR 37 inventory row now also names
kGenOutput, deleted with directoryListingsMatch and
tests/unit/core/deno-std-cache.test.ts.
@cderv
cderv force-pushed the fix/check-runtime-boundary-pr-mode-unit-test-fails-on-windows-os-error-32-resetting-user-deno-std-cache branch from 6842680 to 054787e Compare November 17, 2026 11:02
@cderv
cderv merged commit bd36e20 into main Nov 17, 2026
52 checks passed
@cderv
cderv deleted the fix/check-runtime-boundary-pr-mode-unit-test-fails-on-windows-os-error-32-resetting-user-deno-std-cache branch November 17, 2026 11:42
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.

2 participants