Repository navigation
test: check commands and flags named in changelog fragments and docstrings #1295
Description
Problem / motivation
tests/test_docs_code_refs.py checks the commands, flags and paths that the documentation pages name, against the CLI and the tree. Two kinds of text that also name commands are not checked:
- Changelog fragments (
changelog.d/). A fragment is written while a command is being renamed or moved, and it goes into the release notes as written. These fragments on main name a command or flag that does not exist:20261112_120100_vlad-perevezentsev_report-sub-cent-cost.md:arms matrix, nowarms matrix-run.20261117_120000_leftovers-cache-dir-help-exit-2.md:tasks generate, noweval tasks generate.20261117_120000_paired-summary-overflow.md:dokimi orchestrate, nowdokimi evaluate.20261122_120000_questions-generate-missing-local-source.md:benchmark check, nowbenchmark preflight.20261125_140000_json-writers-equal-keys-rest.md:skill routing --all-vs-all, nowcatalog routing.
- Docstrings of public modules and of the functions behind CLI commands. These are what a reader of the code, and an agent working in it, take as the description of the command.
dokimi/external/granularity.pynamescatalog granularity, which is not a command.
Proposed solution
Extend tests/test_docs_code_refs.py to both, for references whose kind is unambiguous:
- A command:
dokimi <words>in a code span, resolved againstbuild_parser(). A spelling the CLI retired and still answers with its new one resolves (cli_routes.TOMBSTONESand the moved-flag routes), since a fragment may record the rename itself. - A flag written right after the command it belongs to (
dokimi x y --flag), checked against that command's parser. - In fragments, a repository path in a code span, checked against the tree.
- Docstrings are labelled by module name (
dokimi/<module path>.py::<function>), so the check gives the same answer from the source tree and from an installed package, where the source file is undersite-packages.
Known docstring misses go in tests/docs_code_refs_baseline.txt, which only shrinks. A fragment is never listed there: the release deletes fragments, so a row naming one would fail the release; a wrong fragment is fixed in place. The draft fixes the fragments above, and the docstring row stays for the change that removes or renames catalog granularity.
Alternatives considered
- Checking prose as well as code spans: too many false matches on ordinary words.
- A baseline for fragments: rows would outlive the fragments the release deletes.
- Leaving fragments to review: each fragment above passed review.
Additional context
Touches documentation checks only: tests/test_docs_code_refs.py, tests/docs_code_refs_baseline.txt, and the fragments named above (one word or command name each).
Draft implementation: vchamarthi#87 (one commit on current main; CI passes, including the test run against the installed wheel and conda package).
Activity