Skip to content

Harness follow-ups from #116: attribute the negative build test, document the -W dependence - #118

Merged
mmcky merged 3 commits into
mainfrom
fix/116-harness-followups
Aug 5, 2026
Merged

mmcky merged 3 commits into
mainfrom
fix/116-harness-followups

Conversation

@mmcky

@mmcky mmcky commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Items 3 and 4 from #116, plus one harness property that review turned up. No consumer-facing behaviour changes — one CI assertion and two docs corrections.

Item 3 — build-fail-guard accepted any red

The job asserted only that the build step's outcome was failure. A build that died on some unrelated -W warning satisfies that just as well, so the job could stay green while the property it exists to guard — a failing build fails the step — was broken. It now also requires the staged traceback at harness/_build/html/reports/broken.err.log and checks that the log carries the fixture's own assertion message, so the red is provably this job's deliberate CellExecutionError.

The $OUTCOME check stays first, because a stale err.log survives an incremental rebuild that exits 0 — the file existing is not by itself evidence that the build failed. The path is hard-coded rather than globbed on purpose: it is the same path build-lectures ships in upload-failure-reports, so a jupyter-book layout change goes red here instead of silently producing an empty artifact there.

Item 4 — the -W dependence was recorded nowhere

A code cell that raises is not an error to Jupyter Book. myst-nb logs it as a warning and carries on, so -W in the extra-args default is the only reason a broken lecture fails the build — and extra-args replaces the default rather than extending it. A consumer who overrides extra-args without -W gets a published site, an error-report page, and exit 0: green CI over a broken lecture. The README documented what -W does but never that it was load-bearing.

The Troubleshooting step that suggested bare --keep-going to see all errors is also corrected — without -W it reports nothing extra.

New: "Re-run failed jobs" can never go green on this harness

Not in #116, found while reviewing it. SALT is run_id-run_attempt. GitHub increments run_attempt on a re-run but does not re-run already-green jobs, so the seeds stay put while the restore/hit jobs rebuild their fixtures under a new salt and look for caches nobody saved; fail-on-miss then fires. Only "Re-run all jobs" works. Every run to date is attempt=1, which is why it has never been hit. Recorded in the workflow header rather than "fixed" — dropping run_attempt from the salt would let attempt 2 reuse attempt 1's caches and silently invalidate the miss assertions.

Verification

Both docs claims were checked against a real build rather than reasoned about (jupyter-book 1.0.4.post1 / myst-nb 1.4.0, harness fixture with the same staged failure):

Build Exit reports/broken.err.log Site
-W --keep-going 1 written —
--keep-going only 0 written broken.html published
raise_on_error: true, no -W 1 not written aborted

The middle row is the failure mode the new README warning describes. The bottom row is why that warning prefers -W over raise_on_error.

The new assertion block was extracted from the YAML and run under bash -e against the real failed build tree: passes on it, and fails with a useful message when the report is absent or carries a different failure. Workflow still parses (14 jobs, build-fail-guard unchanged in shape).

CI is the real check — this PR touches .github/workflows/test-actions.yml, so the harness runs on it and build-fail-guard exercises the new assertion end to end.

Not included

#116 items 1, 2 and 5 are unchanged here. Item 1 is blocked on the release that moves v0; items 2 and 5 need their premises corrected first, which I'll do on the issue.

Refs #116

🤖 Generated with Claude Code

mmcky and others added 2 commits August 5, 2026 11:16
`build-fail-guard` asserted only that the step outcome was `failure`, which a
build that died on any unrelated `-W` warning would also satisfy — the job
could stay green while the property it guards (a failing build fails the step)
was broken.

It now also requires the staged traceback in
harness/_build/html/reports/broken.err.log, and that the log carries the
fixture's own assertion message, so the red is provably this job's deliberate
CellExecutionError. The `$OUTCOME` check stays first: a stale err.log survives
an incremental rebuild that exits 0, so the file existing is not by itself
evidence of failure.

