Skip to content

build-lectures: a raising cell passed -W --keep-going in a cache-mode jupyter build; only the error-output check caught it #300

Closed

Description

@mmcky

A cell that raises didn't fail build-lectures' build under -W --keep-going. The release gate's staged-failure self-test showed it (QuantEcon/test-actions-lecture-intro run 42766210377, job "Build the cache", 2026-11-10 ~06:07 UTC):

  • build-jupyter-cache at v0.17.0 ran jb build gate/lectures --path-output . --builder=custom --custom-builder=jupyter -n -W --keep-going;
  • myst-nb logged gate/lectures/figures.md: WARNING: Executing notebook failed: CellExecutionError [mystnb.exec] for a cell that raises a RuntimeError;
  • jb build exited 0, and the build step's outcome was success. The pdflatex and html builds that followed also passed -W, with build succeeded.

The run went red only through #256's error-output check (check-error-outputs.py). Its message says "The kernel reported this cell as successful, so -W did not catch it", which is wrong for a cell that raised.

The setup matches the lecture sites: execute_notebooks: cache, the lean image (quantecon-build@sha256:d7676921…), and build-lectures' default extra-args: -W --keep-going.

Why it matters. A site on the default error-outputs: fail is protected by the error-output check. A site with error-outputs: warn or ignore would publish the traceback from a green build. docs/dev/TESTING.md and build-lectures' chapter may also claim -W catches a raising cell, and that needs checking.

To find out:

  • whether it reproduces with the html builder executing, as well as the custom jupyter builder;
  • whether it reproduces outside cache mode, with execute_notebooks: force;
  • what jupyter-book 1.0's --builder=custom does with -W and --keep-going, and whether myst-nb's execution warning is raised where Sphinx's warning-as-error handling sees it;
  • what the error-output check's message should say, depending on the answers.

The cheapest reproduction is a throwaway harness job with one raising cell, run under each builder and each execution mode.

Claude Code (on behalf of mmcky), organiser session; found by the mini:actions-gate session

Activity

  1. mmcky commented on Nov 10, 2026

    @mmcky
    ContributorAuthor

    Cause: confirmed. In a jupyter build, -W --keep-going fails on no warning at all, not only a raised cell. sphinx-tojupyter's JupyterBuilder.finish() ends with exit(self.execution_status_code): SystemExit(0), raised inside Sphinx's app.build(). That is before Sphinx turns --keep-going's counted warnings into exit status 1. SystemExit isn't an Exception, so neither Sphinx nor jupyter-book catches it, jb build exits 0, and the log has no build succeeded or build finished with problems line. With -W alone the build fails at the first warning, before finish(). Reproduced with the canary's versions, with a book that executes nothing: the jupyter build exits 0 with three warnings under -W --keep-going. With tojupyter's exit() taken out, the same build exits 1 with build finished with problems, 3 warnings. The execution mode doesn't matter.

    The pdflatex and html builds passed because they read nothing. They shared the jupyter build's _build/.doctrees and logged 0 added, 0 changed, 0 removed, so figures.md never ran again. A cold html build fails correctly: build-fail-guard shows it on every harness run. Within one job, only the first build reads and executes the pages. In build-jupyter-cache, whenever jupyter is listed it is that first build, so it must fail on its own warnings.

    The plan (#305):

    • build-lectures. For builder: jupyter, when jb build exits 0 under -W --keep-going and Sphinx logged warnings, the step fails and names them. build-jupyter-cache gets the same through build-lectures@v0.
    • The error-output check. It tells a cell that raised from one whose display raised, by whether the notebook ran on after it. "The kernel reported this cell as successful" stays only where that is true.
    • Docs. The chapter's claims about -W and the jupyter builder are corrected.
    • A harness job that fails on today's code.

    Exposure.

    • No caller in the org sets error-outputs: warn or ignore, or extra-args.
    • The canary's, test-lecture-theme-sphinx's and lecture-dp's builds log no jupyter warning today.
    • In the lecture matrix, the jupyter builds of lecture-python.myst, lecture-python-programming and lecture-python-advanced.myst log tojupyter_static_path entry …/source/_static does not exist, a stale entry in their _config.yml. Those builds would go red once this lands, so the entry is best dropped first.

    Upstream. The lecture repos' own pipelines run tojupyter with -n -W --keep-going as their gate (QuantEcon/meta#340). For the same reason, that gate passes every warning, which is what QuantEcon/lecture-python.zh-cn#271 saw in the field. Only a sphinx-tojupyter fix reaches them, and that will be proposed separately.

    The maintainer's decisions, 2026-11-10: the build-lectures change is ⚠️ BREAKING, with a migration line; one-line PRs drop the stale "source/_static" from tojupyter_static_file_path in lecture-python.myst, lecture-python-programming and lecture-python-advanced.myst, and merge before this fix; an issue in QuantEcon/sphinx-tojupyter follows those PRs; the new check covers the jupyter builder only.

    Claude Code (on behalf of mmcky)

  2. mmcky commented on Nov 11, 2026

    @mmcky
    ContributorAuthor

    The upstream cause is now QuantEcon/sphinx-tojupyter#69. #307 makes build-lectures catch the warnings; the lecture repos' own notebook gates keep passing them until that issue is resolved upstream.

    Claude Code (on behalf of mmcky)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions