Repository navigation
ci(canary-watch): watch the canary's scheduled workflows from here (#302) - #328
Conversation
) canary-watch.yml runs daily and reads the canary's workflows through the API, with scripts/canary-watch.sh. A workflow that is not active, whose newest completed scheduled run on main is missing, more than 192 hours old or not a success, turns it red. On the schedule, a red verdict opens one issue labelled canary, or comments on the open one when the red findings change, assigned to the logins in the CANARY_ASSIGNEES variable. A disabled workflow's finding gives the gh workflow enable command. The harness's canary-watch job runs the script's self-test, against a stand-in gh, and the gate's must-run list now holds the script. Part of #302. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMaEFAot565L8kcyAcz
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
Approval is blocked because the workflow watcher may fail due to missing required actions: read token permission, and the reporting script can crash under set -u when optional ASSIGNEES is unset.
2 open issues
What changed in this PR
Adds a “canary watcher” workflow to this repository so scheduled runs in the canary repo (QuantEcon/test-actions-lecture-intro) are monitored and can still be reported even if the canary’s schedules get disabled for inactivity.
Changes:
- Introduces a daily + manual
canary-watchworkflow that summarizes canary workflow health and (on scheduled runs) can file/update a tracking issue on red findings. - Adds
scripts/canary-watch.shto query workflow state and the latest completed scheduled run via the GitHub API (gh api), with--reportand--self-testmodes. - Extends the main harness workflow and developer testing docs to include and explain the new watcher and its self-test.
| File | Description |
|---|---|
| scripts/canary-watch.sh | Adds a bash watcher/reporting script that queries canary workflow state and latest scheduled runs via gh api, emits a verdict, and supports --report and --self-test modes. |
| docs/dev/TESTING.md | Updates developer testing documentation to describe the new canary watcher workflow, its harness self-test, and how filed failure issues work. |
| .github/workflows/test-actions.yml | Adds a canary-watch job to run the watcher script self-test and wires it into the harness gating and summary dependencies. |
| .github/workflows/canary-watch.yml | Introduces a scheduled + manual workflow that runs the watcher daily, writes a run summary verdict, and on scheduled reds triggers reporting to GitHub Issues. |
Review effort: Balanced
| timeout-minutes: 5 | ||
| permissions: | ||
| contents: read # checkout; the canary is public, so reading it needs no grant | ||
| outputs: |
There was a problem hiding this comment.
No change. actions: read scopes GITHUB_TOKEN to this repository's own Actions, but the watcher reads another repository, the canary, which is public. Reading a public repository's workflows and runs needs no grant on this token.
The throwaway run that the PR body cites shows it: 43772930015. Its jobs had permissions: contents: read only. They read the canary's cache.yml state and its newest scheduled run, which was green. They also read QuantEcon/lecture-stats' disabled_inactivity state, red as meant. Neither got "Resource not accessible by integration". The job's comment says why: "the canary is public, so reading it needs no grant".
Claude Code (on behalf of mmcky)
| local issue=$1 login logins | ||
| read -ra logins <<< "${ASSIGNEES//,/ }" |
There was a problem hiding this comment.
Fixed in 2b57fae. assign() now reads ASSIGNEES through a local with a default, so an unset variable gets the same warning as an empty one, and the report carries on unassigned. The self-test gains the case. Without the fix, it failed on the runner's bash 5.3 with "ASSIGNEES: unbound variable", in a throwaway run. The local self-test had passed because bash 3.2 does not stop on an unset variable inside ${X//,/ }. canary-watch.yml always sets the variable, possibly empty, so the scheduled watcher was not affected.
Claude Code (on behalf of mmcky)
…eport ASSIGNEES is optional, but assign() expanded it under set -u with no default, so on bash 5 a report run without it stopped at once. The self-test gains the case: run without the fix on the runner's bash 5.3, it failed with "ASSIGNEES: unbound variable". bash 3.2 does not stop there, which is why the local self-test passed. Copilot's review. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMaEFAot565L8kcyAcz
…he bot's markers count Three findings from the independent review, each reproduced against the unmodified script: - A red that cleared and came back with the same text went unnotified: the dedupe compared with the issue's last marker, and a green run never touched the issue. Every scheduled run now reports, and a green one records a `green` marker, once, on the open issue, so the same red after it comments again, as "red again". - Markers were read from any comment, and anyone can comment on a public repository's issue. They are now read through the REST API from the issue's body and comments by github-actions[bot] only. - A watcher that stopped before its verdict hashed the run's URL, so it commented every day. Its finding is now fixed text, and the run's link sits outside the hash. And a stale run's finding now says "no scheduled run has completed since" and points at a run that is queued or stuck, since a run that never completes is not listed. The self-test now reports every failing case, not only the first. Part of #302. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMaEFAot565L8kcyAcz
… linkcheck.yml removed (#94) For QuantEcon/actions#302 and QuantEcon/actions#310, as the maintainer ruled on 2026-11-15. This is PR B of three. PR A, QuantEcon/actions#328, adds the watcher there that reads this repository's scheduled runs. PR C adds the watcher's weekly drift check against `templates/` at `v0`, and the docs. > [!NOTE] > **Decided.** The maintainer ruled on the table's three questions on 2026-11-15: row 1 "Keep lean", row 2 "Adopt execution cache", row 3 "Switch it on". The `github-pages` environment now admits `publish*` tags, to match `publish.yml`. All three staged runs and a restore have run. ## Why This repository's `ci.yml`, `cache.yml` and `publish.yml` had drifted from QuantEcon/actions' `templates/`. A change to a template therefore reached no real run until a consumer copied it (#310). Only `cache.yml` ran on a schedule. `ci.yml` and `publish.yml` ran on pull requests and tags only, so between releases nothing ran the preview and publish paths through `@v0` as consumers fetch them (#302). And `ci.yml` could not simply be scheduled. It saves its build cache on every run, so a run on `main` would save a cache that every pull request then restores. After this PR each file is the template at `v0` (f7e98be, v0.20.1), with the differences in the table below. `ci.yml` and `publish.yml` run weekly and by hand, and fail unless what they deployed is served. `restore.yml` was already the template, byte for byte. `linkcheck.yml` is removed. ## Keep or adopt Each row is a difference from `templates/` at `v0`, or a choice this PR makes. **Question** marks the rows for the maintainer. The rest follow from the rulings, or have no real alternative. | | Difference | This PR | Why | Question? | |---|---|---|---|---| | 1 | The image | **Keep the lean `quantecon-build:latest`** in every job, where the templates ship the full `quantecon:latest` | The release gate pins the lean image, and lecture-dp and test-lecture-theme-sphinx use it. The full one is the lecture matrix's, which builds four lecture repositories in both images every Monday. Adopting the full image would make the canary the only scheduled run of the templates' image, at the cost of the lean one | **Decided: keep lean** | | 2 | The cache `ci.yml` restores | **Adopt the template's execution cache** (`_build/.jupyter_cache`), where the canary restored the build cache (the whole `_build`) | It is the template's restore, and the point of #310. The gate covers the build-cache restore at every release, in its `publish-site` job. The cost: that job's comment, `gate.yml:393` ("As the canary's ci.yml builds: the build cache"), goes out of date, and `gate.yml` is not to be changed now. TESTING.md's line on it is reworded in PR C | **Decided: adopt the execution cache.** TESTING.md's line is reworded in PR C, and `gate.yml:393` stays until `gate.yml` next changes | | 3 | The release-assets job in `publish.yml` | **Adopt, switched on**, as the template's four documented changes describe. The asset name is `test-actions-lecture-intro-html` | Every lecture repository publishes on a `publish*` tag with release assets. Nothing ran the template's version of this job, and `restore.yml` restores from those releases. The consequence: every `publish*` tag pushed here, staging tags included, now makes a GitHub release with three assets | **Decided: switch it on**, with `test-actions-lecture-intro-html` | | 4 | Secrets and write tokens out of the jobs that run notebooks, and `persist-credentials: false` everywhere | **Adopt.** `ci.yml` is the template's four jobs, `publish.yml` its three, and every checkout sets `persist-credentials: false` | Today `ci.yml`'s one job builds the notebooks beside the Netlify and Cloudflare tokens, and `publish.yml`'s one job holds `pages: write` and `id-token: write` while it builds. This is the template's design, from QuantEcon/actions#232 | No: it is the template's security model | | 5 | The schedules | `cache.yml` Sunday 00:00 UTC (the template's), `ci.yml` Sunday 01:00, `publish.yml` Sunday 02:00 | The release gate's nine runs from `main` since 2026-11-10 ran between 21:36 and 22:03 UTC or between 06:38 and 08:04 UTC. A third run joining the `pages` group cancels the waiting one, so the publish is set at 02:00 UTC, 13:00 in Sydney, four hours clear of both. At that hour the watcher's 06:30 UTC run reports a red publish on Sunday, before the consumers' Monday builds; at 12:00 it would have come on Monday, after them (the review). `ci.yml` is not in the `pages` group, so it follows the cache build at once | No, unless the maintainer has another window in mind. The difference from the template's cron does not matter (the review) | | 6 | `ci.yml` on pull requests to any branch, by hand and weekly | Keep, and add `workflow_dispatch` and the schedule | A staged release's pull request targets a `staged-*` branch. The schedule is #302 | No | | 7 | `ci.yml`'s concurrency | The group `ci-${{ github.event.pull_request.number \|\| github.ref }}`, with `cancel-in-progress: ${{ github.event_name == 'pull_request' }}` | The template's key is empty off a pull request, so a scheduled run and a dispatch would cancel each other. And the template cancels in progress on every event, so a dispatch on `main` would cancel a running scheduled run, which the watcher counts as red (the review). Off a pull request a run now waits for the one before it | No | | 8 | Both previews, Netlify and Cloudflare Pages, each with a placeholder step | Keep, with the canary's site, project and secret names | This is the only real `preview-cloudflare` consumer, and the gate deploys both | No | | 9 | Off a pull request, both previews deploy to `dispatch-canary`, and the deploy job fails unless each reports `deployed` and serves the build's marker | Add | This is #302, with its own alias (the review), apart from the gate's `dispatch-release-gate`. The marker is checked by content, as `gate.yml` does, since a Cloudflare Pages preview answers 200 for any path | No | | 10 | `save-cache` | On a pull request only: `${{ github.event_name == 'pull_request' && 'true' \|\| 'false' }}` | A cache saved from `main` reaches every pull request (`restore-jupyter-cache/action.yml:67-72`). The template leaves `save-cache` commented out. The canary keeps it on for pull requests, so that a real run still saves one | No (the review's finding) | | 11 | `publish.yml` on `publish*` tags, by hand and weekly, not on a push to `main` | Keep the tag, add `workflow_dispatch` and the schedule | All eight lecture repositories publish on a tag, and only a tag run makes release assets. Pages does not redeploy on every merge | No | | 12 | `publish.yml`'s notebook and PDF builds, with `html-copy-pdf` and `html-copy-notebooks` | Adopt the template's optional blocks, switched on | The site offers both today, as the lecture sites do | No | | 13 | `publish.yml`'s deploy job checks that Pages serves the build's marker | Add | A scheduled publish replaces the gate's fixture on the Pages site, and this checks that the site serves this build | No (ruling 3) | | 14 | `ci.yml`'s preview has no PDF or notebook downloads | Adopt the template, which builds `html` only in `ci.yml`. The PDF is built in `pdf-check` | Today's preview builds all three in its one job. `publish.yml` still builds them | No | | 15 | `cache.yml`'s push trigger on `environment.yml` | **Adopt the template's**, which #34 had dropped | #34's reason was that in a container build the root `environment.yml` installs nothing. That still holds, but at `v0` both caches' keys and fallbacks hash the file in either mode (`build-jupyter-cache/action.yml:24`, `:178`; `restore-jupyter-cache/action.yml:157`). Without the trigger, a Dependabot update to it would make every pull request and publish miss the execution cache and execute every lecture until Sunday: slower, not red. With it, the merge rebuilds the caches at once, about three minutes, and `cache.yml` differs from the template only in its image (the review) | No | | 16 | `linkcheck.yml` | Remove | Ruling 6 | No | | 17 | `restore.yml` | Unchanged | Already the template, byte for byte (#91) | No | ## Changes | File | Before | After | |---|---|---| | `ci.yml` | One `preview` job: the build cache restored with `save-cache: 'true'`, the PDF, notebooks and HTML built, and both previews deployed beside the tokens. Pull requests and by hand. A dispatch deployed nothing and went green | The template's `placeholder`, `build`, `deploy` and `pdf-check`, with rows 1, 2 and 6 to 10. Pull requests, by hand and Sunday 01:00 UTC | | `cache.yml` | Sunday 03:00 UTC, the lean image, `create-issue-on-failure` | The template, with row 1: Sunday 00:00 UTC, the push trigger on `environment.yml` back (row 15), and `persist-credentials: false`. The failure artifact's upload, already the default, is written out as the template writes it | | `publish.yml` | One job building and deploying in `publish-gh-pages`' `all` mode, on `publish*` tags only. No cache restored, no release assets | The template's `build`, `deploy` and `release-assets`, with rows 1, 3, 11, 12 and 13. `publish*` tags, by hand and Sunday 02:00 UTC | | `linkcheck.yml` | Weekly lychee on the `gh-pages` branch, with `--accept 403,503`, which rejects 200, and a new issue every week | Removed | | `README.md` | "It is the only place `publish-gh-pages`, `preview-netlify` and `preview-cloudflare` are exercised at all", out of date since the release gate | Says where they deploy for real: here, at the gate for each candidate and through `@v0` on pull requests, tags and every Sunday. The actions repo's harness runs them short of a deploy | Each file's header lists its differences from the template, down to the values the drift check in PR C will declare: `publish.yml`'s asset name, and the ids that `ci.yml`'s check reads the deploy steps by. A YAML-aware comparison with `templates/` at `v0`, ignoring comments, finds those differences and no others. ## What the scheduled runs will do on their first Sunday On the first Sunday after merge, 2026-11-22 if it merges this week: - **00:00 UTC, `cache.yml`:** `build-jupyter-cache` builds the HTML and saves the execution and build caches on `main`, as it does today, three hours earlier. - **01:00 UTC, `ci.yml`:** the placeholder posts nothing, since there is no pull request. The build restores the execution cache read-only, saves nothing, and builds the HTML with `-n -W --keep-going`. The deploy sends both previews to the `dispatch-canary` alias, at `https://dispatch-canary--jade-tarsier-d98a19.netlify.app` and `https://dispatch-canary.qe-preview-canary.pages.dev`. Each must report `deployed` and serve `canary-marker-<run id>.txt` with the run's commit. `pdf-check` builds the PDF from the build's execution cache. - **02:00 UTC, `publish.yml`:** it builds the notebooks, the PDF and the HTML from the restored execution cache and deploys them to GitHub Pages. That replaces the gate's fixture, "Release gate fixture", with the canary's book until the next gate run. The run must find its marker served. It makes no release, since it is not a tag run. - **06:30 UTC, QuantEcon/actions' watcher:** once PR C lists them, it reads all three, and reports one that is disabled, red or more than eight days old that same Sunday, before the consumers' Monday builds. ## What I checked, and how - **The shape.** A YAML-aware comparison of each file with `templates/` at `v0` (f7e98be) lists exactly the differences in the table. `templates/` is the same at `v0` and at QuantEcon/actions' `main`. actionlint 1.7.12 is clean on all four workflows. - **The facts the table rests on**, re-checked today: - The canary's lectures already build clean with `-n -W --keep-going`: #92 ran them on v0.20.0 and its `preview` check passed. - `dispatch-alias` deploys on `workflow_dispatch` and `schedule` alike (`preview-netlify/action.yml:37-46`, `scripts/preview-decide.sh:96`). - A placeholder step posts nothing off a pull request. - `publish-gh-pages`' release mode creates the tag's release when there is none. - The gate's nine runs from `main` give the times in row 5. - The Netlify site's name, `jade-tarsier-d98a19`, comes from #92's preview comment. - **This PR's own `ci.yml` run**, [43774271160](https://github.com/QuantEcon/test-actions-lecture-intro/actions/runs/43774271160), shows the pull-request half. `placeholder`, `build`, `deploy` and `pdf-check` all passed. Each provider has one preview comment, replaced in place by its deploy. - **(a) A dispatch on this branch goes green:** [43774197532](https://github.com/QuantEcon/test-actions-lecture-intro/actions/runs/43774197532). Both previews deployed to `dispatch-canary`, and the check found the marker with the run's commit at each: "Netlify serves this build at https://dispatch-canary--jade-tarsier-d98a19.netlify.app" and "Cloudflare Pages serves this build at https://dispatch-canary.qe-preview-canary.pages.dev". `pdf-check` passed. - **(b) The same with `DISPATCH_ALIAS` emptied goes red:** [43774220572](https://github.com/QuantEcon/test-actions-lecture-intro/actions/runs/43774220572), on the throwaway branch `scratch/302-nothing-deployed`, since deleted. Only `deploy` failed, with "Netlify deployed nothing (deployed is 'false')" and the same for Cloudflare Pages. That is the failure this PR closes: today's `ci.yml`, dispatched, goes green while deploying nothing. - **(c) A `publish-check-310` tag on this branch goes green:** [43776690675](https://github.com/QuantEcon/test-actions-lecture-intro/actions/runs/43776690675), on `fd8d510`, at 23:50 UTC, clear of the release gate. `build`, `deploy` and `release-assets` all passed. The deploy found its marker: "GitHub Pages serves this build at https://quantecon.github.io/test-actions-lecture-intro/". The [release](https://github.com/QuantEcon/test-actions-lecture-intro/releases/tag/publish-check-310) holds `test-actions-lecture-intro-html-publish-check-310.tar.gz` (5.2 MB), `test-actions-lecture-intro-html-checksum.txt` and `test-actions-lecture-intro-html-manifest.json`. The tag and its release are kept, as a restore target. Since then `publish.yml` has changed only in its header comments. - **The restore from that release goes green:** `restore.yml` dispatched on `main` with `tag=publish-check-310`, [43777024824](https://github.com/QuantEcon/test-actions-lecture-intro/actions/runs/43777024824). The release's archive was packed before the marker was written, so a site restored from it has no marker. Before the restore the marker answered 200; after it, 404, with the site's root at 200 and `geom_series.html` at 200, so Pages serves the canary's book from the release. It is the canary's first restore from a release that `publish.yml` made. ## What to watch after merge - **The `github-pages` environment's tag rule** is now `publish*`, matching `publish.yml`'s trigger (changed at 23:46 UTC; `publish-*` is gone). Its `gh-pages` branch rule can go once that branch is deleted. - **The 27 "Link Checker Report" issues**, #28 to #81, are closed as not planned by the organiser after merge, and the `gh-pages` branch is deleted. Its tip is `e9156b958647e420e306cfb3683e30238e1e1e18`, written on 2025-11-07. - **The first Sunday's three runs,** above. The Pages site shows the canary's book now, since the restore, and again after each publish, until the next release gate run. - **After each `v0` move,** the release procedure dispatches all three workflows once (ruling 5). That goes into CONTRIBUTING in PR C, and is not for v0.21.0. ## Not in this PR - `gate.yml` and `gate/`, which are unchanged. Row 2's out-of-date comment at `gate.yml:393` is left for a later gate change. - The watcher's drift check, and `ci.yml` and `publish.yml` on its list: PR C. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WT8bMaEFAot565L8kcyAcz
) canary-watch.yml gains a drift job: scripts/canary-drift.py compares the canary's ci.yml, cache.yml, publish.yml and restore.yml with templates/ at the commit v0 points to, as YAML, apart from the differences .github/canary-drift.yml declares, each with its reason. An undeclared difference, a declared one that no longer differs, and a declared value the canary no longer holds are red. Third-party actions' versions are compared only with DRIFT_COMPARE_VERSIONS: 'true'. On the schedule, a red verdict opens its own issue, "Canary drift", beside the runs issue. canary-watch.sh, the follow-ups from #328's review: - markers() fails when the issue or its comments cannot be read, and the report stops rather than commenting again; - the markers' author is MARKER_AUTHOR, github-actions[bot] by default; - --verdict writes the step summary and the job's outputs for both jobs, and --stopped prints the one stopped text; - TOPIC picks the issue, runs or drift; - a comment records that a missing label lists nothing, with exit 0. The harness's canary-watch job self-tests canary-drift.py as well, and both scripts and the declarations are on the gate's must-run list. Docs: TESTING.md describes the canary as QuantEcon/test-actions-lecture-intro#94 left it, which deploy its GitHub Pages site shows, and the drift check; it says the gate's build cache is restored as lecture-dp's ci.yml does. CONTRIBUTING's staged release adds the lecture matrix at the candidate for a release that changes what a build reports, the canary's dispatches once v0 has moved, and the hours to keep the gate out of. PLAN.md's canary paragraph and item 0c say where #302 stands. Part of #302 and #310. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMaEFAot565L8kcyAcz
) (#331) Part of #302. Closes #310. This is the last of the three PRs the maintainer approved on 2026-11-15. PR A, #328, added the watcher. PR B, QuantEcon/test-actions-lecture-intro#94, realigned the canary's workflows with `templates/` at `v0` and scheduled `ci.yml` and `publish.yml` on Sunday. This PR adds the drift check that keeps them aligned, the four follow-ups from #328's review, and the docs. ## Why The canary is only worth watching while it runs what consumers run. Before #94 its `ci.yml`, `cache.yml` and `publish.yml` had drifted a long way from `templates/` without anyone noticing, and the next release that changes a template would start the same drift again. A comparison read through the API every day reports that drift as it happens, and it also catches the opposite case: a declared difference that has quietly stopped being true. ## Changes | File | What | |---|---| | `scripts/canary-drift.py` | New. It reads the canary's `ci.yml`, `cache.yml`, `publish.yml` and `restore.yml`, and `templates/` at the commit `v0` points to, and compares each pair as YAML. `--self-test` runs it on small workflows, loads the real declarations file, and checks `canary-watch.yml`'s schedule filters | | `.github/canary-drift.yml` | New. Every difference the canary's file headers declare, each with its reason, and where the canary must hold a value, that value: 17 for `ci.yml`, 1 for `cache.yml`, 16 for `publish.yml`, none for `restore.yml` | | `.github/workflows/canary-watch.yml` | A `drift` job beside `watch`, which runs on every run of the workflow, and a `drift-report` job after `report`, on the same issue. Both checks' verdicts go through one `--verdict` step | | `scripts/canary-watch.sh` | The four #328 follow-ups (below); `TOPIC`, which picks the check whose record a report keeps on the canary issue, `runs` or `drift`; `--verdict FILE STATUS HEADING`, which writes the summary and the job's outputs | | `.github/workflows/test-actions.yml` | The `canary-watch` job self-tests the drift script too, in a venv with the pinned PyYAML. Both scripts, the declarations file and `canary-watch.yml` are on the gate's must-run list | | `docs/dev/TESTING.md` | The canary as #94 left it, with its schedules and marker checks; which deploy its GitHub Pages site shows; the watcher's two checks; the gate's build cache restored "as lecture-dp's `ci.yml` does"; and "What is not covered" brought up to date | | `CONTRIBUTING.md` | Staged Releases: the lecture matrix at the candidate, for a release that changes what a build reports; dispatching the canary's `cache.yml`, `ci.yml` and `publish.yml` once `v0` has moved; and the Sunday hours to keep the gate out of | | `docs/dev/PLAN.md` | The canary paragraph and item 0c say where #302 stands, since they described the canary as it was before #94. The Release gating row lists #302 alone, and the Testing row drops #100, which is closed | | `docs/user/versioning.md` | A staged release is described as passing the release gate, not as the canary's previews and cache build against the new tag, with a link to CONTRIBUTING's Staged Releases | | `CHANGELOG.md` | A Documentation entry for the release-process change. As with #328, the CI itself gets no entry, since it ships to no consumer | **What the drift check compares.** Each workflow is flattened into dotted paths. A list item is keyed by its `name`, then `id`, then `uses`, then its index. Comments and key order do not count. Values are compared with their types, so YAML's `true` is not its `1`. A path in the declarations covers everything beneath it, except an `if`, `continue-on-error` or `permissions` key, which a declaration covers only by naming it or by giving a value that holds it. Red findings: | Finding | Example | |---|---| | A difference that nothing declares | A template gains a step that the canary's copy lacks | | A declared difference that no longer differs | The canary goes back to the template's `cron`, and the declaration stays | | A declared `value`, a mapping or list included, that the canary no longer holds | `jobs.build.container.image` changes in the canary but not in the declarations | | A `quantecon/actions` action that does not run at `@v0`, declared or not | `preview-cloudflare@main` in a declared Cloudflare step | | An `if`, `continue-on-error` or `permissions` key that no declaration names | `if: false` on the declared "Check both previews serve this build" step | | The steps both workflows have, in another order | A step moved above the one it followed in the template | | A workflow, or `v0`, that cannot be read | The API is down, or the canary's file is not YAML | It lists at most eight problems per workflow, then "and N more". Step names are escaped, so none can put a line of its own in the log. The commit `v0` was read at is on a line of its own, outside the red lines that the report hashes, so a red that persists across a `v0` move is not reported again. A declarations file in the wrong shape, such as an entry with no `why` or a path listed twice, stops the check. It is then reported as a stopped watcher, with the reason in the run's log. **One issue, as #302's ruling has it.** Both checks report on `🔴 Canary watch: QuantEcon/test-actions-lecture-intro`, labelled `canary`. Each keeps its own record there, a marker of its own, so one check's state never stands for the other's, and the drift report runs after the runs report, so that two reports never open two issues. A check with no record on the open issue says in full what it found when it turns red, and adds nothing when it is green. **The four #328 follow-ups:** 1. **`markers()` fails loudly.** If the issue or its comments cannot be read, the report stops and records nothing. Before, it found no markers and commented again. 2. **The markers' author is an input.** `MARKER_AUTHOR` defaults to `github-actions[bot]`, is set in the workflow's `env`, and must look like a login. 3. **One stopped text.** `STOPPED` is defined once in the script. The workflow gets it through `--verdict`, which adds it whenever a check exits non-zero without writing a 🔴 line. Nothing else prints it. 4. **A missing label lists nothing.** `gh issue list --label` on a label that does not exist returns `[]` and exits 0; checked today with gh 2.104.0. A comment in `report()` now says so. ## Departures from the ruling 1. **Daily, not weekly.** The drift job runs on the watcher's daily schedule, so a `v0` move that changes a template shows the next morning, and a comment is made only when the findings change. To go weekly: add a weekly cron to `on.schedule`, and give the `drift` job `if: github.event.schedule != '30 6 * * *'`, as the comment above the job says. That filter skips one cron, so a cron edited later runs the job more often, never less, and the drift check's self-test fails on a filter that names a cron the workflow does not have. 2. **Third-party actions' versions are not compared.** The canary's Dependabot moves its `actions/*` pins on its own schedule, while the templates move only with a release, so comparing them would turn drift red after every Dependabot merge. To compare them: set `DRIFT_COMPARE_VERSIONS: 'true'` in `canary-watch.yml`'s env. ## What I checked, and how **The review's findings, red first.** A throwaway branch, `scratch/302-review-fixes`, ran each finding through d8f745a's code and through this PR's, in [run 43785403141](https://github.com/QuantEcon/actions/actions/runs/43785403141), on bash 5.3. The branch is deleted. Each finding was applied to the canary's real workflows, read at its `main`, and to `templates/` at `v0`: | Finding | d8f745a | Now | |---|---|---| | `preview-cloudflare@main` in either Cloudflare step | ✅ Green | 🔴 "runs `quantecon/actions/preview-cloudflare@main`, where the canary runs every `quantecon/actions` action at `@v0`" | | `build-lectures@main` in publish's Build PDF step | ✅ Green | 🔴 The same, for `jobs.build.steps[Build PDF].uses` | | `[email protected]` in `jobs.release-assets` | ✅ Green | 🔴 The same, for its "Attach the site to the release" step | | `permissions: write-all` on `jobs.release-assets` | ✅ Green | 🔴 "is `write-all` here, where the declarations give `{contents: write}`" | | `if: false` on "Check both previews serve this build" | ✅ Green | 🔴 "is `false` here, where the declarations give `github.event_name != 'pull_request'`" | | `continue-on-error: true` on the same step | ✅ Green | 🔴 "is only in the canary" | | Two steps swapped | ✅ Green | 🔴 "`jobs.build.steps` has `Build` before `Checkout` here, and after it in the template" | | `fetch-depth: true` for the template's `1` | ✅ Green | 🔴 | | A declared value on a mapping path that the canary does not hold | ✅ Green | 🔴 | | The red line at two `v0` commits | Differs, so a new comment | The same: no commit in it | | A step named `"x\n::warning::y"` | A `::warning::` line of its own in the finding | One line, escaped | | `canary-watch.yml`'s drift job filter, and the same file with line 29's cron edited | Not checked | 🔴 "runs on a schedule only when it is '30 6 * * *'"; this PR's workflow ✅ | | d8f745a's `canary-watch.sh` with this PR's self-test | | 🔴 13 cases, all the one-issue ones; this PR's script ✅ | The same run's live check, as the watcher runs it, is green: `ci.yml` matches `templates/ci.yml` at `v0` apart from 17 declared differences, `cache.yml` 1, `publish.yml` 16, and `restore.yml` exactly. The four new declarations are the guarded keys the canary has: the preview check's `if`, the release-asset upload's `if`, and `jobs.release-assets`' `if` and `permissions`, each the template's own, uncommented. **Earlier rounds.** The drift check, read live from the canary: a throwaway branch, `scratch/302-drift-checks`, ran it in [run 43781530288](https://github.com/QuantEcon/actions/actions/runs/43781530288), through the same `--verdict` step the watcher uses, at d8f745a's parent; the branch is deleted. The declaration counts below are from then. | Job | Result | What it printed | |---|---|---| | Drift, canary at its `main` (32cab47) | ✅ Green | `cache.yml` matches `templates/cache.yml` at `v0` (f7e98be), apart from 1 declared difference; `ci.yml` 16; `publish.yml` 13; `restore.yml` exactly | | Drift, canary at afd76d2, before #94 | 🔴 Red, as it must be | `cache.yml`, `ci.yml` and `publish.yml` have drifted, for example the old `Build and Cache` step, which is only in the canary, and declared values that are absent there; `restore.yml` ✅ | | main's `canary-watch.sh` (c596497) with this PR's self-test, the label's old description put back | 🔴 Red, as it must be | Exactly the 18 new cases fail: `MARKER_AUTHOR`, an unreadable issue or comments, the drift topic, `TOPIC` and `MARKER_AUTHOR` validation, `--verdict` and `--stopped`, since removed. Every older case passes | | This PR's `canary-watch.sh` | ✅ Green | The self-test passes on bash 5.3 | **Locally,** both self-tests pass, on bash 3.2 and Python with PyYAML 6.0.3. So do `generate-docs.py --check --check-examples --actionlint`, `actionlint` and `scripts/lint-shell.py`, with actionlint 1.7.12 and shellcheck 0.11.0. The new TESTING.md text was checked against the canary's workflows: `gate.yml`'s deploy job, `publish.yml` and `restore.yml` share the `pages` concurrency group, and only the gate and `publish.yml` read their deploy back. In CONTRIBUTING, the lecture matrix command depends on `test-containers-lectures.yml` running `./actions-repo/*` from a checkout of `github.sha` and filing no issue on a dispatch, which I confirmed in the file. No canary workflow was dispatched for this PR. Every read of the canary went through the API. ## What to watch after merge - **The first scheduled run,** at 06:30 UTC after the merge, should show both checks green: `cache.yml`'s scheduled run, and the four workflows matching `templates/` at `v0`. Being green, it files nothing. - **A release that changes a template** turns the drift check red until a canary pull request realigns the copy, or updates `.github/canary-drift.yml` if the difference is deliberate, unless the change is to a third-party action's version or under a declared path. That red is intended: the issue says which paths to fix. - **#326 also adds to `## [Unreleased]`.** Whichever PR merges second gets a small CHANGELOG conflict at that heading: keep both entries, with `### Fixed` after `### Documentation`. ## What the drift check does not see These are in TESTING.md's canary section too: - **A declared path's own content.** A step only the canary has can change its script or inputs, or the action it runs if that is not `quantecon/actions`', and stay green. - **New keys under a declaration with no value.** A future `v0` that adds `on.pull_request.types` or `workflow_dispatch.inputs` to `templates/ci.yml` stays green, under the value-less `on.pull_request` and `on.workflow_dispatch` declarations. ## Not in this PR - **`ci.yml` and `publish.yml` on the watch list.** A one-line PR adds them to `CANARY_WORKFLOWS` after their first scheduled runs on Sunday 2026-11-22, as the organiser ruled. Until then the watcher reads `cache.yml` alone. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WT8bMaEFAot565L8kcyAcz
Brings in #328, #329 and #331. CHANGELOG.md conflicted under [Unreleased]: #331's Documentation entry now comes before #322's Fixed entry, in the file's section order. test-actions.yml and docs/dev/TESTING.md merged cleanly. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMaaUb1oFVdDs82xVHp
Cuts v0.21.0, a minor release, because it carries a change marked⚠️ BREAKING: #326, for #322. `build-lectures`' `error-outputs` check now checks a page taken from the execution cache, which it used to pass unchecked. `v0` is on v0.20.1, and moves to v0.21.0 only after the release gate and the lecture matrix have passed it. ## What's in it | Change | PR | Issue | |---|---|---| |⚠️ BREAKING `build-lectures`: the `error-outputs` check reads a page taken from the execution cache from the cache's copy, as myst-nb renders it, and checks its outputs | #326 | #322 | | Docs: a release that changes what a build reports dispatches the lecture matrix at the candidate, and once `v0` has moved, the canary's `cache.yml`, `ci.yml` and `publish.yml`. TESTING describes the canary watcher and its drift check, and the user manual's versioning page says a staged release passes the release gate | #328, #331 | #302, #310 | | Docs: which actions live here, and the README's "Standalone actions" table | #332 | | **What breaks.** A site whose cached pages carry an error traceback now fails its build where it used to pass: in a pull request's build over a restored execution cache, as `templates/ci.yml` sets up, and in a later build that rereads the pages, as `html` does after `pdflatex` in a book with parts. Such a site can fix the cell, tag a deliberate one `raises-exception`, or set `error-outputs: 'warn'` meanwhile. An execution cache the check can't read is now reported as an unreadable notebook is, which also fails the step under `fail`, the default. The inputs, the output and the annotations are unchanged. Also merged since v0.20.1, with no entry of their own: - #325 and #329, PLAN only; - the canary watcher's workflow and scripts (#328, #331). They run in this repository and reach no consumer; the Documentation entry above covers them. ## Changes in this PR | File | Change | |---|---| | `CHANGELOG.md` | `## [0.21.0] - 2026-11-16` below an empty `## [Unreleased]` | | `docs/dev/PLAN.md` | The release line: the latest release is v0.21.0, and `@v0` is on v0.20.1 until the gate has passed it | The date is today's in UTC. ## What I checked - **The CHANGELOG:** the diff adds 2 lines and deletes none, and everything from `## [0.20.1]` down is byte-identical to `main`. Every PR merged since v0.20.1 has its entry, or is covered above. - **`generate-docs.py --check --check-examples`:** 23 files current; 70 steps and 18 workflows checked. - **No other page** names a release as the current one. `scripts/canary-drift.py`'s `@v0.20.1` is a sample pin in its self-test. ## Staging, after the tag As CONTRIBUTING's Staged Releases says: 1. **The release gate:** `gate.yml` on the canary's `main`, with `candidate=v0.21.0` and the self-test off. It must be green, with each site serving the marker for the release commit. The `error-outputs` check's summary line in its log must say how many notebooks came "with the outputs the execution cache holds", which shows the candidate's check ran. The run is linked here. 2. **The lecture matrix at the candidate,** because the release changes what a build reports: a check that can now fail a build. The run is linked here, and I'll read each red leg's log and say here why it isn't the candidate's, or hold the release. 3. **Nothing staged by hand.** The gate restores its execution cache both ways, which is #322's pull-request case. It shows the candidate's check reads the cache cleanly in the pinned image, but no gate page has an error output to catch. The reread case, in a book with parts, is the harness's: `build-cache-error-guard` covers both cases, a rebuild with `--all` over the same `_build` and a build over the execution cache alone, on every pull request that changes an action. Its last run, on #326's head, was green (run 43787220029), and that head's `build-lectures/` and `test-actions.yml` are what merged. 4. **Once `v0` has moved:** the canary's `cache.yml`, then `ci.yml` and `publish.yml`, dispatched on its `main`, with their runs linked here. Container images don't go through the canary, and this release changes none. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WT8bMbZoC2dpGt3sPyBjyd


Part of #302. This is the first of the three PRs the maintainer approved on 2026-11-15, under the ruling on alerts, "Watcher here, variable". PR B, in the canary, schedules its
ci.ymlandpublish.yml. PR C adds the drift check and the docs that go with it.Why
Nobody watches the canary's scheduled runs. Its
cache.ymlfailed eight Sundays running, from 2026-02-22 to 2026-04-12, and filed nothing. Then GitHub disabled its schedule after 60 days with no push, and 16 Sundays passed with no run at all. A check inside the canary cannot report that second failure, because a disabled canary runs nothing. So the watcher runs here, in a repository that is never idle, and reads the canary through the API. The canary's last push was on 2026-11-12, so without another one its schedules stop again around 2027-01-11.Changes
.github/workflows/canary-watch.ymlwatchjob withcontents: readgives the verdict and writes it to the run's summary. On the schedule, areportjob withissues: writerecords the verdict on the canary issue, red or greenscripts/canary-watch.shCANARY_WORKFLOWS, itsstateand its newest completed scheduled run onmain(event=schedule&branch=main&status=completed).--report FILEfiles the findings, and--self-testruns both against a stand-ingh.github/workflows/test-actions.ymlcanary-watchjob runs the self-test. It sits after thebjc-*jobs and inharness-summary'sneeds:. The script joins the gate's must-run listdocs/dev/TESTING.mdWhat turns it red:
disabled_inactivitygh workflow enable <file> --repo QuantEcon/test-actions-lecture-introdisabled_manuallyactive, such asdeletedmainsuccesssuccessThe report keeps one open issue,
🔴 Canary watch: QuantEcon/test-actions-lecture-intro, labelledcanary, and runs on every scheduled run:CANARY_ASSIGNEESrepository variable, separated by commas or spaces. With the variable unset, the issue goes to nobody and the run warns.green. A state that the issue's last marker already records adds nothing, so a disabled workflow is reported once, not every day. The same red after a green run is reported again, as "red again".github-actions[bot]are read, since anyone can comment on a public repository's issue.A dispatch reports in the run only, as
prune-images.ymldoes. The first red report creates the label withgh label create --force, as the canary'sgate.ymldoes forrelease-gate.One change from the design note: the watcher runs daily with a 192-hour limit, not weekly on Sunday with 36 hours. A weekly watcher needs a limit so tight that a dispatch midweek is always red, and it would see a disable up to a week late. Run daily, it shows a disable or a red run the next morning, and a Sunday run that never came on the Monday. And since a comment is made only when the state changes, running daily adds no noise.
The list is
cache.ymlalone for now.ci.ymlandpublish.ymlhave never run on a schedule, so listing them today would turn it red at once. They join in PR C, after PR B schedules them.What I checked, and how
The facts, re-checked today. The canary's
cache.ymlisactive, and its newest scheduled run onmain, 43670919312 on 2026-11-15 at 03:07 UTC, succeeded. Itsci.ymlandpublish.ymlhave no scheduled run. The canary's last push was on 2026-11-12. QuantEcon/actions has nocanarylabel and no repository variables yet.It goes red on real disabled, stale and never-run states. A throwaway workflow on
scratch/302-canary-watchran it, in run 43772930015. It was generated from this PR'scanary-watch.yml, so its steps are the watcher's own, compared after generation:cache.ymlcache.yml, which isdisabled_inactivitygh workflow enable cache.yml --repo QuantEcon/lecture-stats"cache.yml, with a one-hour limitci.ymlmain"cache.ymlandci.ymlcache.yml, 🔴 forci.ymlghdisabled_inactivitytaken foractiveThe same run shows that
GITHUB_TOKENcan read another public repository's Actions API, which the design note said to show first. The branch is deleted.The review's three findings, each shown red on the old script first. An independent review reproduced them against the unmodified script, with a fake
ghthat keeps issue state: the same red after a recovery went unnotified, a marker in anyone's comment silenced a report, and a stopped watcher commented every day. A throwaway branch, since deleted, ran the new self-test against the old script (2b57fae) and against the fixed one, in run 43777119196 on bash 5.3. The old script failed exactly the new cases: the same red after a green run, the three green-run cases, a marker in another account's comment and in another account's issue body, the stopped watcher on its first and its next day, and the reworded stale finding. Every earlier case passed on it, and the fixed script passed them all. Its stand-inghanswered the old script'sgh issue viewfrom the same issue, so each case ran against the old code's real reading of it. The self-test now reports every failing case, not only the first.The self-test can fail. Locally, each of 12 broken copies of the script failed it. They took a disabled workflow for active, dropped the age check or moved it by an hour, ignored the conclusion, passed a never-run workflow, commented on every run or on none, read the first marker instead of the last, dropped the assignees, skipped the title match, dropped the
status=completedfilter, or made a green check exit 1. It passes on bash 3.2 and 5.The local checks are clean, with actionlint 1.7.12 and shellcheck 0.11.0. They are
generate-docs.py --check --check-examples --actionlint,actionlint,scripts/lint-shell.py, andshellcheck -x scripts/canary-watch.shat every severity. There is no CHANGELOG entry, since this is CI only and ships to no consumer.What to watch after merge
CANARY_ASSIGNEESis set tommcky, as a repository variable, by the organiser. Until it is, a red verdict files the issue unassigned and warns.cache.yml's run of 2026-11-15, or a newer one, in its summary. A dispatch shows the same at once.gate.ymlmakes the sameghcalls forrelease-gate, but this workflow has not yet filed for real.Not in this PR
ci.ymlandpublish.ymlon the watch list, and the weekly drift check againsttemplates/atv0, with its declarations file. Those come in PR C, after PR B merges in the canary.ci.ymlandpublish.ymlahead of the consumers' Monday builds (PLAN P0 0c) #302's schedules, Canary: bring itsci.yml,cache.ymlandpublish.ymlback in line withtemplates/#310's realignment and the removal oflinkcheck.yml. Those are PR B.🤖 Generated with Claude Code
https://claude.ai/code/session_01WT8bMaEFAot565L8kcyAcz