Repository navigation
ci(canary-watch): read the canary's scheduled ci.yml and publish.yml runs - #350
Conversation
…runs The canary's ci.yml and publish.yml ran on their Sunday schedule for the first time on 2026-11-22, both green, so the watcher now reads all three of its scheduled workflows: CANARY_WORKFLOWS is cache.yml ci.yml publish.yml. TESTING.md and PLAN.md say so, P0 item 0c leaves the P0 table, and the Release gating row leaves the open issues. schedule_filters() in scripts/canary-drift.py read only github.event.schedule == or != a quoted cron, so a job filter written with contains(), with the cron first, or by index passed its self-test unseen. Any read of github.event.schedule in a job's if: that the comparison does not account for is now a problem, with a self-test case for each of those forms. No CHANGELOG entry: this CI reaches no consumer. Closes #302 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMbaRe5RMw7Xxw1EnkG
There was a problem hiding this comment.
🟡 Changes recommended
The schedule-filter check misses valid indexed access to github.event, allowing cron changes to silently disable the drift job without detection; matching and self-tests need to cover these forms.
1 open issue
What changed in this PR
Extends the canary watcher to monitor all three scheduled workflows, completing the remaining monitoring work for #302, and strengthens checks for unsupported schedule filters.
Changes:
- Adds
ci.ymlandpublish.ymlalongsidecache.ymlto scheduled-run monitoring. - Detects additional schedule-read forms and adds four regression cases.
- Updates testing and planning documentation to reflect the expanded coverage.
| File | Description |
|---|---|
scripts/canary-drift.py |
Adds fallback schedule-read detection and regression cases. |
docs/dev/TESTING.md |
Documents monitoring of all three scheduled workflows. |
docs/dev/PLAN.md |
Updates canary coverage and removes the remaining P0 item. |
.github/workflows/canary-watch.yml |
Expands the watch list and clarifies the schedule-check comment. |
Review effort: Balanced (adaptive)
| OURS_RE = re.compile(r'quantecon/actions(/|@|$)', re.I) | ||
| SCHEDULE_RE = re.compile(r"github\.event\.schedule\s*(==|!=)\s*'([^']*)'") | ||
| # Any read of the schedule, which what SCHEDULE_RE matches must account for. | ||
| SCHEDULE_READ_RE = re.compile(r"github\.event(\.schedule\b|\[\s*'schedule'\s*\])", re.I) |
There was a problem hiding this comment.
Agreed, and changed in 96dc00b. SCHEDULE_READ_RE now matches property or index access on each of event and schedule, in either quote and with optional whitespace, so github['event']['schedule'], github['event'].schedule and github.event['schedule'] are all seen. Such a form is reported as a read the check cannot follow, not accepted as a filter: only github.event.schedule == '<cron>' or != '<cron>' counts as one, which is the form the drift job's comment prescribes. That way the check never has to read another form right, and anything else fails loudly with the rewrite in its message.
Three new self-test cases cover github['event']['schedule'] == '30 6 * * *', github['event'].schedule != '30 6 * * *' and github [ "event" ] [ "schedule" ] != '30 6 * * *'. Run against b7c2ca3's schedule_filters() before the change, all three failed with got [[]]. The existing github.event['schedule'] case already passed there. After the change all pass, and github.event_name and github['event_name'] filters stay green.
Claude Code (on behalf of mmcky)
SCHEDULE_READ_RE matched index access on `schedule` only, after a literal `github.event`, so github['event']['schedule'] == '<cron>' and github['event'].schedule != '<cron>' passed the self-test unseen. It now matches property or index access on each of `event` and `schedule`, in either quote, with optional whitespace. Such a form is reported, not read as a filter: only github.event.schedule == or != a quoted cron counts as one. Three self-test cases cover the forms. From Copilot's review of #350. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMbaRe5RMw7Xxw1EnkG
…e lychee line up to date Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMbaRe5RMw7Xxw1EnkG
Cuts v0.22.0, a minor release: #357 and #345 add features, and nothing in it is marked⚠️ BREAKING. It carries #357's `deploy-release` reusable workflow, #345's `comment-key` and `toc-file`, and #346's images, whose CHANGELOG entries are already under `[Unreleased]`, and Dependabot's #348, #352 and #347, whose entries this PR writes. `v0` is on v0.21.1, and moves to v0.22.0 only after the release gate and the staging below have passed it. ## What's in it | Change | PR | |---|---| | `deploy-release`, the first reusable workflow for lecture repositories, and its caller, `templates/deploy-release.yml`: on a release published for a `publish-*` tag it deploys that release's site to GitHub Pages, and on a dispatch with a tag it deploys that tag's release, which is the rollback. Its `### Added` entry is already under `[Unreleased]` | #357 | | `comment-key` and `toc-file` in `preview-netlify`, `preview-cloudflare` and `preview-workers`, for several sites on one pull request. Both are empty by default, which leaves the comment, its marker and its links as they were. Its `### Added` entry is already under `[Unreleased]` | #345 | | Chrome for Testing 158 in both images, and kaleido 1.5.2. Its `### Changed` entry is already under `[Unreleased]`. `:latest` has carried it since 2026-11-19, so this release only records it | #346 | | wrangler 4.166.0 in `preview-cloudflare`, `preview-workers` and `deploy-cloudflare`, up from 4.162.0; netlify-cli 27.20.1 in `preview-netlify`, up from 27.19.0. Neither raises its minimum Node, which stays at 22.12 for wrangler and 22.13 for netlify-cli. One entry for both | #348, #352 | | Both images on the `ubuntu:24.04` image of 2026-11-10, pinned by digest. `:latest` has carried it since 2026-11-20, so this release only records it | #347 | Also merged since v0.21.1, with no entry of its own: #344 (PLAN), #350 (CI and docs: the canary watcher reads the canary's scheduled `ci.yml` and `publish.yml` runs) and #351 (PyYAML 6.0.4 in `scripts/requirements.txt`, CI only). ## Changes in this PR | File | Change | |---|---| | `CHANGELOG.md` | `## [0.22.0] - 2026-11-28` below an empty `## [Unreleased]`. Under `### Changed`, the entry for #348 and #352 first; then #346's, with one line added (both images rebuilt and smoke-tested, and `:latest` moved on 2026-11-19, before this release); then #347's. `### Added` keeps #357's and #345's entries as they were | | `docs/dev/PLAN.md` | The release line: the latest release is v0.22.0, and `@v0` is on v0.21.1 until the gate has passed it. The line counting the actions names the reusable workflow, `deploy-release`. The rows for `lecture-jax`, `lecture-python-intro`, `lecture-python-advanced.myst`, `lecture-python-programming`, `lecture-python-programming.fr` and `continuous_time_mcs` are on `@v0`, where PLAN said `@v0.12.0`, and the paragraph on their exact pins goes with them. QuantEcon/lectures' row names `setup-environment` too, which its `site-build.yml` runs on its full-image legs, `intro` and `advanced`, and counts the six sites it builds now. Two rollout lines that still named exact pins say `@v0`: `publish-gh-pages`' 8/8, and `lecture-jax`'s previews | The date is today's in UTC. ## What I checked - **The CHANGELOG:** the diff adds 12 lines and deletes none, and everything from `## [0.21.1]` down is byte-identical to `main`. Every PR merged since v0.21.1 has its entry, or is listed above. The lockfiles on `main` pin wrangler 4.166.0 (engines `>=22.12.0`) in all three Cloudflare actions and netlify-cli 27.20.1 (`>=22.13.0`). - **The consumers,** read today from each repository's default-branch workflows: `lecture-jax` and `lecture-python-programming.fr` call `preview-netlify@v0` (`ci.yml`) and `publish-gh-pages@v0` (`publish.yml`); `lecture-python-intro`, `lecture-python-advanced.myst`, `lecture-python-programming` and `continuous_time_mcs` call `publish-gh-pages@v0` (`publish.yml`). No other workflow in them names this repository. QuantEcon/lectures' `site-build.yml` runs `setup-environment@v0` on the legs whose `site.yml` gives a container runner and `environment: base`, which are `intro` and `advanced`, and `build-lectures@v0` on every leg. - **The build actions,** `setup-environment`, `setup-latex`, `build-lectures`, `build-jupyter-cache`, `restore-jupyter-cache`, `publish-gh-pages` and `restore-gh-pages`, are byte-identical to v0.21.1 at `19fdc20`, and none calls a script that has changed since. `deploy-cloudflare` changes only in its `package.json` and `package-lock.json` (#348, #352). - **`generate-docs.py --check --check-examples --actionlint`:** 24 files current; 75 `quantecon/actions` steps and 20 complete workflows checked, clean under actionlint 1.7.12. `actionlint` finds `.github/workflows/` clean, and `scripts/lint-shell.py`, with shellcheck 0.11.0, finds 74 `run:` scripts in 11 `action.yml` files, 216 in 9 workflows, and 16 `scripts/*.sh` clean. - **The harness skips this PR's files,** since the gate's `IGNORED` covers `CHANGELOG.md` and `docs/`. The evidence is `main`'s full harness at `19fdc20`, #351's merge commit, which comes after #352's lockfile changes: dispatched run https://github.com/QuantEcon/actions/actions/runs/46131794415, green on its first attempt, with 70 jobs passed and 5 skipped. ## Staging, after the tag As CONTRIBUTING's Staged Releases says, apart from the departures in steps 3 and 5: 1. **The release gate:** `gate.yml` on the canary's `main`, with `candidate=v0.22.0` and the self-test off, outside Sunday 00:00 to 03:00 UTC. It must be green, with each site serving the marker for the release commit, and its log must show both preview deploys running the new CLIs, wrangler 4.166.0 and netlify-cli 27.20.1. The run is linked here. 2. **A canary PR for #345's pull-request half,** which the gate doesn't reach: a branch `staged-v0.22.0` in the canary with every `quantecon/actions/...` step pinned `@v0.22.0`, inputs as `templates/` has them (no `comment-key`, no `toc-file`), and a one-line change to one lecture. Checked by hand: each provider's placeholder comment lists the changed lecture, and its deploy then replaces that same comment, with its marker as before; each `pr-<N>` preview serves the build's marker and the changed lecture, by content; a second push updates the same two comments. The PR is closed unmerged with a results note, and linked here. 3. **`deploy-release` on the canary,** which the gate doesn't reach and the harness checks only as a file: a caller on the canary's `main`, `templates/deploy-release.yml` with its `uses:` pinned `@v0.22.0`, merged on review; a release made by the canary's `publish.yml` on a new `publish-*` tag, which starts no `deploy-release` run; then a dispatch with `tag=publish-check-310`, the rollback path, and that new release published again, the release path. Each is checked by its upload job's `commit` and by the site serving, by content, a file whose bytes differ between the two releases. This departs from CONTRIBUTING, which stages on a canary branch: GitHub dispatches only a workflow that is on the default branch, and the canary's `github-pages` environment admits only `main` and `publish*` tags. The post-move PR updates CONTRIBUTING to match. The runs are linked here. 4. **No lecture matrix at the candidate:** the build actions are unchanged, and #346's and #347's images are already `:latest`. Monday's scheduled run 45098004558, on `main` at `06b493f` with `:latest` of 2026-11-20, ran this build path green on all 8 legs. 5. **Nothing staged by hand for `deploy-cloudflare` and `preview-workers`,** which the gate doesn't reach. Neither has an `@v0` consumer: the two `deploy-cloudflare` callers pin `v0.12.0`, and `preview-workers` has none yet (#299). The harness installs the pinned wrangler for both and runs it ("pinned CLIs install from their lockfiles and run", each action's "the pinned wrangler accepts the generated config", and `deploy-cloudflare` on Node 22.11 and 22.12), and covers #345's keyed and toc paths in its fixtures, all green in the run above. 6. **Once `v0` has moved,** which is asked for on its own: the canary's `cache.yml`, then `ci.yml`, on its `main`; its `deploy-release` caller moved to `@v0` and dispatched once more; then its `publish.yml`, so the site ends on a marked build; then a post-move PR here for PLAN's `v0` line, the canary drift check's workflow list, and TESTING's and CONTRIBUTING's lines on the reusable workflow. The move reaches the `@v0` callers of `preview-netlify` on default inputs, and QuantEcon/lectures' site build, whose `setup-environment` and `build-lectures` this release doesn't change. The runs are linked here. Copilot: not requested (Matt, 2026-11-22). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WT8bMYECPyC5K5RvEg6uiq

