Repository navigation
fix(actions): #107 correctness batch and #109 code items - #173
Conversation
setup-environment (#107) - Container-mode delta update now targets the environment that is actually active: the sys.prefix of the python on PATH, via conda env update -p, and fails with diagnostics if that prefix has no conda-meta. Previously conda took the target from the file's own name:, so a delta saying `name: lecture-python` silently created envs/lecture-python (not on PATH) and the build failed later on an import. -n <environment-name> (the issue's proposal) is not used: on a container-mode host whose stack lives in base (docs/GPU-AMI-SETUP.md) it would silently create a fresh envs/quantecon, since conda env update creates missing prefixes. A ::warning:: names any disagreement between the file's name: or environment-name and the active env. No --prune (it would strip the image env down to the delta). Inputs move to env:. - LaTeX requirements are parsed with sed/tr into a mapfile array: inline and indented comments, CRLF and several packages per line all work, and each name is its own quoted apt-get argument. A file with no package names is an explicit ::error:: (deliberately not the issue's warn-and-skip: it is a misconfiguration, and skipping defers the failure to a missing-TeX error). - The environment summary lists "$CONDA/envs/<name>/bin/python -m pip list" (falling back to conda list -n, never failing) in standard mode, where the plain-bash step otherwise reported the runner's default Python. Container mode is unchanged. build-lectures (#107) - The failure banner prints the artifact name actually uploaded (the upload step's own expression, computed once in env:) and the real reports directory (_build/latex/reports for pdflatex), derived like the upload step's path list. The upload step's name: is unchanged. build-jupyter-cache (#107, #109) - builders is split on commas and any whitespace (newlines included), empty tokens skipped, and each token exact-matched against jupyter|pdflatex|html with one ::error:: per unknown token. 'html,pdf' and 'nojupyter' now fail before setup instead of building html only / enabling jupyter. Validate and parse are one step; the run-* outputs and install-latex keep working. - New latex-requirements-file input (default latex-requirements.txt, not '', because the runner passes an explicit '' through to the callee) passed to setup-environment; standard mode with pdflatex only. - README: new input row; upload-artifact row and flow diagram now say the _build artifact uploads only when a build fails. publish-gh-pages (#107, #109) - Remove the asset-url output: it was bound to an output softprops/action-gh-release never sets, so it was always empty. Not repointed: an unguarded fromJSON on a skipped step would error. - cname still writes the CNAME file (it also lands in the release archive) but warns that the Actions Pages deploy ignores CNAME files and the domain must be set in Settings -> Pages; the value reaches the shell via env:. README row and custom-domain sections updated to match. scripts/detect-changed-lectures.sh (#107) - git diff --no-renames, so a renamed lecture decomposes into D + A and the A half gets a preview link instead of being dropped as R<score>. Harness (.github/workflows/test-actions.yml) - bjc-builders-parse: marks the runner as a container-mode host (the same /etc/quantecon-container marker a GPU AMI carries) so setup-environment@v0 is a no-op and each enabled build fails in seconds on a missing source-dir; per-builder statuses then show exactly what was parsed. Two controls ('jupyter,pdflatex,html' and a two-line block value) must attempt exactly their builders; 'html,pdf' and 'nojupyter' must abort with no builder run, which the old substring parser would not have done. - env-container-update: in ghcr.io/quantecon/quantecon-build:latest, applies a delta whose name: is wrong-name and asserts the pinned pip package is importable by the python on PATH, no envs/wrong-name appeared, and the image's packages survived. - The gate checks every third-party uses: pin in templates/*.yml against .github/workflows/ (Dependabot cannot see templates/), failing with one ::error:: per mismatch. It lives in the always-running gate because templates-only PRs match IGNORED. A Dependabot major bump of such an action now goes red until the templates move in the same PR. - Both new jobs are gated and listed in harness-summary's needs. CHANGELOG: entries under Added / Changed / Removed / Fixed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh
…tom domain Review follow-up. The Features bullet and the "With Custom Domain" example still implied the cname input configures the domain, which the rest of the README (and the new ::warning::) now says it does not. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It makes many non-trivial behavior changes to critical CI shell logic, container-mode setup, and a new cross-PR gating check whose runtime effects and staged-release implications warrant human verification.
Review effort: Balanced
Findings: None
What changed in this PR
This PR is a batch of correctness fixes addressing the seven open items of issue #107 and the three code items of #109 across the QuantEcon reusable GitHub Actions. The changes harden shell logic that had subtle failure modes (wrong-environment updates, fragile input parsing, misleading failure banners) and add substantial harness coverage plus a template pin-drift guard. It fits into the repo's v0.x maintenance-audit effort (tracking issue #110).
Changes:
setup-environment: container-modeconda env updatenow targets the active prefix (-p "$(python -c 'print(sys.prefix)')") instead of resolving from the delta file'sname:, with diagnostics/warnings on mismatch; robust LaTeX-requirements parsing (inline#, CRLF, multiple packages/line, empty→::error::); standard-mode summary now lists the conda env's own interpreter.build-jupyter-cache/build-lectures/publish-gh-pages: exact-tokenbuildersparsing (unknown tokens error), newlatex-requirements-filepassthrough, failure banner honoursfailure-artifact-nameand the correct_build/latexreports path,cnamenow emits a no-effect::warning::, deadasset-urloutput removed.- Harness + script: two new harness jobs (
env-container-update,bjc-builders-parse), a gate-level template pin-drift check, and--no-renamesindetect-changed-lectures.sh.
| File | Description |
|---|---|
setup-environment/action.yml |
Container-mode delta targets active prefix; robust LaTeX parsing; standard-mode summary uses env interpreter; inputs via env: |
setup-environment/README.md |
Documents latex-requirements-file parsing/validation rules |
build-jupyter-cache/action.yml |
Single exact-token validate+parse step; new latex-requirements-file input passthrough |
build-jupyter-cache/README.md |
Documents new input; corrects failure-only artifact upload in row and flow diagram |
build-lectures/action.yml |
Failure banner computes artifact name and reports dir to match the upload step |
publish-gh-pages/action.yml |
Removes dead asset-url output; cname warns it has no deploy effect; values via env: |
publish-gh-pages/README.md |
Custom-domain docs point to Settings → Pages; drops asset-url row |
scripts/detect-changed-lectures.sh |
git diff --no-renames so renamed lectures get preview links |
.github/workflows/test-actions.yml |
New container + builder-parse harness jobs; gate template pin-drift check |
CHANGELOG.md |
Added/Changed/Removed/Fixed entries for the above |
During review I verified: the referenced composite outputs (jupyter-status/pdflatex-status/html-status, container-mode, all-passed with always()) exist; the failure-banner expressions match the upload step verbatim; the removed asset-url output has no consumers; the pin-drift check currently passes (templates only pin actions/checkout@v7, matching the workflows); and the quantecon-build image's active env is quantecon (so the default environment-name won't emit spurious mismatch warnings). I did not find any concrete defects to comment on.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…s-fixes # Conflicts: # CHANGELOG.md
…s-fixes # Conflicts: # CHANGELOG.md
…with the shipped code (#106, #109, #99) (#175) * docs: sweep to the 2026.06 baseline and measured image sizes (#106) Both images ship anaconda=2026.06 (containers/quantecon/environment.yml:11; the lean image carries the matching pin set), but seven sites still said 2025.12. They now say 2026.06. Image sizes were a mix of round "~8GB / ~3GB" figures, a "~60% smaller" claim, and an older measured pair. Every size site now carries the pair the fixed size job (#172) produced on 2026-09-23, run 35856865426 (Docker 28.0.4, overlay2, ubuntu-latest), and says which metric it is: - quantecon (full): 3.33 GB compressed (what a cold pull downloads), 8.60 GB on disk - quantecon-build (lean): 2.93 GB compressed, 7.33 GB on disk The lean image is about 12% smaller to pull and 15% smaller on disk, so the "faster CI pulls" / "fast image pulls" wording becomes "a modestly smaller pull", and the lean README's unmeasured pull-time and package-count rows go. "Minimal TexLive" was false. The two Dockerfiles' apt lists differ in exactly two packages: the lean image drops texlive-luatex and adds graphviz; texlive-latex-extra and texlive-fonts-extra are in both. The docs now say so, and name what actually distinguishes the lean image: no anaconda metapackage, an explicit package list pinned to the 2026.06 baseline. The full image's "Complete TexLive installation" is corrected to match. CHANGELOG history and PLAN.md:68's narration of the old date-pin keep their 2025.12 mentions on purpose. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh * docs: reconcile READMEs, guides and templates with the shipped code (#109, #99) The docs half of #109, with #99 folded in. The code items (the build-jupyter-cache latex-requirements-file passthrough, the cname warning and the template pin-drift check) ride with #107's PR. Examples that failed for adopters: - permissions: the preview-netlify and preview-cloudflare "Complete Workflow Example" blocks declared none, and the root README and QUICK-REFERENCE container quick starts declared contents/packages only. Both preview actions list, create and update PR comments through github.rest.issues.* with github.token, so each block now grants contents: read and pull-requests: write. - actions/checkout: the remaining 29 @v4 and 2 @v5 references across 13 docs move to @v7, matching the templates (#168) and this repo's workflows. with: fetch-depth lines are kept. Documented behaviour that does not exist: - QUICK-REFERENCE: the "Preview with Custom URL" recipe passed an alias input preview-netlify does not accept (the alias is fixed at pr-N); it becomes a short "Preview URL" note. The setup-environment key row now carries the environment-name and python-version segments and the cached path. The sample log block's "LaTeX cache hit" line (no LaTeX caching exists) and its other invented lines are replaced by strings the actions actually print. The "Pages 404?" snippet recommended contents: write, which as a permissions block would also drop pages and id-token; it now lists pages: write and id-token: write, with contents: write only for create-release-assets (#99). - MIGRATION-GUIDE: the collab.yml snippet passed build-html and cache-workflow, which build-lectures never accepted; it now restores the cache with restore-jupyter-cache and builds with builder/source-dir. The copied commit message no longer claims LaTeX caching, and the build-jupyter-cache key carries its update-hash segment here and in ARCHITECTURE (#99). - build-lectures README: "use setup-latex" pointed at a removed action; the inputs table gains the missing failure-artifact-name row. - README and ARCHITECTURE said restore-jupyter-cache "never saves"; it is read-only by default with an optional PR-scoped save-cache. - setup-environment README: the cache key and path now match action.yml. Templates and the custom domain: - The Actions Pages deploy ignores a CNAME file, so the cname input has no effect. templates/publish.yml, templates/README.md, MIGRATION-GUIDE and QUICK-REFERENCE now point at Settings -> Pages instead of offering cname. - templates/publish.yml's release-asset block now says it needs a tag trigger (the file runs on pushes to main and manual dispatch) and contents: write (the job grants contents: read). - New templates/latex-requirements.txt: the TeX packages the two images share, in the whole-line-comment format setup-environment parses. The cache.yml standard-runner comment and templates/README point at it, since a standard-runner pdflatex build fails without the file. - cache.yml and templates/README describe the _build artifact as failure-only, which it has been since v0.8.0. Smaller items: the lean image README's last @main example moves to @v0; the full image README's theme version reads 0.21.0, the environment.yml pin. README's Contributing section now points at CONTRIBUTING.md, which tests by branch and moves v0; CONTRIBUTING gains the staged-release procedure decided on #110 (decision 4), its known limits and the rollback. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh * docs: bring PLAN.md, CONTRIBUTING and the CHANGELOG up to date (#106, #109) PLAN.md: - The consumers table said five lecture repos were pinned to v0.8.0 or v0.9.0. Dependabot bumped all six exact call sites to v0.11.1 between 2026-08-12 and 2026-08-24 (#110's 2026-09-23 revalidation; the pins are confirmed by code search). The rows, the "Corrected" note and the lecture-jax rollout row now say so; the section keeps its structure. - The August triage table already had rows for the issues #106 lists, except #135. Each row is refreshed to its state on 2026-09-23 (all are open; the open PRs #144, #170, #171 and #172 and the in-progress #105 and #107 work are named), and #135 gets a row. No rows are duplicated. - Item 10's "propagate corrected container-size figures" half is marked done by this sweep; the trim itself stays open as its own PR (decision 1 on #110). - The "Last updated" line records this pass. CONTRIBUTING.md: the doc-update matrix gains a PLAN.md row, so a backlog item or consumer ref that moves updates the plan rather than waiting for the next audit. CHANGELOG.md: one [Unreleased] Documentation entry for the sweep. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh * docs: address review of the #106/#109 docs sweep - templates/latex-requirements.txt: describe the file format so it holds under both the current parse (grep -v '^#') and #173's, where '#' starts a comment anywhere. Drop the claim that an inline '#' reaches apt-get. - templates/publish.yml: the release-asset note lists a third change, the tag pattern under the github-pages environment's deployment branches and tags, which otherwise reject a tag-triggered run. - CONTRIBUTING.md: the staged-release limits say that steps 2-3 run neither publish-gh-pages (the canary's publish.yml fires only on a publish* tag) nor setup-environment at the candidate ref, replacing the narrower release-asset bullet. - PLAN.md: #172 is marked open with the run the sizes come from; #144 needs a rebase before review. - CHANGELOG.md: the 2026.06 baseline is the full image's metapackage and the lean image's pin set, not something both images ship. - containers/README.md: the lean image carries the pinned science stack, so "Jupyter Book build tools only" loses "only". Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh * docs: address the second review round of the #106/#109 sweep - Four more job examples call preview-netlify without a permissions block (MIGRATION-GUIDE's preview job, QUICK-REFERENCE's standard CI workflow, both ARCHITECTURE workflows). Each now grants contents: read and pull-requests: write (plus packages: read where it pulls the image), so the CHANGELOG line saying preview examples grant pull-requests: write is true of every one. - README's publish-gh-pages feature line no longer lists custom-domain support first; custom domains are set in Settings -> Pages. - MIGRATION-GUIDE's sample commit message says "conda environment caching": there is no separate pip cache. - PLAN.md's #105 and #107 rows cite the now-open #174 (draft) and #173. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh * docs(templates): list make in the example latex-requirements.txt Copilot review on #175. The header says the file lists the TeX packages and build tools both images install, but omitted make, which both Dockerfiles install under "Build tools". It is needed, not incidental: jupyter-book 1.0.4.post1's pdflatex builder runs `make all-pdf` in the LaTeX output directory (jupyter_book/cli/main.py). Hosted Ubuntu runners ship make already, so on them this is a no-op install; on a minimal runner it is the difference between a PDF and a failed build. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh * docs(plan): #170 has merged Refresh the #105 disposition row now that the README warning is on main. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh * docs(containers): theme version is now 0.22.0 #162 moved both images to quantecon-book-theme 0.22.0 (full pins ==0.22.0, lean >=0.22.0) after this sweep set the full image's README to 0.21.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh * docs: add the .fr consumer row and refresh the current-release lines (#106, #109) lecture-python-programming.fr exact-pins preview-netlify and publish-gh-pages (with create-release-assets) at v0.11.1, moved there from v0.8.0 by Dependabot on 2026-09-23, so it joins the consumers table and the exact-pin count becomes eight call sites across six repos. README.md and copilot-instructions.md said the current release was v0.8.0; it is v0.11.1. Co-Authored-By: Claude Fable 5.1 <[email protected]> * docs(plan): carry the .fr row into the consumer counts d1b8fb1 added lecture-python-programming.fr (two exact @v0.11.1 call sites, including publish-gh-pages). Two counts elsewhere in PLAN.md still predated it: the Last-updated line said all six exact pins, and the lecture-progress note had publish-gh-pages at 7/7 with five exact. They now read eight pins across six repos, and 8/8 with six exact. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh * docs: lean image is 7.32 GB on disk after the #162 rebuild The first size report on main (run 35930060129, after #162 rebuilt both images with quantecon-book-theme 0.22.0) reads full 3.33 GB compressed / 8.60 GB on disk, unchanged, and lean 2.93 GB / 7.32 GB: the lean on-disk figure dropped by about 5 MB, enough to move the second decimal. The eleven sites that quoted 7.33 now say 7.32, and PLAN.md's #106 row cites that main run instead of the earlier branch dispatch. The ~15% (on disk) and ~12% (compressed) gaps still hold. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Matt McKay <[email protected]>
…4xxo7v Resolves the two conflicts with main after #173 and #175 landed: the copilot-instructions status block keeps main's refreshed release and container lines with this branch's "8 composite actions" line, and the CHANGELOG's [Unreleased] Added section carries both sets of entries. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This PR covers the seven open #107 items and #109's three code items (
latex-requirements-filepassthrough,cnamewarning, template pin-drift check). Several fixes differ from the issues' sketches, because those would misfire as written; the corrections are recorded in #110 under Found in the 2026-09-23 revalidation.Changes
setup-environmentenvironment-update. The update now targets the environment that is actually active (conda env update -p "$(python -c 'import sys; print(sys.prefix)')"), not-n "$ENV_NAME".-nwould silently create a freshenvs/quanteconon a host whose stack is inbase, such as the GPU AMI. The step fails with diagnostics if that prefix is not a conda env. It warns when the file'sname:orenvironment-namedisagrees with the active env. There is no--prune, and inputs come in throughenv:.::error::naming the file, not the silent death it was. This deliberately departs from fix(actions): batch of small correctness fixes across the seven actions #107's "warn-and-skip":install-latex: truewith no packages is a misconfiguration, and skipping would only defer it to a harder-to-read missing-TeX failure. A comment-only file was already red before this change.conda list -n, and never fails the step.build-lecturesfailure-artifact-nameis honoured. It also prints the right reports directory:_build/latex/reportsfor pdflatex.build-jupyter-cachebuildersparsing. Input is split on commas and whitespace, then trimmed, with empty tokens skipped. Each token must exactly matchhtml,pdflatexorjupyter, and each unknown token gets its own::error::.html,jupyter,html,jupyter,pdflatex,html,html, pdflatex,html,,html pdflatex, and block values.html,pdf(built HTML only before) andnojupyter(ran jupyter before).html.latex-requirements-file, passed through tosetup-environment. It defaults tolatex-requirements.txt, not'': the runner passes an explicit''through instead of applying the callee's default.upload-artifactrow and the flow diagram now say the_buildartifact uploads only on failure.publish-gh-pagesasset-urloutput removed. It was bound to an outputsoftprops/action-gh-releasenever sets, so it was always empty. No consumer reads it (PLAN item 7).cname. The input still writesCNAME, but now emits a::warning::that it has no effect on the Actions Pages deploy; the domain is set in Settings → Pages.cnameis passed throughenv:instead of shell interpolation. The README now says the same everywhere.scripts/detect-changed-lectures.shgit diff --no-renames, so a renamed lecture gets its preview link.Harness (
test-actions.yml)bjc-builders-parse. Cheap builder-parse cases that fail against the old code; I tested that directly.setup-environment@v0is a no-op, and uses a missing source dir so builds fail in seconds. After that, the per-builder statuses show exactly what was parsed.jupyter,pdflatex,html, and a block value with a trailing comma.html,pdfandnojupytermust abort in the parse.env-container-update. The harness's firstcontainer:job, onquantecon-build:latest. It runsuses: ./setup-environmentwith a delta file namedwrong-namethat installscowsayvia pip. It then asserts thatcowsayimports with the Python onPATH, that noenvs/wrong-nameexists, and that the stack was not pruned.gatejob. Every third-partyuses:intemplates/*.ymlmust match the ref used in.github/workflows/.gatebecause template-only PRs match the IGNORED regex and skip every other job.CHANGELOG.md: entries under Added, Changed, Removed and Fixed.Validation
quantecon-buildcontainer job, so the conda ToS question underHOME=/github/homeis settled.test-actions.yml:102. shellcheck is clean on every changedrun:block.run:block was extracted and executed underbash --noprofile --norc -eo pipefail, with stubbed python, conda, apt and git. That covers the green, red and edge cases listed above, plus base-env and symlinked-base hosts, spaces in paths, and conda failures passing through.main's own code.html,pdfparses to HTML only,nojupyterenables jupyter, an inline LaTeX comment sends#,for,unicodeandmathto apt, and a comment-only file dies with no message.cnamewording in thepublish-gh-pagesREADME, is fixed in b52c013.Release note
Per decision 4 on #110, the release carrying this is staged:
v0move.ci.ymlPR against it.cache.ymldispatch against it, which exercises the builder parse.v0only when both are green.Two limits apply.
build-jupyter-cachecallssetup-environment@v0, so thesetup-environmentfixes reach that chain only whenv0moves. The canary never setscreate-release-assets, so thepublish-gh-pageschanges go unexercised there.Closes the remaining #107 checklist items and #109's code items. PLAN items 7 and 15 (the pdflatex reports path half). Tracking: #110.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DwQrz9VbFrbAD7uh2LTgzh