Skip to content

ci(canary-watch): read the canary's scheduled ci.yml and publish.yml runs - #350

Merged
mmcky merged 3 commits into
mainfrom
ci/302-canary-pr-d
Nov 22, 2026
Merged

mmcky merged 3 commits into
mainfrom
ci/302-canary-pr-d

Conversation

@mmcky

@mmcky mmcky commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

The canary watcher now reads the scheduled runs of all three of the canary's scheduled workflows, cache.yml, ci.yml and publish.yml, where until now it read cache.yml alone. 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 of canary-watch.yml's schedule filters could miss a filter that reads github.event.schedule in any way but == '<cron>' or != '<cron>'.

Closes #302

Why. The canary's ci.yml and publish.yml gained their Sunday schedules in QuantEcon/test-actions-lecture-intro#94, and the watcher was to list them once each had a scheduled run on main to 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

File Change
.github/workflows/canary-watch.yml CANARY_WORKFLOWS: cache.yml ci.yml publish.yml. The comment above it no longer says the other two join later. The drift job's comment says the self-test also fails on a filter that reads the schedule any other way
scripts/canary-drift.py schedule_filters() reports any read of github.event.schedule in a job's if: that its comparison pattern does not account for: contains(), startsWith(), a comparison with the cron first, or index access on event or schedule, such as github['event']['schedule'], in either quote. Only github.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 forms
docs/dev/TESTING.md The watcher's row in the table, and its "scheduled runs" bullet, list the three workflows
docs/dev/PLAN.md The canary paragraph says the watcher reports a scheduled run of any of the three. P0 item 0c was the P0 table's only row, so the table goes, and the P0 section ends by saying what covers what the gate does not test, and that no P0 item is open. The "Release gating" row leaves the open-issues table, since #302 was its only issue. Three lines the organiser owed PLAN, carried here as the next PLAN change: the lectures consumer row names the four sites QuantEcon/lectures' site-build.yml builds; the "Work plan" row drops the canary's first scheduled runs and v0.21.1, both done; and the settled line says lychee stays in lecture-dp and lecture-python.myst until 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 1 before any change. Both completed and succeeded, as did cache.yml's, all at 32cab47, the canary's main:

Workflow Run Created
cache.yml 44964654485 2026-11-22 00:02 UTC
ci.yml 44970025548 2026-11-22 01:08 UTC
publish.yml 44974469205 2026-11-22 02:05 UTC

The watcher's check on the three, against the real canary. I ran scripts/canary-watch.sh locally with CANARY_WORKFLOWS="cache.yml ci.yml publish.yml" and MAX_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's main has no other scheduled workflow: of its five, restore.yml and gate.yml run by hand only.

The new self-test cases fail on main's code. I added the cases first and ran scripts/canary-drift.py --self-test before changing schedule_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) failed

Each [[]] is main's schedule_filters() finding no problem, so each filter passed unseen. I added the fourth case, github.event['schedule'], after that run. Called directly, main's schedule_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.yml itself still passes its own case.

Index access on event too, from Copilot's review comment: at the first head, b7c2ca3, the pattern saw index access on schedule only, after a literal github.event. I added three cases first, github['event']['schedule'] == '30 6 * * *', github['event'].schedule != '30 6 * * *' and github [ "event" ] [ "schedule" ] != '30 6 * * *', and ran the self-test on b7c2ca3's schedule_filters(). It exited 1 with 3 case(s) failed, each got [[]]. The github.event['schedule'] case already passed there. After 96dc00b, all pass, and github['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-test and scripts/canary-watch.sh --self-test: both pass.

What to watch after merge

  • The next daily Canary Watch run, at 06:30 UTC, reads all three workflows. Its "scheduled runs" check should stay green, with three ✅ lines in its summary, and file nothing: no canary issue has been opened so far.
  • The canary's next Sunday runs, on 2026-11-29, are the first new runs of ci.yml and publish.yml the 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

🤖 Generated with Claude Code

https://claude.ai/code/session_01WT8bMbaRe5RMw7Xxw1EnkG

…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
Copilot AI adaptive review requested due to automatic review settings November 22, 2026 23:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.yml and publish.yml alongside cache.yml to 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)

Comment thread scripts/canary-drift.py Outdated
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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

mmcky and others added 2 commits November 23, 2026 10:06
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
@mmcky
mmcky merged commit 06b493f into main Nov 22, 2026
147 of 150 checks passed
@mmcky
mmcky deleted the ci/302-canary-pr-d branch November 22, 2026 23:29
@mmcky mmcky mentioned this pull request Nov 28, 2026
mmcky added a commit that referenced this pull request Nov 28, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Canary: schedule ci.yml and publish.yml ahead of the consumers' Monday builds (PLAN P0 0c)

2 participants