Repository navigation
Conversation
Since Deno 2.4.5 (Quarto 1.9), `deno cache` can exit before closing its SQLite cache databases while building the bundled deno_std seed. The seed then ships un-checkpointed `-shm`/`-wal` files next to `dep_analysis_cache_v2` and `node_analysis_cache_v2`. When a later runtime Deno process closes one of these databases cleanly, SQLite deletes the sidecars from the user copy. The next `initDenoCache()` sees seed paths missing from the user copy, wipes the cache and recopies the seed, dropping the downloaded npm packages. Offline runs then fail with "npm package not found in cache". Skip the sidecars of Deno's `*_cache_v2` databases when comparing the seed listing with the user listing. The match is narrow so package files that happen to end in `-wal` or `-shm` still count as drift, and a missing database file still triggers a reset. The copy keeps sidecars, since a seed database with an un-checkpointed WAL is only valid together with its WAL.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Since Quarto 1.9, TypeScript scripts run by Quarto (
quarto run, project pre- and post-render scripts, Jupyter filters) can lose the npm packages they downloaded. Offline, the next run then fails withnpm package not found in cache ... --cached-only is specified. This reproduces on Windows with the 1.11.8 release build.Root cause
Quarto ships a pre-populated Deno cache and copies it to the user cache directory on first use. Before each script run,
initDenoCache()insrc/core/run/deno.tscompares the file names of the bundled cache with the user copy. If any bundled file is missing, it deletes the user copy and copies the bundled cache again, which also drops every npm package downloaded since.Since the update to Deno 2.4.5,
deno cachecan exit before closing its SQLite cache databases when the bundled cache is built. The bundled cache then ships the-shmand-walfiles ofdep_analysis_cache_v2andnode_analysis_cache_v2. It depends on timing: the Windows Zip of 1.11.8 has them, the macOS and Linux tarballs of the same release run don't. When a later Deno process closes one of these databases cleanly, SQLite deletes those files from the user copy, and the next run resets the cache.Fix
The comparison now skips the SQLite sidecar files of Deno's
*_cache_v2databases. The match is narrow, so a package file whose name ends in-walstill counts as missing, and so does a missing database file. The sidecars are still copied with the bundled cache, because a database with un-checkpointed changes is only valid together with its-walfile.On Windows with the bundled cache from the 1.11.8 release, 30 offline runs after a clean close of the database keep the cache. Without the fix, the first offline run resets it. Producing a bundled cache without these files at build time is left for a follow-up.
Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.