The canary watcher now reads the scheduled runs of all three of the canary's scheduled workflows,
cache.yml,ci.ymlandpublish.yml, where until now it readcache.ymlalone. This is the last step of #302. It also takes up a nit from the re-review of #331: the drift check's self-test ofcanary-watch.yml's schedule filters could miss a filter that readsgithub.event.schedulein any way but== '<cron>'or!= '<cron>'.Closes #302
Why. The canary's
ci.ymlandpublish.ymlgained their Sunday schedules in QuantEcon/test-actions-lecture-intro#94, and the watcher was to list them once each had a scheduled run onmainto read: a workflow listed before then would turn the watcher red at once, as "has never completed a scheduled run". Their first scheduled runs were on Sunday 2026-11-22, and both succeeded (below).Changes
.github/workflows/canary-watch.ymlCANARY_WORKFLOWS: cache.yml ci.yml publish.yml. The comment above it no longer says the other two join later. Thedriftjob's comment says the self-test also fails on a filter that reads the schedule any other wayscripts/canary-drift.pyschedule_filters()reports any read ofgithub.event.schedulein a job'sif:that its comparison pattern does not account for:contains(),startsWith(), a comparison with the cron first, or index access oneventorschedule, such asgithub['event']['schedule'], in either quote. Onlygithub.event.schedule == '<cron>'or!= '<cron>'counts as a filter, so the check never has to read any other form right. Seven self-test cases cover those formsdocs/dev/TESTING.mddocs/dev/PLAN.mdlecturesconsumer row names the four sites QuantEcon/lectures'site-build.ymlbuilds; the "Work plan" row drops the canary's first scheduled runs and v0.21.1, both done; and the settled line says lychee stays inlecture-dpandlecture-python.mystuntil action-link-checker checks links within a site (QuantEcon/action-link-checker#11)No CHANGELOG entry: this CI reaches no consumer, as with #328 and #331.
What I checked, and how
The two scheduled runs, re-read on 2026-11-23 with
gh run list --workflow <file> --event schedule --branch main --limit 1before any change. Both completed and succeeded, as didcache.yml's, all at32cab47, the canary'smain:cache.ymlci.ymlpublish.ymlThe watcher's check on the three, against the real canary. I ran
scripts/canary-watch.shlocally withCANARY_WORKFLOWS="cache.yml ci.yml publish.yml"andMAX_AGE_HOURS=192. It exited 0 with three green lines, one for each run above. The script already loops over a space-separated list, and its self-test covers two workflows (a.yml b.yml), so three needed no change to it. The canary'smainhas no other scheduled workflow: of its five,restore.ymlandgate.ymlrun by hand only.The new self-test cases fail on
main's code. I added the cases first and ranscripts/canary-drift.py --self-testbefore changingschedule_filters(). It exited 1:a filter with contains(): got [[]], expected [[…]]a filter with the cron first: got [[]], expected [[…]]a filter that skips a cron it has and reads the schedule again: got [[]], expected [[…]]canary-drift self-test: 3 case(s) failedEach
[[]]ismain'sschedule_filters()finding no problem, so each filter passed unseen. I added the fourth case,github.event['schedule'], after that run. Called directly,main'sschedule_filters()returns[]for it too, and this branch's returns the new problem. After the change, the self-test passes, and so do the two filters that must stay green:github.event_name != 'schedule', and a!=on a cron the workflow has.canary-watch.ymlitself still passes its own case.Index access on
eventtoo, from Copilot's review comment: at the first head,b7c2ca3, the pattern saw index access onscheduleonly, after a literalgithub.event. I added three cases first,github['event']['schedule'] == '30 6 * * *',github['event'].schedule != '30 6 * * *'andgithub [ "event" ] [ "schedule" ] != '30 6 * * *', and ran the self-test onb7c2ca3'sschedule_filters(). It exited 1 with3 case(s) failed, eachgot [[]]. Thegithub.event['schedule']case already passed there. After96dc00b, all pass, andgithub['event_name'] != 'schedule'stays green.The local checks, with actionlint 1.7.12 (the gate's pin, checked against the release's checksums) and shellcheck 0.11.0 on
PATH:python3 scripts/generate-docs.py --check --check-examples --actionlint …: the generated docs are current (23 files), and the 18 complete workflows pass actionlint.actionlint: clean.python3 scripts/lint-shell.py: clean.scripts/canary-drift.py --self-testandscripts/canary-watch.sh --self-test: both pass.What to watch after merge
canaryissue has been opened so far.ci.ymlandpublish.ymlthe watcher reads. A red run of either turns the watcher red at that day's 06:30 UTC run, and one that never comes turns it red on Monday 2026-11-30, once its newest run is more than 192 hours old.Not in this PR
schedule_filters()reads jobs'if:only, as before: the filter that thedriftjob's comment describes is a job's. A step'sif:is not read.canary-watchjob is unchanged. It already runs the drift check's self-test, which now holds the new cases.🤖 Generated with Claude Code
https://claude.ai/code/session_01WT8bMbaRe5RMw7Xxw1EnkG