Handle keep-ipynb correctly now that fileInformationCache is responsible for the cleaning#12793
Merged
Handle keep-ipynb correctly now that fileInformationCache is responsible for the cleaning#12793
Conversation
Collaborator
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
This allows to always get the global fileInformationCache from project context to get / set information in it from different contexts.
cderv
pushed a commit
that referenced
this pull request
May 23, 2025
backport of #12793 - update fileInformationCache based on `keep-ipynb` information - requires to always pass ProjectContext in ExecuteOptions - requires to ensure fileInformationCache is not cloned by safeCloneDeep This allows us to always get the global fileInformationCache from the project context to get / set information in it from different contexts. - Add tests for project context and single file context
cderv
pushed a commit
that referenced
this pull request
May 23, 2025
backport of #12793 - update fileInformationCache based on `keep-ipynb` information - requires to always pass ProjectContext in ExecuteOptions - requires to ensure fileInformationCache is not cloned by safeCloneDeep This allows us to always get the global fileInformationCache from the project context to get / set information in it from different contexts. - Add tests for project context and single file context
cderv
added a commit
that referenced
this pull request
May 23, 2025
backport of #12793 - update fileInformationCache based on `keep-ipynb` information - requires to always pass ProjectContext in ExecuteOptions - requires to ensure fileInformationCache is not cloned by safeCloneDeep This allows us to always get the global fileInformationCache from the project context to get / set information in it from different contexts. - Add tests for project context and single file context
cderv
added a commit
that referenced
this pull request
May 23, 2025
backport of #12793 - update fileInformationCache based on `keep-ipynb` information - requires to always pass ProjectContext in ExecuteOptions - requires to ensure fileInformationCache is not cloned by safeCloneDeep This allows us to always get the global fileInformationCache from the project context to get / set information in it from different contexts. - Add tests for project context and single file context
cderv
added a commit
that referenced
this pull request
Apr 15, 2026
When keep-ipynb is false (the default), cleanupNotebook() now calls safeRemoveSync() to delete the intermediate .quarto_ipynb file immediately after execution, restoring the original behavior from 2021 that was inadvertently dropped when keep-ipynb support was added in PR #12793.
cderv
added a commit
that referenced
this pull request
Apr 16, 2026
When keep-ipynb is false (the default), cleanupNotebook() now calls safeRemoveSync() to delete the intermediate .quarto_ipynb file immediately after execution, restoring the original behavior from 2021 that was inadvertently dropped when keep-ipynb support was added in PR #12793.
cderv
added a commit
that referenced
this pull request
Apr 22, 2026
Fix `.quarto_ipynb` files not cleaned up after render
When rendering a `.qmd` file with Jupyter execution, the intermediate
`.quarto_ipynb` file was never deleted. Each subsequent render created
numbered variants (`_1`, `_2`, etc.) that accumulated on disk.
PR #12793 added `keep-ipynb: true` support by integrating
`cleanupNotebook()` with `fileInformationCache`, but as a side effect
dropped the immediate file deletion for the default `keep-ipynb: false`
case. The function only flipped a `transient` flag in the cache when
`keep-ipynb: true` was set, and did nothing otherwise.
- Restore immediate deletion via `safeRemoveSync()` in `cleanupNotebook`
when `keep-ipynb` is false, preserving the cache integration for
`keep-ipynb: true`
- Refactor `cleanupNotebook` for clarity and handle the edge case
where cache entry is missing
- Add `fileNotExists` verification helper to the smoke-all test
framework and a test covering the cleanup behavior
- Add manual test doc for ungraceful termination scenarios
- Fix typst package staging to use input directory instead of
file path (discovered during testing)
Fixes #14359
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.
This is a first proposal to fix #12780
It is based on the fact that
quarto inspect#12337 introduced a globalfileInformationCachein the project context, that does the cleaning. Forquarto inspectbut also forquarto render- without taking into accountkeep-ipynbSo this PR does now in
execute()settransient: falseto prevent cleaning whenkeep-ipynb: trueThe cleaning is still done by fileInformationCache cleanup step.
To ensure that happens, the
safeCloneDeepescape mode is leveraged to ensure that the project contextfileInformationCachewill always be accessible by reference.I said first proposal because there is supposed to be a cleaning mechanism in engine with
executeTargetSkippedand so I don't see why #12337 was requiring this fileInformationCache cleanup.