Skip to content

ci(lecture-validation): retry a failed HTML build once with --all; restore lecture-python-programming to the matrix - #203

Merged
mmcky merged 2 commits into
mainfrom
claude/brave-allen-3xo5jk
Sep 28, 2026
Merged

mmcky merged 2 commits into
mainfrom
claude/brave-allen-3xo5jk

Conversation

@quantecon-services

@quantecon-services quantecon-services commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #102. Built independently of #144, which was not consulted.

What changes

test-containers-lectures.yml

  • The Build HTML (Execute Notebooks) step gets id: build-html and continue-on-error: true. A Build HTML (Retry) step runs on steps.build-html.outcome == 'failure', with extra-args: -W --keep-going --all and its own failure-artifact-name (reports-html-retry-<container>-<repo>): build-lectures uploads the reports under that name on failure, and a run cannot hold two artifacts of one name.
  • Between the two, a small run: step clears lecture-repo/_build/html/reports (its contents are already in the first attempt's artifact, so a retry that also fails reports only what failed on the retry) and writes one line to the job summary, so a leg that went green only on retry still shows it happened.
  • lecture-python-programming is back in the matrix, with a comment saying when and how it left. The February 2026 rewrite (81e96ff) dropped it without a note, unlike lecture-jax.

Docs: docs/dev/CONTAINER-VALIDATION.md describes the retry and lists the four-repo matrix; it and docs/dev/TESTING.md name the repo by its current name (the old .myst rows were the "4-repo claims" the issue cites). CHANGELOG entries under Unreleased / Fixed. docs/dev/PLAN.md's #102 row records this PR.

Why the retry passes --all

The issue proposes a plain second run of the step. I checked what that does on a fixture with execute_notebooks: cache, jupyter-book 1.0.4post1 / myst-nb 1.4.0 / Sphinx 7.4.7, with a notebook that raises unless a flag file exists (a stand-in for the 429) and a counter that records each execution:

Case Plain rebuild Rebuild with --all
Transient execution failure, then the fault clears exit 0, but the failed notebook is not re-executed and the page still carries the traceback exit 0; failed notebook re-executed, cached notebook not (stays at 1 execution)
Persistent execution failure exit 0 exit 1
Warning-only failure (undefined label) exit 0 exit 1

After a failed -W --keep-going build the saved Sphinx environment counts every page as up to date, so a plain rebuild reads nothing, re-emits no warning and exits 0. A plain retry would therefore have passed every persistent failure, which is the opposite of the issue's acceptance criterion. --all (jupyter-book's flag for a fresh Sphinx environment) re-reads every page and re-checks every warning, while the jupyter cache in _build/.jupyter_cache still spares the notebooks that executed, so the retry re-executes only what failed. The harness already hints at this: build-fail-guard notes that "a stale err.log survives an incremental rebuild that exits 0".

The cost is one non-executing Sphinx pass over the repo on a retried leg. For lecture-python.myst that fits inside its 180-minute ceiling from #197; a leg that overran would still be cancelled and alerted exactly as today.

Verified

  • actionlint clean on the workflow; YAML parses with the intended step chain (id, continue-on-error, the two gated steps, distinct artifact names).
  • The workflow's exact chain (attempt, clear reports, retry with --all, using build-lectures' command shape with lecture-repo/lectures and --path-output lecture-repo) run on the fixture for both a transient and a persistent failure: the transient case ends green with the reports directory gone and the log showing Using cached notebook for the good notebook and a re-execution of the failed one; the persistent case ends red naming only the failing notebook.
  • The summary/clear step's shell executed against a stand-in tree.

Not verified here

  • The workflow triggers only on workflow_run and workflow_dispatch, so this PR cannot exercise it. Per the issue's third checkbox, a maintainer workflow_dispatch after merge validates it; the first weekly run after that exercises lecture-python-programming on the images.
  • The claim that all four matrix repos build with execute_notebooks: cache is taken from the issue (it is what already lets stages 2 and 3 skip execution). Under any other mode the retry would still be correct, only slower.

Notes

  • On a leg the retry turns green, the first attempt's ::error:: annotation and traceback still appear in the log. That is deliberate: it, the reports-html-<container>-<repo> artifact and the job-summary line are how a flake stays visible.
  • docs/MIGRATION-GUIDE.md, docs/QUICK-REFERENCE.md and containers/README.md still use lecture-python-programming.myst; they make no matrix claim, so they were left for a docs sweep.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MU3sPZhQdCPfzyX6rnaXdd

…store lecture-python-programming to the matrix

Fixes #102.

Several lectures fetch a dataset from raw GitHub in a hidden cell at
build time, and with the matrix building several repos at once from
shared runner IPs that fetch is sometimes refused with HTTP 429. It is
transient (the same notebook passed on the other container in the same
run), but nothing in the stack retries it, so one 429 failed the leg
and, off the weekly workflow_run trigger, filed a CI-failure issue.

