Skip to content

CI: gate the first jb build so notebook errors cannot pass green - #367

Merged
mmcky merged 1 commit into
mainfrom
ci/gate-first-jb-build
Jul 30, 2026
Merged

CI: gate the first jb build so notebook errors cannot pass green#367
mmcky merged 1 commit into
mainfrom
ci/gate-first-jb-build

Conversation

@mmcky

@mmcky mmcky commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Part of QuantEcon/meta#340.

The problem

Build PDF from LaTeX is the first jb build in this workflow, and lectures/_config.yml sets execute_notebooks: "cache" — so it is the only build that actually executes notebooks; the later tojupyter and HTML builds read the cache. That makes it the step where a CellExecutionError surfaces.

It could not fail, for two independent reasons:

  • No -W. It ran with -n --keep-going, so a CellExecutionError was a non-fatal warning.
  • Its exit code was cp's, not jb build's. The step runs three commands under shell: bash -l {0}, and GitHub only injects -eo pipefail for the bare shell: bash shorthand — an explicit custom shell spec gets neither -e nor -o pipefail. So a failing jb build was followed by mkdir and cp, and the step exited with cp's status. --keep-going makes this worse rather than better, because it forces Sphinx to emit output despite the errors, guaranteeing the PDF exists for cp to succeed on.

Either fix alone is insufficient. Both are applied, to one step.

Note on which step

The rule is "gate the first jb build", not "gate a particular step name". Here the LaTeX step runs first; in lecture-python.myst, lecture-python-programming and lecture-jax the notebooks step does, so those get a one-line set -eo pipefail instead. The audit table in QuantEcon/meta#340 records which step applies per repo.

Verified before the change

  • No raises-exception tags anywhere in lectures/ — nothing is relying on an error being tolerated.
  • All 64 published lecture pages on python-advanced.quantecon.org were scanned for execution-error markers (output_error, tracebacks, ANSI red). Zero hits.

Since this step has never been able to fail, CI on this PR is the first real exercise of it. -W also promotes Sphinx warnings to errors, and the LaTeX builder emits warnings the HTML builder does not. If CI goes red it has found something genuine that was previously silent, and that should be fixed rather than the flags softened.

Refs QuantEcon/meta#340

🤖 Generated with Claude Code

"Build PDF from LaTeX" is the first `jb build` in this workflow, and
`execute_notebooks: "cache"` means only the first build executes notebooks
— the later tojupyter and HTML builds read the cache. So this step is
where a CellExecutionError surfaces, and it could not fail.

Two defects, both fixed here:

- it ran with `-n --keep-going` and no `-W`, so a CellExecutionError was a
  non-fatal warning
- its exit code was `cp`'s, not `jb build`'s. The step runs three commands
  under `shell: bash -l {0}`, and GitHub only injects `-eo pipefail` for the
  bare `shell: bash` shorthand; an explicit custom shell spec gets neither
  `-e` nor `-o pipefail`. `--keep-going` compounds it by guaranteeing the
  PDF exists for `cp` to succeed on

Checked before making the change: this repo has no `raises-exception` tags,
and all 64 published lecture pages render without execution-error output.

Refs QuantEcon/meta#340

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 30, 2026 04:53
@netlify

netlify Bot commented Jul 30, 2026

Copy link
Copy Markdown

Deploy Preview for lustrous-melomakarona-3ee73e ready!

Name Link
🔨 Latest commit 0114165
🔍 Latest deploy log https://app.netlify.com/projects/lustrous-melomakarona-3ee73e/deploys/6a6ad8cae4badf000875de25
😎 Deploy Preview https://deploy-preview-367--lustrous-melomakarona-3ee73e.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

Pull request overview

This PR strengthens CI by ensuring the first jb build (the one that actually executes notebooks due to execute_notebooks: "cache") fails the workflow on notebook execution errors and on Sphinx warnings.

Changes:

  • Add set -eo pipefail to ensure the step fails on jb build non-zero exit (not masked by subsequent commands).
  • Add -W to treat Sphinx warnings as errors for the initial PDF/LaTeX build.
  • Document the rationale directly in the workflow for maintainability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Comment on lines +62 to +63
set -eo pipefail
jb build lectures --builder pdflatex --path-output ./ -n -W --keep-going
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot temporarily deployed to pull request July 30, 2026 05:03 Inactive
@mmcky
mmcky merged commit 2f9c8d3 into main Jul 30, 2026
10 checks passed
@mmcky
mmcky deleted the ci/gate-first-jb-build branch July 30, 2026 05:40
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.

2 participants