Skip to content

test(docs): fail when generated docs are out of date (backport of #4360 to V6.2) - #4493

Merged
reinkrul merged 1 commit into
V6.2from
backport-4360-v6.2
Sep 9, 2026
Merged

test(docs): fail when generated docs are out of date (backport of #4360 to V6.2)#4493
reinkrul merged 1 commit into
V6.2from
backport-4360-v6.2

Conversation

@reinkrul

@reinkrul reinkrul commented Sep 9, 2026

Copy link
Copy Markdown
Member

Backport of #4360 to V6.2.

Scope differences from #4360

  • Left out the .github/workflows/go-test.yaml changes: V6.2's workflow doesn't have the changes/paths-filter job that skips CI on docs-only changes yet (that's tracked separately, see the unmerged ci/skip-checks-docs-only-v6.2 branch, a backport of ci: skip test and e2e-test jobs for docs-only changes #4455). Nothing to fix here since V6.2's test job always runs unconditionally.
  • Kept the RST table in the existing .. table:: format. The switch to .. list-table:: (docs: generate server options as list-table for stable diffs #4426) was never backported to V6.2, so bringing it in here would be out of scope. Regenerating the docs on V6.2 confirms the output is unchanged.

Verified: go build ./..., go test ./docs/... (including the new TestGeneratedDocsAreUpToDate) pass on V6.2.

Assisted by AI

* test(docs): fail when generated docs are out of date

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

* ci: run the Go test job on docs/ Go files too

paths-filter excluded all of docs/ (including docs/generate_docs.go
and its tests) from the "code" filter that gates the test job, so the
new TestGeneratedDocsAreUpToDate added in this PR never actually runs
in CI. Its some-with-excludes mode makes an exclusion final, so a
blanket '!docs/**' can't be selectively re-included by a later
positive pattern - the exclude has to be scoped to the non-Go
subpaths instead.

Assisted by AI

* ci: simplify docs/ code filter to !docs/*/**

The per-subpath exclude list duplicated the docs/ directory layout
into the workflow config. Since all Go files live directly under
docs/, a single '!docs/*/**' (excluding anything nested under a docs
subdirectory) achieves the same result: it still treats a handful of
rarely-changed root-level non-Go files (Dockerfile, conf.py, etc.) as
code, which is an acceptable false-positive risk in exchange for not
having to keep the filter in sync with docs/'s contents.

Assisted by AI

(cherry picked from commit dac8093)
@qltysh

qltysh Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

1 new issue

Tool Category Rule Count
qlty Structure Function with many returns (count = 9): renderServerOptions 1

@qltysh

qltysh Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on V6.2 by 0.8%.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: F Coverage rating: A
docs/generate_docs.go88.0%55-57
Total88.0%
🤖 Increase coverage with AI coding...
In the `backport-4360-v6.2` branch, add test coverage for this new code:

- `docs/generate_docs.go` -- Line 55-57

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@reinkrul
reinkrul merged commit ae0ef65 into V6.2 Sep 9, 2026
8 checks passed
@reinkrul
reinkrul deleted the backport-4360-v6.2 branch September 9, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants