Skip to content

Commit bd36e20

Browse files
authored
Ignore Deno's gen/ output when checking the user deno_std cache (#15386)
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.
1 parent 69936dd commit bd36e20

3 files changed

Lines changed: 41 additions & 2 deletions

File tree

‎dev-docs/runtime-migration/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ The rows below are the ones that still need a named person or an external answer
213213
| PRs 33 and 34, packager builds (from #15259, discussion #14888) | #15259 committed the lockfile because packagers need integrity-pinned dependencies and an offline build against a cache. State the Node-era equivalent: which lockfiles govern (`package-lock.json`, `src/webui/quarto-preview/package-lock.json`, PR 35's `tools/run-stdlib/package-lock.json`), how `configure` runs with `QUARTO_VENDOR_BINARIES=false` and no network (`npm ci` against a pre-filled cache), and how the Node binary is verified: the plan's `configure.cmd` checks no hash although the Context says "checksum-verified", and `configure.sh` checks against a `SHASUMS256.txt` fetched from the same host | A10 owner (distribution compliance and the offline promise), else maintainer | before PR 33 starts |
214214
| PR 33 Task 12 and PR 38 Task 1 (from #15186) | The pins predate the Deno 2.9.8 bump: `typescript@5.9.3` and `@types/deno@2.7.0` in PR 33, and the `deno fmt`/`deno lint` plugin versions PR 38 read at tag `v2.9.7`. Re-pick `typescript` to match the TypeScript bundled in the `DENO` of `configuration` (TypeScript 6, see the PR 01 row), the newest `@types/deno` not above that Deno, and re-read the dprint plugin and `deno_lint` versions at that tag | executor | step 0 of PRs 33 and 38 |
215215
| PR 35 Task 1 and Task 4 Step 5 (from #15227) | The plan moves `run_import_map.json` out of `src/resources/deno_std/` but keeps `initDenoCache()` until PR 37. Its `fileList` still names `run_import_map.json`, and `filesDiffer` returns `true` for a file missing from the cache copy, so every `quarto run` on the Deno tool would delete and re-copy the cache and lose the cached npm packages (what #15227 fixed). Remove the entry from `fileList` in the same step and keep `tests/unit/core/deno-std-cache.test.ts` green | PR 35 executor | PR 35 step 0 |
216-
| PR 37 inventory (from #15227, #15259, #15287) | The inventory was verified at `b86f98d`. Add: `directoryListingsMatch` and `kSqliteSidecar` in `src/core/run/deno.ts` with `tests/unit/core/deno-std-cache.test.ts` (deleted together with `initDenoCache`); `tests/unit/dev-launcher-deno-version.test.ts` (the `deno-version` check goes); `.gitignore` lines 21-23 (`tests/deno.lock`, `src/deno.lock` and their comment) instead of the `# deno lock file` / `deno.lock` text; the `deno.lock` bullet of `.claude/CLAUDE.md`, whose cited line numbers no longer match; every `QUARTO_UPDATE_DENO_LOCK` mention (README rule 8 included). Rebuild the inventory with the Acceptance greps before Task 1 | coordinator | PR 37 step 0 |
216+
| PR 37 inventory (from #15227, #15259, #15287) | The inventory was verified at `b86f98d`. Add: `directoryListingsMatch`, `kSqliteSidecar` and `kGenOutput` in `src/core/run/deno.ts` with `tests/unit/core/deno-std-cache.test.ts` (deleted together with `initDenoCache`); `tests/unit/dev-launcher-deno-version.test.ts` (the `deno-version` check goes); `.gitignore` lines 21-23 (`tests/deno.lock`, `src/deno.lock` and their comment) instead of the `# deno lock file` / `deno.lock` text; the `deno.lock` bullet of `.claude/CLAUDE.md`, whose cited line numbers no longer match; every `QUARTO_UPDATE_DENO_LOCK` mention (README rule 8 included). Rebuild the inventory with the Acceptance greps before Task 1 | coordinator | PR 37 step 0 |
217217
| PRs 34, 35, 36, 37, release correction, the "1.11" side | The release correction row shifts 1.12/1.13 to 1.13/1.14 and says not to change shipped 1.11 entries. In these plans "1.11" also means "the last release on Deno", which is now 1.12. Shift those too, including shipped strings and code comments: PR 34's contract table header "Deno (≤ 1.11)" and "stay on Quarto 1.11"; PR 35's matrix column "1.11 (Deno)", "PR 00c (1.11)" and the shim comment "Quarto <= 1.11 (Deno)"; PR 36's "built for Quarto ≤ 1.11", "1.9–1.11", "ran on Deno through 1.11" and "pin Quarto 1.11"; PR 37's "1.11 ships the boundary work". Keep "1.11" where it states a fact about that release (what 1.11's `updateImportMap` wrote) | coordinator | step 0 of each |
218218
| PR 36 Task 3 | (1) Whether the load-time warning for engine bundles that reference `Deno.` ships ahead of the flip as a 1.12 notice, as PR 00c does for scripts: the task only edits `src/execute/engine.ts` and needs no Node; it needs future-tense wording and the migration page anchor. (2) Its unit test builds the name with `const D = "Deno"` to stay out of the ratchet's `tests` count; apply the step 0 rule: write the literal and accept the baseline increase, or keep the samples in a fixture under `tests/docs/` | release manager (1), executor (2) | before the `v1.12` branch is cut (1); PR 36 step 0 (2) |
219219
| PR 33 and PR 35 size (complements the existing row) | 33a as floated (Tasks 1, 11, 12, 16) is not self-sufficient before the flip: Task 16 Step 1 runs `build.mjs` on `execPath()`, which is Deno until Task 4; Task 12 also edits `tests/run-tests.sh` and drops the launcher's `--check`. Proposed: 33a-1 now (Task 1; Task 16 Steps 3–4 once Decisions 4 and 5 are taken), 33a-2 after PR 26 (Task 12 as a non-required `lint.yml` job, Task 16 Steps 1–2 on an explicit `node`, Task 11), 33b the flip. 35a (Task 1) needs PRs 26, 27 and 28 merged, leaves the `git mv` of `run_import_map.json` to 35b, and wires `configure`/`prepare-dist` on an explicit `node` or leaves the wiring to 35b. PR 38 may likewise split: 38a (dprint and oxlint, Tasks 1, 2, 4) between PR 33 and PR 37 while `deno fmt` and `deno.jsonc` are still present for the parity run, 38b (Task 3, `@types/deno`) after PR 37. PR 34 Task 3 (the disabled RHEL job) and the `kPinnedBinaryVersions` export with its `configuration` test can land now | maintainer | before Phase 3 starts |

‎src/core/run/deno.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,15 @@ function directoryListing(path: string): Set<string> {
8484
// Deno may leave these in the seed and delete them from the user copy on a clean close
8585
const kSqliteSidecar = /_cache_v2-(shm|wal|journal)$/;
8686

87+
// Deno's transpile output, regenerated on demand; gen/file/ entries are keyed by
88+
// the absolute path of the checkout that built the seed, so they differ per build
89+
const kGenOutput = /^[\\/]cache[\\/]gen([\\/]|$)/;
90+
8791
export function directoryListingsMatch(path1: string, path2: string): boolean {
8892
const listing1 = directoryListing(path1),
8993
listing2 = directoryListing(path2);
9094
for (const path of listing1) {
91-
if (kSqliteSidecar.test(path)) {
95+
if (kSqliteSidecar.test(path) || kGenOutput.test(path)) {
9296
continue;
9397
}
9498
if (!listing2.has(path)) {

‎tests/unit/core/deno-std-cache.test.ts‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,41 @@ unitTest(
9090
},
9191
);
9292

93+
// `deno cache` writes transpiled local modules under gen/file/<absolute path of
94+
// the checkout that built the seed>, so each checkout or build machine has its
95+
// own entry. Every Quarto shares the user copy, so a missing gen/ file must not
96+
// count as a stale cache.
97+
unitTest(
98+
"directoryListingsMatch - ignores Deno's gen/ output missing from the user copy",
99+
async () => {
100+
const result = await compare(
101+
[
102+
"cache/dep_analysis_cache_v2",
103+
"cache/gen/file/C/build/package/scripts/deno_std/deno_std.ts.js",
104+
"cache/gen/https/deno.land/abc.js",
105+
"cache/npm/x/y.json",
106+
],
107+
[
108+
"cache/dep_analysis_cache_v2",
109+
"cache/gen/file/D/a/package/scripts/deno_std/deno_std.ts.js",
110+
"cache/npm/x/y.json",
111+
],
112+
);
113+
assertEquals(result, true);
114+
},
115+
);
116+
117+
unitTest(
118+
"directoryListingsMatch - does not ignore a gen directory outside the cache root",
119+
async () => {
120+
const result = await compare(
121+
["cache/dep_analysis_cache_v2", "cache/npm/x/gen/y.js"],
122+
["cache/dep_analysis_cache_v2"],
123+
);
124+
assertEquals(result, false);
125+
},
126+
);
127+
93128
unitTest(
94129
"directoryListingsMatch - reports a missing cache database",
95130
async () => {

0 commit comments

Comments
 (0)