Skip to content

CI: prune the restored _build/html before building - #374

Merged
mmcky merged 1 commit into
mainfrom
prune-restored-html
Aug 18, 2026
Merged

CI: prune the restored _build/html before building#374
mmcky merged 1 commit into
mainfrom
prune-restored-html

Conversation

@mmcky

@mmcky mmcky commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Both ci.yml and publish.yml restore the cached _build artifact and build over it. Sphinx copies html_static_path into _build/html/_static but never prunes assets that have since been removed from source, so a file deleted from this repo keeps being published — in CI previews immediately, and on the live site until a clean weekly cache rebuild happens to intervene. This made deletion verification unreliable during the Track C migration: a reviewer looking at a preview cannot tell whether a deletion took effect.

This adds one step to both workflows, immediately after the cache restore and before the first build: jb clean . --html. Verified against the pinned jupyter-book 1.0.4.post1: --html removes exactly _build/html and nothing else — _build/.jupyter_cache, _build/latex and _build/jupyter are untouched, so the expensive notebook execution stays cached and the cost is one Sphinx write pass. Placement is load-bearing: the step must run before the PDF and notebook steps, which stage _pdf and _notebooks into _build/html.

No repo in the family has ever run jb clean in CI, so this PR's own CI run is the test: it should rebuild all pages from the pruned tree and come out green with a working Netlify preview.

Ports the prune from QuantEcon/workspace-lectures#41 — first repo of the nine in that issue's scope.

🤖 Generated with Claude Code

Both ci.yml and publish.yml restore the cached _build and build over it.
Sphinx never removes assets deleted from source, so deletions keep being
served — in CI previews immediately, on the live site until a clean weekly
rebuild happens to intervene.

Add jb clean . --html immediately after the cache restore in both
workflows. It removes exactly _build/html and nothing else; the
.jupyter_cache execution cache is untouched, so the cost is one Sphinx
write pass, not a re-execution. Placed before the PDF/notebook steps,
which stage their output into _build/html.

Ports the prune from QuantEcon/workspace-lectures#41.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 18, 2026 00:25
@netlify

netlify Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploy Preview for lustrous-melomakarona-3ee73e ready!

Name Link
🔨 Latest commit 8f47450
🔍 Latest deploy log https://app.netlify.com/projects/lustrous-melomakarona-3ee73e/deploys/6a83a6928ef54f00087bcdc7
😎 Deploy Preview https://deploy-preview-374--lustrous-melomakarona-3ee73e.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CI and publish GitHub Actions workflows to proactively remove the restored _build/html directory immediately after restoring the cached _build artifact, preventing stale HTML/static assets (from deleted source files) from being carried forward into previews and deployments.

Changes:

  • Add a post-cache-restore step to run jb clean . --html in CI before any build steps.
  • Add the same post-cache-restore jb clean . --html step in the publish workflow before PDF/notebook staging and HTML build.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/ci.yml Adds an early jb clean . --html step after restoring _build to prune stale HTML outputs before rebuilding and staging artifacts.
.github/workflows/publish.yml Adds the same HTML-pruning step after restoring _build to avoid publishing deleted/stale assets on GitHub Pages.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/ci.yml
Comment on lines +50 to +52
# assets. `jb clean . --html` removes exactly _build/html, leaving
# .jupyter_cache (the expensive execution cache), _build/latex and
# _build/jupyter untouched. Must run BEFORE the PDF/notebook steps below,
Comment on lines +68 to +70
# assets. `jb clean . --html` removes exactly _build/html, leaving
# .jupyter_cache (the expensive execution cache), _build/latex and
# _build/jupyter untouched. Must run BEFORE the PDF/notebook steps below,
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot temporarily deployed to pull request August 18, 2026 00:36 Inactive
@mmcky
mmcky merged commit 6ff5ab3 into main Aug 18, 2026
10 checks passed
@mmcky
mmcky deleted the prune-restored-html branch August 18, 2026 00:38
mmcky added a commit that referenced this pull request Aug 18, 2026
All three now serve from data-lectures: the repoint merged in #375 and
published in publish-2026aug18, whose notebooks and the .notebooks
mirror both carry the new URLs (verified by basename sweep — one
data-lectures read per notebook, zero refs/heads or loadmat residue).
fred_data.csv was the live runtime-fetch case, which is why deletion
waited for the publish.

Deletion-time re-derivation, 2026-08-18: a fresh authenticated Trees
sweep over all 278 org repos (278 covered, 0 skipped) finds no other
reader of these paths — every other holder of these basenames owns its
own copy (lecture-dp / lecture-dp.monorepo / 2026-tom-course for the
ACS file; lecture-tools-techniques / lecture-mapping /
python-lecture-sandpit.myst for the .mat, with tools-techniques
reading its own copy, tracked in QuantEcon/lecture-tools-techniques#11).

match_transport's lecture_specific directory empties with this change;
risk_aversion keeps its three figure PNGs. The published site keeps
serving the two _static copies until the next cache rebuild plus
publish, per the settle policy — the re-audit booked on
QuantEcon/workspace-lectures#40 verifies that; CI previews stop
serving them immediately now that the prune (#374) is in.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
mmcky added a commit to QuantEcon/lecture-python-programming that referenced this pull request Aug 18, 2026
Mirrors QuantEcon/lecture-python-advanced.myst#374 — second repo of the
nine in QuantEcon/workspace-lectures#41's scope.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants