Skip to content

docs: fix dead heading anchors and fail the docs build on warnings - #2476

Open
NoahKusaba wants to merge 3 commits into
apache:mainfrom
NoahKusaba:docs/sphinx-anchors-strict-build
Open

NoahKusaba wants to merge 3 commits into
apache:mainfrom
NoahKusaba:docs/sphinx-anchors-strict-build

Conversation

@NoahKusaba

@NoahKusaba NoahKusaba commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Every intra-doc anchor link is dead on the published site. myst_heading_anchors was never set, so MyST emits no heading ids and all file.md#heading links 404. They resolve on GitHub, which is why nobody noticed. sphinx-build on main reports 16 warnings.

What changes are included in this PR?

  • Set myst_heading_anchors = 4 in docs/source/conf.py. This fixes the 13 dead cross-references and changes how every Markdown page renders (heading ids are now emitted).
  • Fix the remaining three warnings: a short title overline in index.rst, code-organization.md starting at H2, and a link in introduction.md to a directory rather than a document.
  • Pull requests that touch the docs now build them in CI and fail on any warning, so a broken cross-reference is caught before merge. docs/build.sh is strict by default for local builds. The deploy on main still publishes if a warning slips through, so the site never stops updating.

Are there any user-facing changes?

Links on the published docs site that 404 today will work. For contributors, docs PRs now fail CI on warnings, and so does a local ./build.sh.

Verified: sphinx-build -W --keep-going is clean, 0 warnings (16 on main).

Note: this and the ruff PR both touch docs/source/conf.py on adjacent lines, so whichever lands second may need a trivial rebase.

Split out of #2438 to make it easier to review.

🤖 Generated with Claude Code

myst_heading_anchors was never set, so MyST emitted no heading ids and every
file.md#heading link 404'd on the published site (they resolve on GitHub).
Set it, and fix the other warnings: a short title overline in index.rst, a
page starting at H2, and a link to a directory rather than a document.

docs/build.sh now builds with -W --keep-going so a broken cross-reference
fails instead of shipping. sphinx-build goes from 16 warnings to 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread docs/build.sh Outdated

rm -rf build
make html
SPHINXOPTS="-W --keep-going" make html

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should fail the docs build on warnings unless we have a PR check to ensure that we don't merge PRs that introduce warnings. Our docs would just stop getting published in CI

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. As it stood, the first warning to land would have silently stopped the site publishing. I've changed it so warnings are caught on the PR and never block publishing:

  • docs.yaml now also runs on pull requests that touch the docs, failing on warnings and skipping the asf-site checkout and push.
  • The deploy on main publishes even with warnings, since one can still sneak in when two PRs are only broken together.
  • build.sh stays strict by default so local builds catch them, and SPHINXOPTS overrides it (the deploy passes it empty).

…on them

Failing the docs build on warnings only in the deploy job would stop the site
from publishing, with nothing flagging the PR that caused it. Build the docs
on pull requests that touch them, failing on warnings, and skip the asf-site
checkout and push there. The deploy on main publishes regardless, since a
warning can still reach main when two PRs are only broken together.

build.sh stays strict by default, so local builds catch warnings, and takes
SPHINXOPTS to override it. The push and pull_request triggers share one path
list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development-process documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants