Repository navigation
Description
From the 2026-10-06 codebase review (finding M1; record: .qe/dev/log/2026-10-06-codebase-review.md, #220).
Problem
Building the lectures runs code the repository does not fully control: notebook cells, including packages installed at build time, and network fetches. In templates/ci.yml that code runs in the same job, and the same container, as the later step that hands the Netlify (or Cloudflare) token to the deploy CLI (templates/ci.yml:77-96). Code that runs earlier in a job can affect the steps after it. So a compromised build dependency, on a pull request from a branch of the repository, shares a job with a long-lived deploy credential. Fork and Dependabot pull requests are not exposed: they get no secrets, and the preview actions skip them.
Separately, no template sets persist-credentials: false on actions/checkout (templates/ci.yml:46-47, templates/cache.yml:59-64, templates/publish.yml:55-60). The job token therefore stays available to build code for the whole job. This repository's own harness gate sets persist-credentials: false for that reason.
Proposal
- Set
persist-credentials: falseon the checkout in all three templates.cache.ymlandpublish.ymlrun only localgit logafterwards. - Split
ci.ymlinto two jobs:- Build: runs in the container with
contents: read, builds the site, and uploads_build/htmlas an artifact. - Deploy:
needs:the build job and needs no container. It holdspull-requests: writeand the provider secret, checks out withpersist-credentials: false, downloads the artifact, and runspreview-netlify(orpreview-cloudflare). It never runsjb buildor any repository script.
- Build: runs in the container with
- Keep change detection working.
scripts/detect-changed-lectures.shfetches the base and head commits after a depth-1 checkout. Confirm it still lists the changed lectures without persisted credentials (a public repository fetches anonymously), and state what a private repository needs. - Update the template comments,
docs/user/actions/preview-netlify.md,docs/user/actions/preview-cloudflare.mdandCHANGELOG.md.
Done when
- All three templates check out with
persist-credentials: false. templates/ci.ymldeploys the preview from a job that runs no repository code, and the preview comment still links the changed lectures.- The manual shows the two-job shape, and the harness's example check (
scripts/generate-docs.py --check-exampleswith actionlint) passes on the new template.
Related
- Instant placeholder PR comment + shared preview comment-script extraction (PLAN item 6) #153 plans a pull-request comment job that runs no repository code. The deploy job can host it.
- Ship containers/quantecon-preview: slim TeX-free preview image with pinned deploy CLI #151 bakes the deploy CLI into a preview image. Once the deploy runs in its own job, the build image no longer needs the CLI.
- preview-netlify, preview-cloudflare: deploy outside
pull_requeston request, and report whether anything was deployed #227 (preview deploys outsidepull_request, on request) and templates/ci.yml: a parallel PDF check that each site can switch off #230 (a PDF check job beside the preview intemplates/ci.yml) change the same preview path. Whichever lands later keeps the others working.
Activity
qe: record the outcome of the 2026-10-06 GitHub handover
qe: handover for the GitHub follow-ups of the 2026-10-06 review, and …
feat(templates): deploy the pull request preview from a job that runs…
feat(templates): deploy the pull request preview from a job that runs…
feat(templates): deploy the pull request preview from a job that runs…
feat(templates): deploy the pull request preview from a job that runs…
docs(manual): the cross-cutting chapters, and signposts for the templ…
ci: ci.yml, cache.yml and publish.yml as templates/ at v0, scheduled;…