build: build the documentation in CI - #67
Merged
Merged
Conversation
Nothing built these docs, so a change to the CLI parser or to a cross-reference could break them and no check would notice. ctrliq#40 recorded the reason: reference.rst is generated by sphinxcontrib-autoprogram from the parser in cli/sphinx.py, and render() builds that parser by issuing an HTTP OPTIONS request per resource against a running Ascender. There is no static command table to fall back on, since the CLI discovers its own commands the same way. That is one page out of seven. The other six are plain reStructuredText and need nothing, so conf.py now drops reference.rst when no credentials are present and the rest build offline. A build with CONTROLLER_HOST set still produces the complete documentation, unchanged. The job runs with -W, which is what earns its keep: a dead cross-reference or a malformed directive fails rather than rendering wrong. Verified by pointing a :ref: at a label that does not exist, which fails the build with `undefined label ... [ref.ref]` and exit 1. Moving the toctree entry behind an `only` directive was the tidier option and does not work: toctree entries resolve while the source is read and `only` is evaluated later, so the warning fires anyway. It is suppressed by name instead, with the reasoning in conf.py next to it. Gating rather than advisory, unlike the type checker in ctrliq#42. That one started with 136 diagnostics to work through, so blocking on it would have blocked everything; this build is clean today, and an advisory job that always passes protects nothing.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
cigamit
approved these changes
Sep 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nothing built these docs, so a change to the CLI parser or to a cross-reference could break them and no check would notice. #40 recorded why:
reference.rstis generated bysphinxcontrib-autoprogramfrom the parser incli/sphinx.py, andrender()builds that parser by issuing an HTTP OPTIONS request per resource against a running Ascender. There is no static command table to fall back on, since the CLI discovers its own commands the same way.That is one page out of seven. The other six are plain reStructuredText and need nothing at all, so this builds those and leaves the generated one out.
What changes
conf.pydropsreference.rstwhen neitherCONTROLLER_HOSTnorTOWER_HOSTis set. A build with credentials still produces the complete documentation, unchanged.tox.inigains adocsenvironment, with the credentials passed through so the full build is one command away.ci.ymlgains aDocsjob running the samesphinx-buildinvocation.docs/README.mddescribed only the server-backed build, which is no longer the common case. It now covers both and explains which page needs a server and why.Two decisions worth flagging
-Wis the point. Warnings as errors is what makes this worth running: a dead cross-reference or a malformed directive fails rather than rendering wrong. Verified by pointing a:ref:at a label that does not exist, which fails withundefined label: 'nope' [ref.ref]and exit 1.Gating, not advisory, unlike the type checker in #42. That one started with 136 diagnostics to work through, so blocking on it would have blocked everything. This build is clean today, and an advisory job that always passes protects nothing.
The tidier way to exclude the page would have been an
onlydirective around the toctree entry. That does not work: toctree entries resolve while the source is read andonlyis evaluated later, so the warning fires regardless. It is suppressed by name instead, with the reasoning written next to it inconf.py.Verification
sphinx-build -b html -W --keep-going ascenderkit/cli/docs/source <out>with no credentials in the environment:build succeeded, exit 0, producingindex,usage,authentication,output,examples,install, plusgenindexandsearch. Noreference.html, as intended.:ref:to a nonexistent label: exit 1.ruff format --check,ruff checkand the unit suite all pass. The suite reports 366 rather than 363 passing, because installing thedocsextra un-skips the three tests intests/unit/cli/test_sphinx.pythat refactor: build the Sphinx parser on access, not at import #49 added.yamllintreports nothing new onci.yml; the foldedrun:resolves to the single intended command.One risk to name: the
docsextra pins nothing, so a future Sphinx release could introduce a warning unrelated to any change here and turn this red on an unrelated day. If that happens the fix is to pinsphinxthe waylintpinsruffandtypecheckpinsty.