The "Build HTML" step gets an id and continue-on-error, and a second
attempt runs when its outcome is failure, with its own
failure-artifact-name (a run cannot hold two artifacts of one name).
Between the two, a step clears the first attempt's reports directory,
whose contents are already in that attempt's artifact, and records the
retry in the job summary so a green leg still shows it happened.

The retry passes --all. A plain second `jb build -W --keep-going` after
a failed one is not a retry: the saved Sphinx environment counts every
page as up to date, so it reads nothing, re-executes nothing, re-emits
no warning and exits 0 with the traceback still in the page. Measured
on a fixture with jupyter-book 1.0.4post1 / myst-nb 1.4.0: a persistent
execution failure and a warning-only failure both "passed" on a plain
rebuild, and the failed notebook was not re-run. With --all every page
is re-read and every warning re-checked, while execute_notebooks: cache
still spares the notebooks that executed (the cached one stayed at one
execution; only the failed one ran again), and a persistent failure
fails the retry.

lecture-python-programming returns to the matrix. The February 2026
rewrite (81e96ff) dropped it without a note, unlike lecture-jax, while
CONTAINER-VALIDATION.md and TESTING.md went on describing four repos.
Those docs now list it under its current name, and CONTAINER-VALIDATION
describes the retry.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MU3sPZhQdCPfzyX6rnaXdd
The #102 row names the PR and what it does (a failed HTML stage rebuilt
once with --all, lecture-python-programming back in the matrix), notes
#144 as the earlier open PR for the same issue, and the "Last updated"
header gains a 2026-09-28 entry.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MU3sPZhQdCPfzyX6rnaXdd

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.

Copilot review overview

🔵 Needs a closer look

The change alters the critical validation workflow and its correctness depends on runtime --all/jupyter-cache and continue-on-error behavior that cannot be exercised by a PR and requires the maintainer workflow_dispatch validation the issue mandates.

Review effort: Balanced
Findings: None

What changed in this PR

This PR hardens the test-containers-lectures.yml validation workflow against transient raw-GitHub HTTP 429 failures (issue #102) and restores a matrix repo that was silently dropped. The HTML build stage now runs once with continue-on-error, and on failure a second attempt rebuilds with --all (a fresh Sphinx environment) so that persistent failures still fail while transient ones — whose notebooks are absent from the surviving jupyter cache — are re-executed and pass. It fits the repo's ongoing CI-reliability work and pairs the fix with lecture-python-programming being added back to the matrix (which itself has raw-GitHub fetches and depends on this retry).

Changes:

  • Add id/continue-on-error to the HTML build step, a report-clearing + job-summary step, and a gated Build HTML (Retry) step using extra-args: -W --keep-going --all with a distinct reports-html-retry-* artifact name.
  • Restore the lecture-python-programming matrix entry with an explanatory comment.
  • Update CHANGELOG, PLAN, CONTAINER-VALIDATION, and TESTING docs (retry description + repo rename to the non-.myst name).
File Description
.github/​workflows/​test-containers-lectures.yml Adds the retry mechanism (id, continue-on-error, clear-reports step, --all retry with distinct artifact name) and restores the lecture-python-programming matrix row.
CHANGELOG.md Two Unreleased / Fixed entries documenting the retry and the restored matrix repo.
docs/​dev/​CONTAINER-VALIDATION.md Describes the two-attempt HTML stage, lists the four-repo matrix, and renames the repo.
docs/​dev/​TESTING.md Renames lecture-python-programming.myst → lecture-python-programming.
docs/​dev/​PLAN.md Updates the "Last updated" note and the #102 backlog row to reference this PR (#203).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mmcky
mmcky merged commit c0ac111 into main Sep 28, 2026
25 checks passed
@mmcky
mmcky deleted the claude/brave-allen-3xo5jk branch September 28, 2026 02:14
mmcky pushed a commit that referenced this pull request Sep 28, 2026
… it (#214)

* docs(plan): record #102 as closed by #203, and the run that exercised it

The #102 row still said to review #203 and to validate it with a
maintainer dispatch after merge, and called #144 open. #203 merged on
2026-09-28 and closed #102, and #144 was closed unmerged.

The weekly matrix run the same day (36370003884) did the validation
the row asked for. Six of eight legs passed, lecture-python-programming
on both images among them. Both lecture-python.myst legs failed the
retry on bayes_nonconj alone, which is the retry working as intended:
a persistent failure still fails the leg.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SUGTRULyyM87pug2MckrXo

* docs(plan): cite the lecture-side fix, not the CI alert, in the #102 row

The row said bayes_nonconj's fix belongs in lecture-python.myst and then
cited #159, which is this repo's CI-failure alert for the red matrix,
not that fix. It now links lecture-python.myst#1065 for the fix and names
#159 as what tracks the red matrix. Raised in Copilot's review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SUGTRULyyM87pug2MckrXo

---------

Co-authored-by: Claude <[email protected]>
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.

test-containers-lectures: absorb transient raw-GitHub 429s when building lecture repos

4 participants