Skip to content

ci(book): fail the book build on Sphinx warnings - #733

Closed
vyncint wants to merge 1 commit into
NVIDIA:mainfrom
vyncint:fix/book-warnings-are-errors
Closed

vyncint wants to merge 1 commit into
NVIDIA:mainfrom
vyncint:fix/book-warnings-are-errors

Conversation

@vyncint

@vyncint vyncint commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Closes #732.

The book is the only documentation surface without warnings-as-errors. The Rust
docs gate builds under RUSTDOCFLAGS="-D warnings" and docs.yml states the
reason — "keeps broken intra-doc links and uncompilable doc examples from
accumulating silently"
— while sphinx-build ran bare.

Demonstrated

Appending one dangling link to index.md:

$ sphinx-build -b html cuda-oxide-book _build            # what CI runs today
build succeeded.
exit 0                                                    # <- publishes it

$ sphinx-build -W --keep-going -b html cuda-oxide-book _build
WARNING: 'myst' cross-reference target not found: 'does-not-exist.md' [myst.xref_missing]
exit 1

--keep-going reports every warning in one run instead of stopping at the first,
which matters when a rename breaks several references at once.

Costs nothing today

The book is already clean — sphinx-build -W --keep-going exits 0 with zero
warnings
on main (Sphinx 9.1.0, installed from
cuda-oxide-book/requirements.txt).

The Makefile gets the same default so make html catches locally what CI
catches, and it stays overridable for a draft build:

SPHINXOPTS= make html

Verified make html still exits 0 with the new default.

One caveat, stated plainly

requirements.txt uses >= constraints, so CI floats to the newest Sphinx. A
future release that introduces a deprecation warning would then fail the book
build rather than merely mention it. --keep-going at least surfaces all of them
at once. If you would rather not take that exposure, pinning the Sphinx major in
requirements.txt removes it — happy to add that here or drop the -W entirely.

No GPU needed for any of this.

The book was the only documentation surface without warnings-as-errors. The Rust
docs gate builds under RUSTDOCFLAGS="-D warnings" and says why -- to keep broken
intra-doc links from accumulating silently -- while sphinx-build ran bare, so a
broken cross-reference, a malformed directive, or a page dropped from a toctree
exited 0 and published.

Appending one dangling link to index.md shows the gap:

    $ sphinx-build -b html cuda-oxide-book _build          # before
    build succeeded.                                        # exit 0, publishes

    $ sphinx-build -W --keep-going -b html cuda-oxide-book _build
    WARNING: 'myst' cross-reference target not found: 'does-not-exist.md'
                                                            # exit 1

`--keep-going` reports every warning in one run rather than stopping at the
first, which matters when a rename breaks several references at once.

The book is already clean, so this costs nothing now: with the pinned
requirements the flagged build exits 0 on main with zero warnings. The Makefile
gets the same default so `make html` catches locally what CI would catch, and it
stays overridable for a draft build with `SPHINXOPTS= make html`.

Note requirements.txt uses `>=`, so CI floats to the newest Sphinx and a release
that adds a deprecation warning would fail this. Pinning the Sphinx major would
remove that exposure if it is unwanted.

Closes NVIDIA#732

Signed-off-by: Vyncint Ng <[email protected]>
@nihalpasham nihalpasham added documentation Improvements or additions to documentation enhancement New feature or request build-related Build scripts, toolchain discovery, or compilation setup labels Aug 10, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Verified the -W build passes clean with today's Sphinx resolution (9.1.0). Since #744 carries this exact commit, we're landing #744 and closing this one as already-fixed

nihalpasham added a commit that referenced this pull request Aug 10, 2026
* ci(book): fail the book build on Sphinx warnings

The book was the only documentation surface without warnings-as-errors. The Rust
docs gate builds under RUSTDOCFLAGS="-D warnings" and says why -- to keep broken
intra-doc links from accumulating silently -- while sphinx-build ran bare, so a
broken cross-reference, a malformed directive, or a page dropped from a toctree
exited 0 and published.

Appending one dangling link to index.md shows the gap:

    $ sphinx-build -b html cuda-oxide-book _build          # before
    build succeeded.                                        # exit 0, publishes

    $ sphinx-build -W --keep-going -b html cuda-oxide-book _build
    WARNING: 'myst' cross-reference target not found: 'does-not-exist.md'
                                                            # exit 1

`--keep-going` reports every warning in one run rather than stopping at the
first, which matters when a rename breaks several references at once.

The book is already clean, so this costs nothing now: with the pinned
requirements the flagged build exits 0 on main with zero warnings. The Makefile
gets the same default so `make html` catches locally what CI would catch, and it
stays overridable for a draft build with `SPHINXOPTS= make html`.

Note requirements.txt uses `>=`, so CI floats to the newest Sphinx and a release
that adds a deprecation warning would fail this. Pinning the Sphinx major would
remove that exposure if it is unwanted.

Closes #732

Signed-off-by: Vyncint Ng <[email protected]>

* ci(book): build the book on pull requests, deploy only from main

book.yml had no `pull_request` trigger, so the book was built only after merge.
Every other content gate -- ci, docs, examples-compile, codeql, naming-guard,
status-guard -- runs on PRs. A pull request that broke a cross-reference, a
directive or a toctree entry therefore reached main unchallenged, and the first
signal was a failure on the branch everyone builds from.

Adding the trigger is not sufficient on its own. This is a deployment workflow:
it holds `pages: write` / `id-token: write` and a deploy job, which is presumably
why it was push-only, and a naive trigger would attempt a Pages deploy from every
pull request. So `deploy` is gated on `github.event_name != 'pull_request'`: a PR
builds the book to prove it is sound and stops there, never touching the Pages
environment.

The workflow-level `concurrency: group: pages` needed the same care. It exists to
serialise deploys, and leaving it workflow-wide would queue unrelated PR builds
behind each other. It moves onto the deploy job, where the constraint actually
applies, and the workflow-level group becomes ref-scoped. Superseded PR runs are
cancelled; pushes to main are not, so a publish in flight is never interrupted.

Stacked on #733: with `-W` in place a PR build now fails on a warning instead of
publishing one, which is the half that makes this trigger worth having.

Closes #743

Signed-off-by: Vyncint Ng <[email protected]>

* ci(book): scope Pages permissions to the deploy job, bound the Sphinx major

Pull requests now run the build job, so the workflow-level token they
receive should hold checkout rights only; `pages: write` and
`id-token: write` move onto the deploy job, the only place they are
used. With `-W` gating every PR, an unbounded `sphinx>=7.0` float lets
a new Sphinx major redden every PR and the main-branch deploy
overnight; bound it below 10 so majors are adopted deliberately.

---------

Signed-off-by: Vyncint Ng <[email protected]>
Co-authored-by: nihalpasham <[email protected]>
@nihalpasham nihalpasham added the already-fixed Resolved on a newer commit or branch; no action needed label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

already-fixed Resolved on a newer commit or branch; no action needed build-related Build scripts, toolchain discovery, or compilation setup documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Book CI builds without -W, so a broken cross-reference publishes silently

2 participants