test(docs): fail when generated docs are out of date#4360
Open
reinkrul wants to merge 1 commit into
Open
Conversation
Refactor the doc generators to render to memory (generatedDocFiles) and add a test that compares the rendered output against the committed files. This catches contributors who change a config option or CLI command but forget to run `make cli-docs`. Also regenerates server_options.rst, which had drifted from the policy.authzen.endpoint flag description. Assisted by AI
Contributor
1 new issue
|
Contributor
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (1)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
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.

Why
Contributors who add/change a config option or CLI command must run
make cli-docs, but it's easy to forget — the docs then drift from the code. This adds a unit test that regenerates the docs in-memory and fails if they differ from what's committed, so CI catches it.Changes
docs/generate_docs.go: split the generators into render-to-memory functions (generatedDocFilesreturnspath → content);generateDocs()now just writes that map to disk. Output is byte-identical to before.TestGeneratedDocsAreUpToDate: comparesgeneratedDocFiles()against the committed files; on mismatch fails with"<file> is out of date; run \make cli-docs` and commit the result"`.server_options.rst, which had drifted from thepolicy.authzen.endpointflag description (needed for the new test to pass).Scope
cli-reference.rst,server_options.rst,server_options_didnuts.rst.README.rst— that's assembled by the separaterst_includestep inmake cli-docs, not by the Go generator.normalizeDefaultValue; verified the generator output is stable across runs.🤖 Assisted by AI