fix: pre-render all non-frozen QMDs to fix babelquarto freeze cache miss#278
Merged
Merged
Conversation
babelquarto renders in a temp dir (withr::local_tempdir()), creates _freeze there, copies only _site back to workspace, then deletes the temp dir. The workspace _freeze was never updated, so Save freeze cache only found ~6 entries (just the changed-file pre-renders) instead of 500+. Fix: add "Pre-render all non-frozen QMD files" step before babelquarto. This writes freeze entries to the workspace _freeze. babelquarto then copies the full _freeze into its temp dir via fs::dir_copy() and uses filter_freeze_directory() to match freeze entries to renamed .zh.qmd files, skipping all code execution (pandoc-only ~20 min vs ~90 min full re-render). Also increase timeout from 120 to 180 minutes for cold-cache first runs. Agent-Logs-Url: https://github.com/openbiox/Bizard/sessions/164ab16f-4599-4163-b722-0777d1ae60dd Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
ShixiangWang
April 16, 2026 08:03
View session
Contributor
✅ QMD Format CheckNo new QMD tutorial files to check.
|
Member
|
@copilot 是否进行了整个流程的模拟测试和可靠性验证? |
Contributor
Author
没有在真实 CI 上全流程运行(需要约 95-115 分钟),但进行了以下可靠性验证: 1. 根本原因已通过 CI 日志证实
2. 核心逻辑(freeze 路径计算)本地验证通过 冷缓存模拟(无 3. babelquarto 的
4. 已知限制 唯一无法本地验证的是:Quarto 在 babelquarto 的临时目录中,用存储的哈希校验冻结条目时是否正确匹配(文件路径变了但内容相同)。如果出现哈希不匹配,最坏结果是首次运行仍然重新执行代码,但不会报错——后续运行会得到正确的缓存。可在下次 CI 运行时通过观察 "Pre-render all non-frozen QMD files" 步骤的渲染数量和 "Save freeze cache" 的耗时来确认。 |
Copilot stopped work on behalf of
ShixiangWang due to an error
April 16, 2026 09:41
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.
问题分析 / Root Cause
通过详细分析 CI 日志(run 24491897842),发现 freeze cache 从未被正确保存。
babelquarto::render_website()内部机制如下(源码):根本原因:babelquarto 在临时目录中渲染,将新的
_freeze条目写入临时目录,然后只把_site复制回工作区,最后临时目录被删除。工作区的_freeze从未更新,导致Save freeze cache步骤只能找到约 6 个 Julia 预渲染条目,而不是 500+ 个。证据:
修复方案 / Fix
在 babelquarto 运行之前,添加"Pre-render all non-frozen QMD files"步骤,直接将 freeze 条目写入工作区的
_freeze目录:_freeze被完全填充(500+ 条目)fs::dir_copy()将完整的_freeze复制到临时目录filter_freeze_directory()将.zhfreeze 条目重命名以匹配重命名后的.qmd文件quarto::quarto_render()时,所有文件都有 freeze 条目 → 跳过代码执行,只运行 pandocSave freeze cache步骤在工作区找到完整的_freeze并保存预期效果 / Expected Performance
其他变更 / Other Changes