Harden docs build after Zensical migration - #27
Merged
Merged
Conversation
Generate CLI reference pages when missing rather than shipping dead nav links, fail the build on broken links, and check the explicit nav covers every page. - Make build/run depend on src/command-line-reference. The directory is gitignored, so a fresh clone built 84 nav entries as raw .md hrefs against pages that were never generated, with no warnings, exit 0. - Add --strict to zensical build so broken links and anchors fail instead of warning and exiting 0. - Add scripts/check_nav_complete.py and wire it into CI. Zensical does not validate nav, and the literate-nav globs that used to pick up new pages are gone. - Use uv run python for generate_cli_nav.py, add encoding="utf-8", note that Zensical ignores unknown plugins, ignore __pycache__.
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.
Follow-ups from #26, in the order they need to land.
1.
build/runnow depend on the CLI reference pagessrc/command-line-reference/is gitignored, so a fresh clone has none. Before this,make buildthere exited 0 and rendered all 84 CLI nav entries as raw, unrewritten.mdhrefs against pages that were never generated:Zensical validates page body links but not nav entries, so those 84 dead links produced zero warnings.
make buildandmake runnow generate the pages when the directory is missing. An existing directory is left alone, so CI — which already callsmake cli-docs— doesn't run docgen twice.make cli-docsstill forces a refresh.2.
--strictonzensical buildBroken links and bad anchors warned but exited 0, so they could deploy. Depends on #1: without it,
--strictwould fail a fresh-clone build on the missing CLI pages.Worth correcting a claim in #26 — Zensical does not ignore
validation.config.py:616-651mapsvalidation.links.not_foundtoinvalid_linksand.anchorstoinvalid_link_anchors, both defaulting toTrue. Link checking is actually broader than before, since anchors weren't validated under the old config. Only theabsolute_linksrewrite is unsupported, which is why the six link conversions in #26 were needed.3. Nav completeness check
scripts/check_nav_complete.py, wired into CI after the CLI docs step. A page missing from the explicitnav:still builds, gets a URL, and lands insitemap.xmland the search index — but nothing links to it, and the build saysNo issues found. Zensical has novalidation.nav.omitted_files; its config module says navigation validation is deliberately out of scope for now. The literate-nav directory globs that used to pick up new pages automatically are gone.The check catches both directions: pages on disk missing from the nav, and nav entries with no page on disk.
4. Smaller items
generate_cli_nav.pyruns underuv run pythoninstead ofpython3. Everything else in the Makefile usesuv run, whilepython3picked up system Python (3.9.6 locally) againstrequires-python = ">=3.14".encoding="utf-8"on that script's read/write.mkdocs.ymlnoting Zensical silently ignores unknown plugins — that's how literate-nav failed quietly during the migration, and it's the failure mode to expect on future upgrades.__pycache__/added to.gitignore; the macros plugin importsmain.pyand leaves a.pycbehind, which was showing up as untracked.Verified
make cli-docs && make check-nav && make build— clean,No issues found, 112 pagessrc/command-line-reference/and ranmake build: regenerates, 84 pages built, 0 dead.mdnav hrefs (84 before)make builddoes not re-run docgenmake check-navexits non-zero and names the file; passes again once removedmake buildexits non-zero on bothmkdocs.ymldiff is comment-only aftermake cli-docs, so the generated nav block is byte-identical and still idempotent