quarto-dev / quarto-dev/quarto-cli
investigate: typst PDF and LaTeX (texToPdf) recipe `complete` callbacks read format state from the captured construction-time `format` parameter
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Note-for-later, no current reproducer. Spawned by the analysis for #14511.
Context
In #14511 the typst PDF recipe's complete callback (src/command/render/output-typst.ts) was observed to read format.metadata[kFontPaths] from the format parameter captured at recipe construction. For book projects, withBookTitleMetadata (src/project/types/book/book-render.ts:724) deep-clones and reassigns recipe.format between recipe construction and renderPandoc, so the captured reference becomes stale. resolveExtras then mutates the new (post-clone) recipe.format.metadata, but the recipe's complete never sees it.
The committed fix reads from pandocOptions.format (the live reference). See PR for #14511.
Concern by analogy
texToPdfOutputRecipe (src/command/render/output-tex.ts) has the same capture-the-parameter pattern in its complete callback. Specifically:
- It reads
format.render[kKeepTex]from the capturedformat(around line 105). - The PDF-standard fallback chain at lines 93–94 also reads from the captured
format.
LaTeX/PDF book formats are single-file (they do NOT set multiFile: true), so they DO go through renderSingleFileBook → withBookTitleMetadata → deep-clone. The structural exposure is identical to the typst case.
Why this isn't an active bug today
No current pipeline step mutates format.render[kKeepTex] or format.metadata[kPdfStandard] between recipe construction and complete. The known post-construction mutations in pandoc.ts (kTocTitle at ~498, kAbstractTitle at ~521, user pandoc metadata merge at ~466) touch different keys.
Asks for whoever picks this up
- Confirm there is genuinely no current execution path that flips
kKeepTexorkPdfStandardafter recipe construction for a PDF book — if there is, it's the same class of bug as #14511 and reproducible. - If confirmed latent: either (a) apply the same
pandocOptions.formatread for symmetry and defense-in-depth, or (b) close as won't-fix with a comment inoutput-tex.tsexplaining why the snapshot is intentional.
Related
- #14511 (root issue)
src/command/render/output-typst.ts(already fixed)src/command/render/types.ts:265(OutputRecipe.completesignature)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/command/render/output-tex.ts, especially the complete callback and PDF-standard fallback, then trace renderSingleFileBook, withBookTitleMetadata in src/project/types/book/book-render.ts, and the relevant mutations in pandoc.ts. Confirm whether kKeepTex or kPdfStandard can change after recipe construction; done means reproducing the stale-reference path, applying the matching live-format approach, or documenting why no change is needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100