Repository navigation
test(docs): check commands, flags and paths in changelog fragments and docstrings - #1337
vchamarthi wants to merge 5 commits into
Conversation
…d docstrings tests/test_docs_code_refs.py now also reads changelog.d/*.md and the docstrings of public modules and CLI command functions, with the resolver the docs check already uses. Only unambiguous references count: a command, a flag inside or beside its command, and in fragments a repo path whose directory exists. A spelling the CLI retired still resolves there, because a fragment records the move. The five fragments that named a command or flag the CLI does not have are corrected. tests/docs_code_refs_baseline.txt holds one docstring row; the check fails on a new miss, on a row that no longer misses, and on a row that names a fragment, since the release deletes fragments. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). CI at Review details
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
6 open issues
The referenced test path appears inconsistent with this PR’s actual location… · Newmoved_flags_argv(...)is being used in a boolean context. Ifmoved_flags_argvever returns an… · New_flag_of()walks the entire CLI subtree (and inspects argparse actions) for every candidate flag… · Newmoved_flags_argv(...)is being used in a boolean context. Ifmoved_flags_argvever returns an… · New The last assertion hard-codes an implementation-detail label suffix that may change with benign… · New This comment referencestests/test_docs_code_refs.py, but the test introduced/modified in this PR… · New
What changed in this PR
Extends the existing docs code-reference resolver test to also validate changelog fragments and public docstrings for CLI command/flag references (and fragment path references), and fixes existing stale references in changelog.d/.
Changes:
- Add fragment + docstring scanning to
test_docs_code_refs.py, including a “baseline only shrinks” mechanism for known docstring misses. - Introduce focused tests for the new fragment/docstring resolution rules (unambiguous commands, tied flags, and fragment paths).
- Correct five changelog fragments to use current/retired-resolving CLI spellings that the resolver accepts.
| File | Description |
|---|---|
| dokimi/tests/test_docs_code_refs.py | Adds fragment/docstring scanning, baseline drift detection, and new unit tests around the resolver rules |
| dokimi/tests/docs_code_refs_baseline.txt | Adds baseline file for known docstring misses (enforced to only shrink) |
| dokimi/changelog.d/*.md | Fixes stale/incorrect CLI command/flag references found on main |
| AGENTS.md | Updates contributor guidance to include fragments/docstrings in the docs-code-ref rule |
Review effort: Lite
| (`tests/test_docs_code_refs.py`): rename in code, rename in docs. Changelog | ||
| fragments and the docstrings of public modules and command functions too, for | ||
| commands, the flags written beside them and (fragments) repo paths; a spelling | ||
| the CLI retired still resolves there. Its baseline only shrinks. |
There was a problem hiding this comment.
I couldn't reproduce this: git show origin/main:AGENTS.md | grep -n 'tests/test_docs_code_refs.py' gives 50: (tests/test_docs_code_refs.py): rename in code, rename in docs.. I don't think it's a defect, because tests/test_docs_code_refs.py is written relative to the project directory dokimi/, as the line already was on main and as every other test path in AGENTS.md is.
| # Copyright (C) 2026 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Stale references in docstrings (tests/test_docs_code_refs.py). Only shrinks. A changelog fragment is |
There was a problem hiding this comment.
I couldn't reproduce this: ls tests/test_docs_code_refs.py gives tests/test_docs_code_refs.py. I don't think it's a defect, because the baseline comment gives the path relative to the project directory, like AGENTS.md and the other docs of this project; the file is dokimi/tests/test_docs_code_refs.py from the repository root.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1337 +/- ##
==========================================
- Coverage 96.19% 96.17% -0.02%
==========================================
Files 499 499
Lines 66465 66465
Branches 11542 11542
==========================================
- Hits 63933 63926 -7
- Misses 1563 1566 +3
- Partials 969 973 +4
🚀 New features to boost your workflow:
|
A fragment or docstring span of a retired command (`repo validate --no-such-flag`) skipped all validation, and its adjacent flag span lost the command context. The destination of the move is now resolved and checked. A flag the retired command took and the move dropped (`explore list` `--json`, `novelty routing` `--artifact foo`) is accepted in an adjacent span, as it is in one span, and a retired flag the rewrite refuses alone (`--all-vs-all`) no longer raises. Moved flags are tested with `is not None`, the flag lookup is cached, and the docstring test no longer hard-codes a function label. One fragment quoted a message as a command-looking span; it is now plain text. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
This is ready for another look: I've pushed 1 commit on Changes:
PR description updated:
Threads and comments:
What I checked on the new commit: the 3 tests of the fix pass; the full test suite passes with main merged in (31,581 tests), apart from 1 failure main has too. What each test shows
|
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
Fixes the failing fragment audit after merging main: `repo scan --fail-on-fail` is now answered by a shim in `cli.py`, not a flag move, so it is accepted as a retired spelling. Also fixes a moved group such as `eval score --judge-placeholder` in one span being reported, and `--flag=value` after a retired command passing unchecked. Also ignore `seed_requested` when comparing the run_config of two plugin runs, so unseeded runs that requested different seeds pair. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
This is ready for another look: I've pushed 2 commits on Changes:
Threads:
What I checked on the new commit:
What each test shows
|
The reference check treated any retired-flag refusal as a valid retired spelling, so `novelty routing` `--no-such-flag foo` passed. Accept the refusal only when the flag alone is refused (`--all-vs-all`) or takes a plain value (`--artifact ''`). Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
This is ready for another look: I've pushed 1 commit on Changes:
Threads:
What I checked on the new commit: the 2 tests of the fix pass; the full test suite passes with main merged in (34,847 tests), apart from 1 failure main has too. What each test shows
|


Summary
A changelog fragment or a docstring that names a command or flag the CLI does not have is found by reviewers today.
tests/test_docs_code_refs.pynow checks them with the resolver the docs check already uses, and the five fragments on main that name a missing command or flag are corrected.Closes #1295
Changes
changelog.d/*.md: commands (python cli.py …,dokimi …, or a span that starts with a CLI root and has two or more words), a flag inside a command span or beside its command, and a repo path whose directory exists.--flagspan is ignored, because fragments and docstrings also name docker, git, grep and pnpm flags.cli_routes.TOMBSTONES,cli_flags.FLAG_MOVES) resolves in fragments and docstrings, because a fragment records the move; the flags written with it are checked against the command it moved to. Docs pages still have to name the current spelling.changelog.d/is unreleased.tests/docs_code_refs_baseline.txtholds one docstring row (external/granularity.pynamescatalog granularity, and the code prints the same hint, so both change together) and only shrinks. A fragment is never listed there: a row naming a fragment the release deleted would count as fixed and fail the release PR, so the test refuses such a row.Fragments corrected:
arms matrixisarms matrix-run.tasks generateiseval tasks generate.dokimi orchestrateisdokimi evaluate.benchmark checkisbenchmark preflight.skill routing --all-vs-alliscatalog routing; the flag belonged to the retirednovelty routing.Risk
Testing
make ci-local CI_LOCAL_ARGS='--offline --jobs static,typecheck': 0 failed, 17 passed, 3 skipped.Open questions
None. The five fragment misses are fixed here rather than in a follow-up: listed in the baseline instead, they would fail the next release PR when it deletes them.
Revert
Revert the commit. The five fragment corrections go back with it; nothing is stored.
Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)