Add a `freeze: fail` option that errors on stale or missing frozen results
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 15/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript, yaml
- Lĩnh vực
- build-system, ci-cd
Hướng nghiên cứu
The change touches renderExecute in src/command/render/render-files.ts, defrostExecuteResult in src/command/render/freeze.ts, and the freeze schema in src/resources/schema/document-execute.yml. Start by reading how the hash comparison and the thawed-result lookup work for auto. Before coding, the open questions need a maintainer decision: whether to report one stale document or all of them, which takes precedence (profile or document), and the value name. Done means the new value is accepted by the schema and fails with a clear error for stale or missing results.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Many projects render in CI from committed _freeze/ files, with no R, Python, or Julia on the runner. A forgotten freeze update is the common mistake in that setup, and Quarto gives no clear signal for it.
I propose freeze: fail: use a frozen result if it is current, and stop with an error that names the document if it is not. The main use is a CI-only project profile.
| Value | Current result | Stale result | Missing result |
|---|---|---|---|
true |
Use it | Use it, with no message | Execute |
auto |
Use it | Execute | Execute |
fail (new) |
Use it | Stop, and name the document | Stop, and name the document |
A result is current if its hash matches the source file. The table describes a full project render (renderExecute, defrostExecuteResult).
The problem
freeze: true (for example, quarto-web). An author edits a computational document and forgets to commit a new _freeze/. Quarto uses the stale result and CI passes. The frozen result holds the full executed markdown, so the published page shows the old document, prose edits included. Nothing in the log or the PR checks points to it. In my clone of quarto-web (commit 001d4331e), 2 of 23 frozen results are stale: docs/interactive/ojs/index.qmd and docs/interactive/widgets/htmlwidgets.qmd.
freeze: auto (for example, a book that renders from freeze in CI). The same mistake makes Quarto execute the document in CI. The runner has R but no packages, so the render fails with this error:
Error in loadNamespace(x) : there is no package called 'rmarkdown'
...
The knitr package is not available in this R installation.
Install with install.packages("knitr")
The rmarkdown package is not available in this R installation.
Install with install.packages("rmarkdown")
WARN: Error encountered when rendering files
The error describes the runner, not the mistake, and it tells the reader to install packages. The usual reaction is to add R and packages to the workflow, which hides the problem and slows the job. This happened in our book repository.
Proposal
# _quarto-ci.yml
execute:
freeze: fail
quarto render --profile ci
- With
truelocally: a stale result fails the PR check before the stale page is published. - With
autolocally: Quarto stops before the engine starts, and the error is about the freeze, not the runner. Current results are used exactly as today. - The local workflow does not change. Authors render with
trueorautoand commit_freeze/. - A targeted render (
quarto render doc.qmd) executes with every value today. I suggest thatfailkeeps this behavior, because that is how an author updates a frozen result. - Documents that cannot be frozen (
engine: markdown,execute: enabled: false) are not affected.
A possible error message:
ERROR: projects.qmd changed after its results were frozen.
Render the document in an environment that can execute it, then commit _freeze/projects/.
Implementation notes
- Add the value to the
freezeschema and to thekFreezetype. defrostExecuteResultalready compares the hash for every value other thantrue, sofailgets theautocomparison with no change.- New logic: in
renderExecute, beforecontext.engine.execute(...), throw if the value isfail,canFreezeis true, and there is no thawed result.
Open questions
- One error or all. Quarto compares hashes one document at a time, in the loop that runs Pandoc. The small change above reports only the first stale document, after it renders all earlier ones. A full list up front needs a new pass over the input files.
- Precedence. I expect a
freezevalue in a document or_metadata.ymlto take precedence over a profile (not verified). That is a useful exemption for one document, and a problem for a project that setsfreezein each directory. - Single-file book formats. A targeted render becomes a full render with the freezer on (
bookIncrementalRenderAll), so a stale result in a different chapter stops it. - Preview. I suggest that
quarto previewtreatsfailasauto. - Name.
fail,strict, orrequire.
Alternatives
- A render flag or environment variable, like
cargo build --lockedornpm ci. It overridesfreezevalues everywhere. Afreezevalue works with profiles and with every command that renders, such asquarto publish. - A CI script that compares the MD5 of each source file with the
hashin its frozen result. We plan to do this for now. The script must copy the hash rule and guess which documents need a frozen result.
AI helped with this investigation. It was grounded in local clones of quarto-cli (commit 623cd99e8) and quarto-web (commit 001d4331e).
- Ngôn ngữ chính
- JavaScript
- Star
- 6.2k
- Fork
- 492
- Merge trung bình
- 15 giờ 15 phút
- Pull request đã merge (30 ngày)
- 94
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của quarto-dev/quarto-cli
-
bootstrap enhancement themes
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
quarto-dev/quarto-cli#15421 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
quarto-dev/quarto-cli#15408 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
quarto-dev/quarto-cli#15401 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug callouts docx regression
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 81/100
quarto-dev/quarto-cli#15394 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug lightbox
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quarto-dev/quarto-cli#15393 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của quarto-dev/quarto-cli
Issue tương tự
-
bug help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
LangerSword/gitone#7 ·
-
good first issue reliability security should-have
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 13 ngày
-
[BUG]: chunkSource protocol stripping truncates URLs or reads an inner schemeCó thể đã có người làm @Bensonbenyi đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Mintplex-Labs/anything-llm#7338 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày