You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c832d2d
Browse filesBrowse the repository at this point in the historyBrowse files
* Fix book/website preview crash from reused closed SassCache KV handle
quarto preview on a book or website project crashed with
"BadResource: Bad resource ID" when re-rendering pages with a theme
plus custom CSS. #13955 fixed the single-file preview path by no longer
tearing down the project context between re-renders, but book and
website preview go through the serve/watch path, which still calls
project.cleanup() (and thus temp.cleanup()) on each config refresh.
The underlying defect was never addressed: SassCache.cleanup() closed
the Deno.Kv handle but left the stale SassCache in the _sassCache
registry, so a later resolve of the same cache path handed back an
instance whose KV handle was already closed. Dropping the registry
entry when the handle is closed makes every render path open a fresh
handle instead.
Fixes#14594.
* Add manual preview test fixture for Sass cache reuse (#14594)
Book preview crashing on Sass recompile after a config-refresh cleanup
is an interactive serve/watch-path bug tests/unit/sass-cache.test.ts
can't reach. Add sass-cache-crash-14594/ (theme + custom css book) and
a Test Matrix section in tests/docs/manual/preview/README.md (T34-T36)
so /quarto-preview-test can drive the regression check, matching the
sibling #14593 brand-detection manual test.
Copy file name to clipboardExpand all lines: news/changelog-1.10.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,7 @@ All changes included in 1.10:
83
83
- ([#14281](https://github.com/quarto-dev/quarto-cli/issues/14281)): Avoid creating a duplicate `.quarto_ipynb` file on preview startup for single-file Jupyter documents.
84
84
- ([#14533](https://github.com/quarto-dev/quarto-cli/issues/14533)): Fix `quarto preview` not detecting a frontmatter `format:` change until the second render request. The first request after the edit now correctly restarts the preview process with the new format.
85
85
- ([#14593](https://github.com/quarto-dev/quarto-cli/issues/14593)): Fix `quarto preview` ignoring a `_brand.yml` added or removed while the preview is running. The brand change is now applied on the next render instead of requiring a preview restart.
86
+
- ([#14594](https://github.com/quarto-dev/quarto-cli/issues/14594)): Fix `quarto preview` of a book or website project crashing with `BadResource: Bad resource ID` when re-rendering pages.
Copy file name to clipboardExpand all lines: tests/docs/manual/preview/README.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -275,6 +275,48 @@ brand signal in the kept `report.typ` is the line
275
275
-**Expected:** Brand stays applied; the source-state token matches so the cache is reused (only cheap stat calls per resolve)
276
276
-**Catches:** A guard that re-loads the brand on every render even when nothing changed
277
277
278
+
## Test Matrix: Sass Cache Reuse (#14594)
279
+
280
+
After every change to `SassCache.cleanup()` or the `_sassCache` registry in
281
+
`src/core/sass/cache.ts`, verify that a book/website preview survives repeated
282
+
re-renders instead of crashing with `BadResource: Bad resource ID`. On each
283
+
re-render the serve/watch reload path runs `refreshProjectConfig`
284
+
(`src/project/serve/watch.ts`, ~line 277 for HTML; also on config changes,
285
+
~line 305), which calls `project.cleanup()` and closes the session Sass KV
286
+
handle; the next render must open a fresh handle rather than reuse the closed
287
+
one. Fixture: `sass-cache-crash-14594/` (a flat multi-chapter book with
288
+
`theme: cosmo` + `css:`, which routes the theme through the session Sass cache);
289
+
drive it with the `/quarto-preview-test` workflow. Deterministic unit coverage
290
+
lives in `tests/unit/sass-cache.test.ts` — this matrix is the interactive
291
+
regression guide that path can't cover.
292
+
293
+
### P1: Critical
294
+
295
+
#### T34: Book project preview — `_quarto.yml` edit does not crash on Sass recompile
296
+
297
+
-**Setup:**`sass-cache-crash-14594/` book (`theme: cosmo`, `css: styles.css`), no prior `.quarto/` or `_book/`
298
+
-**Steps:** From the fixture dir, `quarto preview --no-browser --port XXXX`; after the first render, edit `_quarto.yml` (tweak the title or append a comment line) and save 3-5 times, watching the preview log
299
+
-**Expected:** Every re-render completes and reloads. No `BadResource: Bad resource ID` in the log. The cosmo theme + custom CSS keep recompiling/serving.
300
+
-**Catches:**`SassCache.cleanup()` closing the KV handle but leaving the stale instance in `_sassCache`, so the next resolve reuses a closed handle (#14594, #13955)
-**Steps:**`quarto preview --no-browser --port XXXX`; after the first render, edit a chapter body (`index.qmd` / `chapter1.qmd`) and save 3-5 times
308
+
-**Expected:** Same as T34 — no crash, pages keep reloading
309
+
-**Catches:** The HTML reload path (`refreshProjectConfig` at watch.ts ~277) closes the session KV on a plain content re-render too, so a content save must not reuse a closed handle either
310
+
311
+
### Regression Guard
312
+
313
+
#### T36: Single-file preview — unaffected by the registry cleanup
314
+
315
+
-**Setup:**`plain.qmd` (markdown-only, no project)
316
+
-**Steps:**`quarto preview plain.qmd --no-browser --port XXXX`, save 3-5 times
317
+
-**Expected:** No crash and no behavior change — the fix is a no-op for the common single-file preview path
318
+
-**Catches:** The registry-entry deletion in cleanup accidentally breaking or churning the non-project preview path
0 commit comments