Skip to content

test: check commands and flags named in changelog fragments and docstrings #1295

In review

Description

@vchamarthi

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, now arms matrix-run.
    • 20261117_120000_leftovers-cache-dir-help-exit-2.md: tasks generate, now eval tasks generate.
    • 20261117_120000_paired-summary-overflow.md: dokimi orchestrate, now dokimi evaluate.
    • 20261122_120000_questions-generate-missing-local-source.md: benchmark check, now benchmark preflight.
    • 20261125_140000_json-writers-equal-keys-rest.md: skill routing --all-vs-all, now catalog 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.py names catalog granularity, which is not a command.

Proposed solution

Extend tests/test_docs_code_refs.py to both, for references whose kind is unambiguous:

  1. A command: dokimi <words> in a code span, resolved against build_parser(). A spelling the CLI retired and still answers with its new one resolves (cli_routes.TOMBSTONES and the moved-flag routes), since a fragment may record the rename itself.
  2. A flag written right after the command it belongs to (dokimi x y --flag), checked against that command's parser.
  3. In fragments, a repository path in a code span, checked against the tree.
  4. 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 under site-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

  1. added
    enhancement
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions