Skip to content

test(docs): check commands, flags and paths in changelog fragments and docstrings - #1337

Open
vchamarthi wants to merge 5 commits into
intel:mainfrom
vchamarthi:ci/docs-reference-check
Open

vchamarthi wants to merge 5 commits into
intel:mainfrom
vchamarthi:ci/docs-reference-check

Conversation

@vchamarthi

@vchamarthi vchamarthi commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

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.py now 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.
  • Docstrings of public modules and of CLI command functions: the same command and flag rules, no paths. A docstring is labelled by its module name, so the check gives the same result from the checkout and from the installed package.
  • Only unambiguous references count. A lone --flag span is ignored, because fragments and docstrings also name docker, git, grep and pnpm flags.
  • A spelling the CLI retired (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.
  • No fragment is exempt as released: the release PR deletes fragments, so everything in changelog.d/ is unreleased.
  • tests/docs_code_refs_baseline.txt holds one docstring row (external/granularity.py names catalog 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:

  1. arms matrix is arms matrix-run.
  2. tasks generate is eval tasks generate.
  3. dokimi orchestrate is dokimi evaluate.
  4. benchmark check is benchmark preflight.
  5. skill routing --all-vs-all is catalog routing; the flag belonged to the retired novelty routing.

Risk

  • Test and changelog text only; no product code changes.
  • Each of the five misses was already wrong on the commit that added it, so the check fails a fragment on its own PR. A rename needs nothing here while the CLI still answers the old spelling; a command removed with no tombstone fails the fragments that name it, on the PR that removes it.
  • Not covered: stale names in help text, error messages and ordinary comments.

Testing

  • A planted stale flag, command and path are caught; valid and retired spellings pass; ambiguous tokens are ignored; a fixed baseline row fails.
  • Passed from the checkout and from the installed wheel and conda package in CI on the fork, before the rebase onto current main.
  • 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

  • Tests added/updated and pytest passes
  • ruff, mypy, and schema checks pass
  • Docs updated (or N/A) — see the docs-drift checklist in CONTRIBUTING.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md
  • Each new raise/exit and test names the doc, contract or issue it traces to
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml)

…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>
@vchamarthi
vchamarthi requested a review from a team as a code owner November 27, 2026 03:08
Copilot AI balanced review requested due to automatic review settings November 27, 2026 03:08
@exai-bot

exai-bot commented Nov 27, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s).

CI at 6aa31b5: 21 passing, 4 skipped.

Review details
  • Commit reviewed: 6aa31b5 against merge base 9e88295
  • Coverage: 1 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 87k tokens (53k from cache), 28s
  • Tool calls: 10 (5 file_read, 1 ci_log_search, 1 ci_status, 1 code_search, 1 file_find, 1 local_check_results)
  • dokimi/tests/test_docs_code_refs.py: 1 file

Comment thread dokimi/tests/test_docs_code_refs.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
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

Comment thread AGENTS.md
Comment on lines +50 to +53
(`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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread dokimi/tests/test_docs_code_refs.py Resolved
Comment thread dokimi/tests/test_docs_code_refs.py Resolved
Comment thread dokimi/tests/test_docs_code_refs.py Resolved
Comment thread dokimi/tests/test_docs_code_refs.py Resolved
# 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-commenter

codecov-commenter commented Nov 27, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.17%. Comparing base (1673824) to head (6aa31b5).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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     
Files with missing lines Coverage Δ
dokimi/dokimi/eval/plugin_delta.py 92.94% <100.00%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 1 commit on ci/docs-reference-check (1a66e1f..261ef6f).

Changes:

  • A retired command's flags are now validated against the command it moved to.
  • A flag the retired command took and the move dropped is accepted in an adjacent span.
  • An adjacent retired flag keeps its value when checked, and a retired flag the rewrite refuses alone no longer raises.

PR description updated:

  • A spelling the CLI retired (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.

Threads and comments:

  • I answered each one in its thread: 6 fixed, 2 not a defect.

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
  • A retired command with a missing flag is reported, in one span and in adjacent spans: passes.
  • An adjacent flag the move dropped is accepted, an unknown one is reported: passes.
  • Adjacent retired flags with a value, and --all-vs-all, are accepted without a crash: passes.
  • Also changed, outside the PR's files: dokimi/changelog.d/20261113_120700_napetrov_fsm687-pipeline.md.

Comment thread dokimi/tests/test_docs_code_refs.py Resolved
Comment thread dokimi/tests/test_docs_code_refs.py Resolved
Comment thread dokimi/tests/test_docs_code_refs.py Resolved
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>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 2 commits on ci/docs-reference-check (261ef6f..9e88295).

Changes:

  • The reference check accepts --fail-on-fail on repo scan, which main answers with a deprecation shim.
  • A moved group with an old flag in one span resolves.
  • A --flag=value after a retired command is checked.
  • Plugin comparisons no longer refuse unseeded runs that differ only in seed_requested.

Threads:

  • I answered each one in its thread: 3 fixed.

What I checked on the new commit:

  • 0 of 5 new tests fail before the fix and pass after it; the other 5 pass before the fix too, so they guard the change rather than reproduce a bug.
  • The full test suite passes with main merged in (34,805 tests), apart from 1 failure main has too.
What each test shows
  • the shim flag resolves: passes before the fix too.
  • the fragment audit passes after merging main: passes before the fix too.
  • group tombstone: passes before the fix too.
  • flag with value: passes before the fix too.
  • unseeded runs with different requested seeds pair: passes before the fix too.
  • Also changed, outside the PR's files: dokimi/dokimi/eval/plugin_delta.py.

Comment thread dokimi/tests/test_docs_code_refs.py Resolved
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>
@vchamarthi

Copy link
Copy Markdown
Contributor Author

This is ready for another look: I've pushed 1 commit on ci/docs-reference-check (9e88295..6aa31b5).

Changes:

  • An unknown flag with a separate value after a moved command is now reported.
  • A retired value flag whose value is refused stays a known flag.

Threads:

  • I answered each one in its thread: 1 fixed.

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
  • Both span orders report the unknown flag: passes.
  • A retired value flag with a refused value is not reported: passes.

This branch has not been deployed

No deployments
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.

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

4 participants