Repository navigation
docs(manual): doc generator and drift checks, the chapter template, and the setup-environment chapter (#178 PR 2) - #204
Conversation
…nd the setup-environment chapter (#178 PR 2) Closes #189. - scripts/generate-docs.py (Python 3 + PyYAML) writes each chapter's Inputs and Outputs tables, each signpost README and the action table in docs/user/README.md from action.yml, between BEGIN GENERATED / END GENERATED markers. --check prints the diff and fails. - --check-examples reads every yaml block in docs/user and every template: each quantecon/actions step passes only declared inputs and every required one, each complete workflow sets permissions:, a block with jobs: but no on: is refused, and with --actionlint each complete workflow must pass actionlint. Doc blocks go to actionlint through -stdin-filename, padded, so its messages carry the chapter's path and line numbers. - The harness gate runs both, beside the template pin check: a docs-only PR skips every other job. PyYAML is pinned in scripts/requirements.txt (new Dependabot pip entry); actionlint 1.7.12 is a release download checked against its SHA-256. The gate's checkout no longer persists credentials, since it now runs repo scripts, and the generator and its requirements file join IGNORED. - docs/user/README.md (the manual's index), the setup-environment chapter, and docs/dev/CHAPTER-TEMPLATE.md. setup-environment/README.md is now a generated signpost. - setup-environment's action.yml descriptions are rewritten for the manual and corrected: conda-cache-hit is empty, not 'false', in container mode and on a miss; environment-name overrides the file's name: rather than having to match it; and bumping cache-version does not give a fresh environment, because restore-keys still restores the previous cache. QUICK-REFERENCE's advice to bump it now says so. - CONTRIBUTING, README, CHANGELOG, TESTING and PLAN point at the manual and the new checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FeKTxWtkzVMyPbqeSgM2Tb
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FeKTxWtkzVMyPbqeSgM2Tb
…vironment (#205) cache-version was in the exact cache key but in neither restore-keys fallback, and the first fallback matched the same environment file under any version. So a bump restored the previous version's environment and ran `conda env update` on it, never a fresh build. The previous commit's harness job shows it: the bumped key missed, fallback 1 restored env-seed's ...-v1 cache, and conda-cache-hit was 'false'. cache-version now comes before the Python version and the file hash, and the key has one fallback, which includes it: key: conda-<os>-<name>-<cache-version>-py<python>-<hash> fallback: conda-<os>-<name>-<cache-version>-py<python>- An edit to the environment file still restores the latest environment of the same version and updates it; a bump, a Python change or a name change restores nothing. The key format changes, so the first standard-mode run after the release builds from scratch once. No current consumer runs setup-environment in standard mode. - cache-version and conda-cache-hit descriptions, and the chapter's generated table, cache-key table and troubleshooting, follow. - QUICK-REFERENCE's advice to bump cache-version is right again, so #204's notes against it are reverted; only its key format changes. - CHANGELOG: a Fixed entry, and #204's Documentation entry no longer describes the old behaviour. TESTING's coverage row and PLAN follow. - The bjc-smoke comment no longer assumes @v0 shares the key format. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FeKTxWtkzVMyPbqeSgM2Tb
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It adds a 501-line generator and modifies the required harness gate with an external checksum-pinned actionlint download I cannot verify in this sandbox, so a human should confirm the gate passes before merge.
Review effort: Balanced
Findings: None
What changed in this PR
This is PR 2 of the QuantEcon Actions user manual (#178, closing #189). It introduces the documentation generator and CI drift/example checks, the chapter-writing template, and the first manual chapter (setup-environment). The manual's reference tables and signpost READMEs are generated from each action.yml so they cannot drift (the recurrence of #109), and every example workflow is checked against the real action inputs, for a permissions: block, and with actionlint — all wired into the harness gate job so that even docs-only PRs (which skip every gated job) are still verified.
Changes:
- New
scripts/generate-docs.py(+ pinned PyYAML inscripts/requirements.txt) that generates chapter Inputs/Outputs tables, signpost READMEs and the index action table betweenBEGIN/END GENERATEDmarkers, and validates YAML examples (inputs, required inputs,permissions:, and optional actionlint). - Rewrites
setup-environment/action.ymlinput/output descriptions for readers, correcting three factual errors (conda-cache-hitis empty—notfalse—in container mode/on a miss;environment-nameoverrides the file'sname:;cache-versionbumps do not force a fresh environment). - Adds the
setup-environmentchapter, index, chapter template, gate steps (venv PyYAML + checksum-pinned actionlint 1.7.12,persist-credentials: false), a Dependabotpipentry, and supporting doc/CHANGELOG updates.
| File | Description |
|---|---|
scripts/generate-docs.py |
New generator + example/drift/actionlint checker |
scripts/requirements.txt |
Pins PyYAML for the generator |
setup-environment/action.yml |
Reader-facing, corrected input/output descriptions |
setup-environment/README.md |
Reduced to a generated signpost |
docs/user/README.md |
New manual index with generated action table |
docs/user/actions/setup-environment.md |
First manual chapter (verified accurate vs. runs:) |
docs/dev/CHAPTER-TEMPLATE.md |
Template and rules for authoring chapters |
docs/QUICK-REFERENCE.md |
Corrects the cache-version guidance, links to chapter |
docs/dev/README.md, docs/dev/TESTING.md, docs/dev/PLAN.md |
Cross-links and status updates |
README.md, CONTRIBUTING.md, CHANGELOG.md |
Point docs workflow at the generated manual |
.github/workflows/test-actions.yml |
Gate runs the docs checks; adds actionlint/venv tooling; persist-credentials: false; extends IGNORED |
.github/dependabot.yml |
New pip ecosystem entry for scripts/ |
I verified: the three action.yml corrections against the actual composite steps; that build-lectures exposes a builder input and no action used in examples has required inputs; that the committed generated blocks (signpost, tables, index) exactly match the generator's output; that all cross-doc links resolve; and that the generator's node-based key access sidesteps the YAML on:→boolean pitfall. I found no objective defects to comment on.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…vironment (#205) cache-version was in the exact cache key but in neither restore-keys fallback, and the first fallback matched the same environment file under any version. So a bump restored the previous version's environment and ran `conda env update` on it, never a fresh build. The previous commit's harness job shows it: the bumped key missed, fallback 1 restored env-seed's ...-v1 cache, and conda-cache-hit was 'false'. cache-version now comes before the Python version and the file hash, and the key has one fallback, which includes it: key: conda-<os>-<name>-<cache-version>-py<python>-<hash> fallback: conda-<os>-<name>-<cache-version>-py<python>- An edit to the environment file still restores the latest environment of the same version and updates it; a bump, a Python change or a name change restores nothing. The key format changes, so the first standard-mode run after the release builds from scratch once. No current consumer runs setup-environment in standard mode. - cache-version and conda-cache-hit descriptions, and the chapter's generated table, cache-key table and troubleshooting, follow. - QUICK-REFERENCE's advice to bump cache-version is right again, so #204's notes against it are reverted; only its key format changes. - CHANGELOG: a Fixed entry, and #204's Documentation entry no longer describes the old behaviour. TESTING's coverage row and PLAN follow. - The bjc-smoke comment no longer assumes @v0 shares the key format. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FeKTxWtkzVMyPbqeSgM2Tb
…vironment (#205) (#206) * test(setup-environment): a cache-version bump must build a fresh environment (#205) A new harness job, env-version-bump, runs after env-seed on the same salted fixture with a salted cache-version, and asserts that conda-cache-hit is empty: nothing restored. On the current key layout it fails by design. Fallback 1, conda-<os>-<name>-py<ver>-<hash>-, omits cache-version, so it restores env-seed's cache and the output is 'false'. The fix follows in the next commit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FeKTxWtkzVMyPbqeSgM2Tb * fix(setup-environment): bumping cache-version builds a fresh Conda environment (#205) cache-version was in the exact cache key but in neither restore-keys fallback, and the first fallback matched the same environment file under any version. So a bump restored the previous version's environment and ran `conda env update` on it, never a fresh build. The previous commit's harness job shows it: the bumped key missed, fallback 1 restored env-seed's ...-v1 cache, and conda-cache-hit was 'false'. cache-version now comes before the Python version and the file hash, and the key has one fallback, which includes it: key: conda-<os>-<name>-<cache-version>-py<python>-<hash> fallback: conda-<os>-<name>-<cache-version>-py<python>- An edit to the environment file still restores the latest environment of the same version and updates it; a bump, a Python change or a name change restores nothing. The key format changes, so the first standard-mode run after the release builds from scratch once. No current consumer runs setup-environment in standard mode. - cache-version and conda-cache-hit descriptions, and the chapter's generated table, cache-key table and troubleshooting, follow. - QUICK-REFERENCE's advice to bump cache-version is right again, so #204's notes against it are reverted; only its key format changes. - CHANGELOG: a Fixed entry, and #204's Documentation entry no longer describes the old behaviour. TESTING's coverage row and PLAN follow. - The bjc-smoke comment no longer assumes @v0 shares the key format. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FeKTxWtkzVMyPbqeSgM2Tb --------- Co-authored-by: Claude <[email protected]>
Closes #189. PR 2 of the user manual (#178), built to decisions 3 and 5.
What's in it
scripts/generate-docs.py(Python 3 + PyYAML)action.yml, between<!-- BEGIN GENERATED: … -->and<!-- END GENERATED -->markers:docs/user/README.md.--checkprints the diff and fails. It also fails on broken markers: a missingEND, an unknown or duplicated block, or a missing required block.${{/<outside backticks in a description.--check-examplesreads everyyamlblock underdocs/userand everytemplates/*.yml. It fails when:quantecon/actions/<x>@…step passes an input itsaction.ymldoesn't declare, or leaves out a required one;on:+jobs:) has nopermissions:, either at the top or on every job;jobs:but noon:. Such a block is neither complete nor a fragment, and would otherwise escape the lint.With
--actionlint, each complete workflow is linted. Doc blocks are passed through-stdin-filenamewith padding, so actionlint's messages point at the chapter's real path and line.Harness gate. Three new steps sit beside the template pin-drift check, because a docs-only PR skips every other job:
scripts/requirements.txtand installed into a venv, since the runner's Python is externally managed. A new Dependabotpipentry keeps it current.persist-credentials: false, since the gate now runs repo scripts and needs no git credentials.IGNOREDgains the generator and its requirements file: no gated job uses them, and the gate's own checks are their test. The self-test samplesscripts/generate-docs.py.Docs
docs/user/README.md: the manual's index. It carries the audience and 0.x note (decision 1), the version note (decision 7), and the generated action table.docs/user/actions/setup-environment.md: the first chapter. It absorbs the old README. It covers both modes, requirements, a minimal container example and a standard-runner example (both complete, linted workflows), the delta file, links to the templates, behaviour (cache keys and what fails the job), running on your own host (the GPU AMI), and troubleshooting keyed to the action's messages.setup-environment/README.md: now a generated signpost.docs/dev/CHAPTER-TEMPLATE.md: the chapter template. It holds the rules, what the gate checks, how to run it locally, and a skeleton. It sits indocs/devso it stays out of the published manual and out of the example checks.Corrections to
setup-environment/action.ymlDecision 5.1 makes the descriptions the single source, so they are rewritten for readers. Checking them against the code found three that were wrong:
conda-cache-hitsaid "always false in container mode". It is actually empty there, because the cache step is skipped. It is also empty on a cache miss, and'false'only on arestore-keysmatch; that is whatactions/cachev6'srestoreImpl.tsdoes.environment-namesaid it "must match name in environment.yml". In factconda env update -noverrides the file'sname:.cache-versionsaid "bump to force a rebuild". It doesn't: therestore-keysprefixes don't include it, so a bump still restores the previous environment, andconda env update --prunethen adjusts it. The description, the chapter and QUICK-REFERENCE's two "bumpcache-version" tips now say this. The chapter gives the real fix: delete theconda-caches.This PR changes no behaviour. If a bump should give a fresh environment,
cache-versionwould need to go into the restore-keys. That is an action change for its own issue.Testing
Run locally with PyYAML 6.0.3, actionlint v1.7.12 built from source, and shellcheck 0.11.0:
python3 scripts/generate-docs.py --check --check-examples --actionlint …passes: 3 generated files are current, 16quantecon/actionssteps and 6 complete workflows are checked, and actionlint is clean.action.ymledit, and a hand-edited signpost;templates/ci.yml;permissions:, and a block withjobs:but noon:;uses:with no@ref, an action that doesn't exist, and a YAML parse error;ENDmarker, an unknown block, and a removed block;<…>outside backticks, a chapter with no action, and an action missing fromORDER.--checkthen passes.IGNOREDself-test, re-run locally, still passes. This PR's own non-ignored files aretest-actions.ymlandsetup-environment/action.yml, so the full harness runs.aquaproj/aquaandsuzuki-shunsuke/pinact, which agree. The gate'ssha256sum --checkis the first real verification against the GitHub release. If it fails, it fails closed.🤖 Generated with Claude Code
https://claude.ai/code/session_01FeKTxWtkzVMyPbqeSgM2Tb
Generated by Claude Code