The path is hard-coded rather than globbed on purpose — it is the same path
build-lectures ships in `upload-failure-reports`, so a jupyter-book layout
change goes red here instead of silently producing an empty artifact there.

Verified against a real failed build (jupyter-book 1.0.4.post1, myst-nb 1.4.0):
`jb build harness/lectures --path-output harness -W --keep-going` exits 1 and
writes exactly that path, and the assertion passes on the resulting tree and
fails when the report is absent or carries a different failure.

Also records a harness property that cost time to rediscover: "Re-run failed
jobs" can never go green here, because it bumps run_attempt (and so the cache
salt) without re-running the already-green seed jobs.

Refs #116

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A code cell that raises is not an error to Jupyter Book — myst-nb logs
"Executing notebook failed: CellExecutionError" as a *warning* and carries on
(`raise_on_error` defaults to false). `-W` in the `extra-args` default is the
only reason a broken lecture fails the build, and `extra-args` replaces the
default rather than extending it. A consumer who overrides it without `-W`
gets a published site, an error-report page, and exit 0 — green CI over a
broken lecture. That was recorded nowhere in the docs.

Verified empirically on the harness fixture: with `-W` the build exits 1; with
only `--keep-going` it exits 0 and still publishes broken.html. The
`raise_on_error: true` alternative exits 1 without `-W` but aborts before
writing the reports/ tracebacks, which is why the note prefers `-W`.

Also corrects the Troubleshooting step that suggested bare `--keep-going` to
see all errors; without `-W` it reports nothing extra.

Refs #116

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings August 5, 2026 01:16

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 tightens the action-harness negative build test so it can attribute the expected failure to the staged notebook execution error, and updates build-lectures documentation to make the -W dependency explicit (plus a small troubleshooting correction). It fits into the repo’s ongoing effort to make composite actions and their CI harness assertions more robust and self-explanatory.

Changes:

  • Strengthen build-fail-guard to require the expected broken.err.log and a known assertion message, not just a failed step outcome.
  • Document that -W is load-bearing for notebook-execution failures to fail CI, and clarify troubleshooting guidance.
  • Record in the harness workflow header why “Re-run failed jobs” cannot succeed with the current cache salting strategy.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
CHANGELOG.md Adds Unreleased notes describing the harness assertion tightening and the -W documentation clarification.
build-lectures/README.md Documents the -W dependency and updates troubleshooting guidance around --keep-going.
.github/workflows/test-actions.yml Enhances build-fail-guard to attribute failures to the staged execution error and documents rerun behavior constraints.
Suppressed comments (1)

build-lectures/README.md:235

  • In the notebook-execution failure troubleshooting, the parenthetical "--keep-going without -W reports nothing extra" is overly absolute. More precisely: without -W, execution failures stay warnings, so --keep-going won’t turn them into build-stopping errors or help surface additional failing notebooks as errors.
3. Re-run locally the way CI does — `jb build lectures -W --keep-going` — to see every error that
   fails the build (`--keep-going` without `-W` reports nothing extra)

Comment thread build-lectures/README.md Resolved
Copilot read "on its own it does nothing" as an overly absolute claim. The
claim is correct, but the README asserted it without evidence, so it invited
exactly that doubt. Both places now carry the reason.

Sphinx gates the flag on -W in application.py:

    self.keep_going = warningiserror and keep_going

so without -W it is False regardless, and the only site that reads it
(`if self._warncount and self.keep_going: self.statuscode = 1`) is
unreachable. Sphinx's own help says "with --fail-on-warning, keep going when
getting warnings", and jupyter-book's says "With -W, do not stop the build on
the first warning" — jb only forwards the flag to Sphinx(keep_going=...).

Refs #116

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@mmcky
mmcky merged commit d4a1cb5 into main Aug 5, 2026
14 checks passed
@mmcky
mmcky deleted the fix/116-harness-followups branch August 5, 2026 02:29
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