Repository navigation
Description
#160's step 1 makes a build-cache restore remove <path>/html, so a deleted page or static file is no longer published again. This is step 2, which the maintainer decided on 2026-11-07 would follow it: the templates stop restoring the full _build at all. Analysis: #160's comment of 2026-11-07, against main at 9644f17.
The problem step 1 leaves
- Leftovers outside
html. A restored build cache still holds_build/jupyter,_build/latexand_build/jupyter_executefrom the last cache build, including the outputs of lectures deleted since.html-copy-notebookscopies every.ipynbunder_build/jupyterinto the site, andhtml-copy-pdfevery.pdfunder_build/latex. So a workflow that buildsjupyterorpdflatexover a restored cache can still publish a deleted lecture's notebook, or a figure PDF, as the canary'sci.ymldoes, andtemplates/publish.ymldoes with its optional steps on. feat(build-lectures): fail on error outputs in the executed notebooks, which -W misses (#247) #256's error-output check already has to skip stale notebooks in_build/jupyter_execute(build-lectures/check-error-outputs.py:35-38). - Storage. Each cache build saves the full
_build, which contains_build/.jupyter_cache, and then saves_build/.jupyter_cacheagain on its own (build-jupyter-cache/action.yml:426-438). So the execution cache is stored twice, against the repository's 10 GB cache budget, past which GitHub evicts the least recently used caches (review M3,.qe/dev/log/2026-10-06-codebase-review.md:220-245). After step 1, every restore also downloads the whole_buildand deletes itshtml. - No speed in return. A fresh checkout gives every source file a newer mtime than the last build's, so Sphinx re-reads and rewrites every page whatever was restored. Only
.jupyter_cachesaves work, by sparing notebook execution.
Why not simply restore cache-type: execution today
The two caches are keyed differently. The build cache's key hashes the environment files and never falls back across an environment change. The execution cache's key hashes only the lectures, and falls back to any execution cache (restore-jupyter-cache/action.yml:164-182). So under execution, a pull request that changes the environment, an Anaconda baseline bump for one, would restore outputs made with the old packages, re-execute nothing and pass. The new packages would first run in the next weekly cache build, after the merge. The restore chapter documents this (docs/user/actions/restore-jupyter-cache.md:139). Under build, the same pull request misses the cache and re-executes everything, which is the signal it needs.
The change
- The execution cache's key hashes the environment too.
build-jupyter-cachesaves it asjupyter-cache-<hash of environment>-<hash of environment-update>-<hash of the .md files>-<run id>(build-jupyter-cache/action.yml:433-438).restore-jupyter-cachelooks it up with the build cache's fallbacks:jupyter-cache-<env>-<update>-<md>-, thenjupyter-cache-<env>-<update>-, thenjupyter-cache-<env>-. It never falls back across anenvironmentchange.- The
environmentandenvironment-updateinputs then apply to both cache types, and their descriptions lose "Ignored for the execution cache". Runscripts/generate-docs.py.
- The templates restore
cache-type: 'execution':templates/ci.yml:157, and an explicit value attemplates/publish.yml:89, each with a short comment on why. - Review M3. Once no template restores the full
_build, decide whetherbuild-jupyter-cachekeeps saving it: keep it, make it opt-in through a new input, or deprecate it for one release and then drop it. Whatever the choice, it goes in the CHANGELOG. - The docs. ARCHITECTURE's "Two caches" section and the restore chapter describe the templates restoring the execution cache, and when the build cache is still the right choice.
- The harness.
bjc-restore-execand the jobs that assert an execution key (.github/workflows/test-actions.yml:740,:772,:2515) take the new key.- The harness header's second constraint (
:29-33), that a genuine execution-cache miss can't be constructed, stops being true, because the fallback now carries the per-run salted environment hash. - Add an execution-cache restore with a changed
environmentfile, and assert that it misses. Againstmaintoday it restores the barejupyter-cache-fallback, so it fails, which shows that it can.
- CHANGELOG. Under Changed: the execution cache's key includes the environment, so a repository that already restores
executionmisses once after the release, until its next cache build. None does in production today. Also under Changed: the templates restore the execution cache.
Out of scope
- Changing
restore-jupyter-cache's default frombuildtoexecution. Without that, a caller who omitscache-typekeeps today's behaviour, with step 1's prune. It is a separate decision, best taken oncelecture-dpand the canary have run onexecutionfor a while. It would change what a caller with no inputs restores, so its CHANGELOG entry would need a⚠️ mark. - Moving
lecture-dpand the canary, a one-line edit each, made after the release.
The canary check, for the staged release
On a staging branch, switch the canary's ci.yml to cache-type: 'execution', and show:
- the restore reports an execution-cache hit, and the build executes only the lectures the pull request changed;
- a pull request that deletes a
_staticfile or a lecture gets a preview that returns 404 for it, while a control page returns 200; - a pull request that changes
environment.ymlmisses the execution cache and executes every lecture; cache.ymlsaves the execution cache under the new key.
Depends on #160's step 1, which ships first. Related: QuantEcon/workspace-lectures#41, the lecture repositories' interim prune and their cutover to these actions, which waits on #160.
Claude Code (on behalf of mmcky), drafted by the mini:actions-proposals session and filed by the organiser
Activity
fix(restore-jupyter-cache): remove the restored html after a build-ca…
fix(restore-jupyter-cache): remove the restored html after a build-ca…
fix(restore-jupyter-cache): remove the restored html after a build-ca…
fix(restore-jupyter-cache): remove the restored html after a build-ca…
mmcky commentedon Nov 7, 2026
Checked against
mainate40924a(v0.16.0) on 2026-11-07, after step 1 merged as #275. The design holds. The execution cache's key still hashes only the lectures and falls back to any execution cache (restore-jupyter-cache/action.yml:167-185), while the build cache's never falls back across anenvironmentchange (:186-209).build-jupyter-cachestill saves both caches (:426-438). Most cited lines have moved since9644f17: the templates' restore steps are now attemplates/ci.yml:157-162andtemplates/publish.yml:91-92, and the harness's execution-key assertions attest-actions.yml:753,:786and:2646.No QuantEcon repository restores
cache-type: execution.lecture-dprestores the default (build) inci.ymlandpublish.yml. The canary restoresbuildinci.yml.test-lecture-theme-sphinxsaves the caches but restores neither. A GitHub-wide code search found no caller outside QuantEcon. Measured sizes:lecture-dp's build cache is 91.6 MiB, against 15.7 MiB for its execution cache. The canary's is 6.3 MiB against 0.7 MiB, andlecture-python.myst's zipped_buildis about 300 MiB.Since step 1, the leftovers this issue removes are only in
_build/jupyterand_build/latex. They reach a site only through a workflow that buildsjupyterorpdflatexover a restored build cache and copies the output in, as the canary'sci.ymldoes.lecture-dpbuilds HTML only, so step 1 already fixed it.What the PR will do beyond the issue's list:
environmentfile, since without one the new fallback would not be salted;templates/cache.ymland four manual pages) that say the templates restore the build cache are brought in line.The maintainer's decisions, 2026-11-07: M3:⚠️ marker. Fallbacks: the execution cache's mirror the build cache's exactly, so they cross an
build-jupyter-cachekeeps saving the full_build, unchanged, sincerestore-jupyter-cache's default still restores it. CHANGELOG: Changed, with noenvironment-updatechange but never anenvironmentchange.restore-jupyter-cache's default staysbuild. Moving it, and with it retiring the full_buildsave or making it opt-in, is a later, separate decision, oncelecture-dpand the canary have run onexecutionfor a while.Claude Code (on behalf of mmcky), organiser session; the check by the mini:actions-cache session
docs: the migration note names the prune it means, and cache.yml's he…
feat(restore-jupyter-cache): the templates restore the execution cach…
Merge origin/main into fix/216-cloudflare-subdomain
Delete linear_equations and _static/qe-logo-large.png, for the v0.17.…
environment.yml: a comment, for the v0.17.0 staged release (not for m…