Repository navigation
Description
Problem or Motivation
The content census at cd6fb76 found 10 living high and 19 living low path findings, 31 in history sections and 29 in ADRs in force. The standards pass of 2026-11-11 (#4772) fixed 22 moved test paths by hand. The only path check (test_the_test_rules_name_only_test_files_that_exist) reads only docs/TESTING.md.
Proposed Solution & Architectural Design
- Add a rule module in
src/devops_cli/docs/thatdevops docs checkruns over the hand-written and prompt classes, the skills and the knowledge base. - A code span whose first segment is a tracked top-level entry or a package of
src/devops_climust resolve ingit ls-files. A glob must match. - The (target) mark names a planned path.
- The message names the tracked file with the same base name as the probable new path.
- Bare file names go to the scheduled rules of child 12 of feat(docs): track current content and brain-fed reference docs #4880.
- Delete the test that reads only
docs/TESTING.md.
The PR decides each of the 19 low-confidence tokens in the document: reword, link or narrow the stated scope. It never adds an allow list. Precision rule: the rule goes into the docs row only when its run on main gives 0 findings after #4894. Update CONTRIBUTING.md and the docs row of docs/ROUTINE_TASKS.md.
Target Subsystem
SDLC, Git & PR Governance (devops docs check, src/devops_cli/docs/).
Existing Tool Considered
git ls-files and markdown-it-py (already dependencies). No open tool checks code-span paths against a git tree. Cost: about 150 lines plus tests, about 100k tokens and 2.5 h.
Acceptance Criteria
- A planted moved path fails with file:line and the probable new path.
- The rule gives 0 findings on
mainat the merge. - The old test is gone.
- The docs row grows by at most 8 s on the runner.
Dependencies
Source: #4880
Alternatives check of 2026-11-27: partly.
Tool: lycheeverse/lychee (https://github.com/lycheeverse/lychee), Apache-2.0, last activity 2026-11-23, maintained.
Reason: Searches found only link checkers: lychee resolves relative file links and reports file:line in Markdown, but it ignores inline code spans and git tracking, so it covers the path check only in part.
Covers:
- Resolves relative file links in Markdown, HTML and reStructuredText
- Reports the file and line of each broken path
- Exits nonzero in CI on a broken link
Lacks:
- Reads links only, never inline code spans
- No glob match against the git-tracked file list
- No mark for planned paths or probable-new-path hint
- Checks the working tree, not git ls-files
Proposed design
Problem statement
The docs check has no rule for paths in inline code spans. A code span can name a path that git does not track in a hand-written document, a project skill or the knowledge base. This change adds the code-span path rule for hand-written documents, fixes every finding on the tree, deletes the old test and updates the documents. The prompt class is deferred because its examples are not tracked files.
Acceptance criteria
Requirement: Rule runs over hand-written documents
devops docs check SHALL run the code-span path rule over the hand-written document class, which holds the project skills and the knowledge base.
Scenario: Each hand-written document kind is inspected
- WHEN the check runs over a tree with one project skill and one knowledge-base document, each with one stale path
- THEN the check reports two findings, each with its file and line
Requirement: Tracked top-level path must exist
The rule SHALL report a finding when the first segment of a code span is a tracked top-level entry and no tracked file has the path.
Scenario: A moved document path fails
- WHEN a hand-written document holds the code span
docs/OLD_GUIDE.mdand git tracks no such path - THEN the rule reports one finding at the line of the code span
Requirement: Package path must exist
The rule SHALL report a finding when the first segment of a code span is a package under src/devops_cli, the span has an extension that a tracked file under that package has, and neither the span nor src/devops_cli/<span> is tracked.
Scenario: A moved module path fails
- WHEN a document holds the code span
roadmap/missing.pyand git tracks no such path at the root or undersrc/devops_cli/roadmap/ - THEN the rule reports one finding at the line of the code span
Requirement: Unknown package extension is not inspected
The rule MUST NOT report a finding for a code span whose package has no tracked file with the extension of the span.
Scenario: An upstream Go path passes
- WHEN a document holds the code span
server/sched.goand no tracked file undersrc/devops_cli/server/has the extension.go - THEN the rule reports no finding
Requirement: Glob matches a tracked file
The rule SHALL report a finding when a code span holds a glob that matches no tracked file and no tracked directory.
Scenario: A glob that matches nothing fails
- WHEN a document holds the code span
src/devops_cli/docs/*.missingand no tracked file matches the glob - THEN the rule reports one finding at the line of the code span
Requirement: Directory glob matches a tracked directory
The rule SHALL match a glob that ends with / against the tracked directories as well as the tracked files.
Scenario: A directory glob passes
- WHEN a document holds the code span
tests/gate/*_checks/and git tracks a file undertests/gate/tree_checks/ - THEN the rule reports no finding
Requirement: The (target) mark names a planned path
The rule MUST NOT report a finding for a code span that an emphasis starting with (target) follows.
Scenario: A planned path passes
- WHEN a document holds the code span
docs/NEW_GUIDE.mdfollowed by*(target)*and git tracks no such path - THEN the rule reports no finding
Requirement: A placeholder is checked up to the placeholder
The rule SHALL resolve only the text before the first <...> placeholder in a code span.
Scenario: A placeholder in a tracked folder passes
- WHEN a document holds the code span
tests/support/fakes/<edge>.pyand git trackstests/support/fakes/clock.py - THEN the rule reports no finding
Requirement: Two placeholders are not inspected
The rule MUST NOT report a finding for a code span that holds more than one <...> placeholder.
Scenario: A runtime path with two placeholders passes
- WHEN a document holds the code span
roadmap/listing/<owner>/<name>.jsonand git tracks no such path - THEN the rule reports no finding
Requirement: A non-line colon is not inspected
The rule MUST NOT report a finding for a code span that holds a colon which is not a trailing line number.
Scenario: A Docker image tag passes
- WHEN a document holds the code span
valkey/valkey:9.1.2-alpine - THEN the rule reports no finding
Requirement: A slash token with no file form is not inspected
The rule MUST NOT report a finding for a code span that has no known file extension, no glob and no trailing slash.
Scenario: A Kubernetes object reference passes
- WHEN a document holds the code span
gitea/gitea-admin - THEN the rule reports no finding
Requirement: A line suffix is stripped
The rule SHALL strip a trailing :<line> or :<start>-<end> from a code span before it resolves the path.
Scenario: A line suffix does not hide a moved path
- WHEN a document holds the code span
docs/OLD_GUIDE.md:12and git tracks no such path - THEN the rule reports one finding for
docs/OLD_GUIDE.md
Requirement: A bare file name is not the subject of the rule
The rule MUST NOT report a finding for a code span whose first segment is a bare file name.
Scenario: A bare file name passes
- WHEN a document holds the code span
conftest.pyand git tracks no file at that path - THEN the rule reports no finding
Requirement: Fenced code blocks are not inspected
The rule MUST NOT report a finding for a code span inside a fenced code block.
Scenario: A stale path in a fenced block passes
- WHEN a document holds a fenced block with the code span
docs/OLD_GUIDE.md - THEN the rule reports no finding
Requirement: The finding names the probable new path
The rule SHALL name each tracked file with the same base name as the probable new path in the finding, at most five, sorted.
Scenario: A moved path names its probable file
- WHEN a document holds
docs/OLD_GUIDE.md, git tracks no such path, and git tracks exactly one file namedOLD_GUIDE.mdatdocs/guides/OLD_GUIDE.md - THEN the message names
docs/guides/OLD_GUIDE.md
Requirement: One git call for each run of the rule
The rule SHALL read the tracked files with one git ls-files -z call for each run of the rule.
Scenario: Ten documents start git once
- WHEN the rule runs over ten documents
- THEN the git fake records one
ls-filescall
Requirement: The repository tree has no path finding
The rule SHALL report no finding when it runs over the repository tree of the change.
Scenario: The docs check passes on the tree
- WHEN
uv run devops docs checkruns over the repository tree of the change - THEN the code-span path rule reports no finding
Requirement: The docs row runs the code-span path rule
The docs row of devops ci SHALL fail when a code-span path in a checked document does not resolve.
Scenario: The docs row reports a stale code-span path
- WHEN
uv run devops ci --check --only docsruns over a tree with one stale code-span path - THEN the row fails and prints the finding with its file and line
Requirement: The old test is deleted
The change SHALL delete the test test_the_test_rules_name_only_test_files_that_exist.
Scenario: No test holds the old name
- WHEN a person runs
! git grep -n test_the_test_rules_name_only_test_files_that_exist tests/ - THEN the command exits 0 and prints nothing
Requirement: The documents name the code-span path rule
CONTRIBUTING.md and the docs row of docs/ROUTINE_TASKS.md SHALL name the code-span path rule.
Scenario: The documents name the rule
- WHEN a person runs
git grep -n "code-span path" CONTRIBUTING.md docs/ROUTINE_TASKS.md - THEN the command prints a line in each file and exits 0
Requirement: The homelab switch page is a record
The docs inventory SHALL classify docs/HOMELAB_REPO_SWITCH.md as a record.
Scenario: The homelab switch page is a record
- WHEN the test reads the inventory class of
docs/HOMELAB_REPO_SWITCH.md - THEN the class is
record
Requirement: Pending a person after the merge
The docs row SHALL take at most 8 s more than the docs row on main.
Scenario: A person measures the docs row on the runner
- WHEN a person runs the docs row on the runner after the merge and compares its elapsed time with the docs row on
main - THEN the elapsed time is at most 8 s more
Existing Tool Considered
The alternatives check of 2026-11-27 in the issue body records partly for lychee (https://github.com/lycheeverse/lychee), Apache-2.0, maintained. The block holds what lychee covers and lacks. This change does what the block says lychee lacks: it scans inline code spans, matches globs against one git ls-files -z call, honors the (target) mark, and names the probable new path. Cost: about 150 lines plus tests, about 100k tokens and 2.5 h.
Key questions
- Which test reads only
docs/TESTING.md?:test_the_test_rules_name_only_test_files_that_existintests/invariants/test_agents_md.pyreads onlydocs/TESTING.md. [sources: tests/invariants/test_agents_md.py, docs/TESTING.md] - Where does the rule live, and which row runs it?: The rule is a module under
src/devops_cli/docs/.devops docs checkcalls it. The docs row ofdevops cirunsdevops docs check. (best practice) [sources: src/devops_cli/commands/docs.py, src/devops_cli/docs/generator.py, docs/ROUTINE_TASKS.md, docs/SDLC.md]- Chosen: Module under
src/devops_cli/docs/. The docs command owns the docs checks, so one module serves the command and the row. - Rejected:
check_*function intests/gate/. The docs row runsdevops docs check, not a separate gate module. - Rejected: New command. It adds a command to keep and a second entry point for one check.
- Chosen: Module under
- Which documents does the rule read?: The rule reads the hand-written class of the docs inventory. That class holds the project skills and the knowledge base. The prompt class is deferred to a separate issue. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/docs/inventory.py, docs/TESTING.md]
- Chosen: Hand-written class. It covers the project skills and the knowledge base without illustrative prompt paths.
- Rejected: Prompt class in this change. Prompt documents hold illustrative paths that are not tracked files.
- Rejected: Every class of the inventory. Generated pages, records and tool-generated skills have other checks.
- How does the rule read the tracked files?: The rule starts one
git ls-files -zthroughrun_subprocessfor each run.list_repo_filesincludes untracked files, so it is no substitute. (best practice) [sources: src/devops_cli/core/repo.py, docs/TESTING.md]- Chosen: One
git ls-files -zcall throughrun_subprocess.docs/TESTING.mdholds every git start to the process runner, and one call gives the tracked set. - Rejected: Walk the working tree with
pathlib. It counts untracked and ignored files, so a path that git does not track passes. - Rejected: Read
.git/indexdirectly. It copies the index format and its rules into the product code.
- Chosen: One
- How does the rule find a code span and its line?: It reads each document line by line. It skips fenced code blocks and takes each inline code span with its line number, as
markdown_argv_collectordoes. It reads the text after the span on the same line for the(target)mark. (best practice) [sources: src/devops_cli/docs/markdown_argv_collector.py, docs/TESTING.md]- Chosen: Line-by-line inline code scan. It gives the exact line of each span and skips fenced blocks.
- Rejected: markdown-it token map. The map gives the line of the inline block, not each span in a multi-line paragraph.
- Rejected: Full markdown parse and search for each span. A span can repeat, and a search gives no reliable line.
- Which code spans does the rule inspect?: The rule inspects a code span only when it holds a
/or a glob, and it has a known file extension, a glob or a trailing/. Its first segment must be a tracked top-level entry or a package directory undersrc/devops_cli. A package-relative span must have an extension that a tracked file under that package has. A bare file name is not a finding, because child 12 of feat(docs): track current content and brain-fed reference docs #4880 covers it. (best practice) [sources: src/devops_cli/roadmap/stage/stage_paths.py, src/devops_cli/docs/inventory.py, src/devops_cli/roadmap/init.py, src/devops_cli/docs/init.py]- Chosen: Path-shaped span with a tracked top-level entry or package prefix. It limits the rule to paths and skips Docker tags, object references and stack names.
- Rejected: Every code span that holds a slash. It reports commands, URLs and object references, and it holds no limit that a person can state.
- Rejected: Only paths under
src/. It misses every path that starts atdocs/ortests/.
- How does the rule treat non-path slash tokens?: The rule skips a span with a colon that is not a trailing line number. It skips a span with no known extension, no glob and no trailing
/. It skips a span with more than one<...>placeholder. These rules skip Docker tags, Kubernetes object references, OpenTofu stack names and gitignored runtime paths. (best practice) [sources: src/devops_cli/ai/knowledge_base/it_domains/tools/valkey.md, src/devops_cli/ai/knowledge_base/it_domains/tools/ollama.md, k8s/README.md, SECURITY.md]- Chosen: Skip a token that is not path-shaped. The examples are not repository paths, and an allow list is forbidden.
- Rejected: Allow list of tokens. It hides a stale path, and the body forbids it.
- Rejected: Inspect every slash token. It reports 63 findings, including tokens that are not paths.
- How does the rule treat a glob that names a directory?: The rule matches a glob against the tracked files and their parent directories. So
tests/gate/*_checks/passes when a file undertests/gate/tree_checks/is tracked. (best practice) [sources: CONTRIBUTING.md, src/devops_cli/roadmap/stage/stage_paths.py]- Chosen: Match files and their parent directories.
git ls-fileslists files, and a directory glob names a directory. - Rejected: Match files only.
tests/gate/*_checks/then fails on a tracked directory. - Rejected: Rewrite the glob. It changes the document and hides the real path form.
- Chosen: Match files and their parent directories.
- How does the change treat
docs/HOMELAB_REPO_SWITCH.mdand the homelabk8s/paths?: The change classifiesdocs/HOMELAB_REPO_SWITCH.mdas a record, so the rule skips it. The change fixes each stalek8s/path in the hand-written documents that remain. (best practice) [sources: docs/HOMELAB_REPO_SWITCH.md, src/devops_cli/config/constants.py, docs/CLUSTER.md, k8s/README.md]- Chosen: Record class for the switch page and fix the other paths. The page records a past switch, and the other documents name live paths.
- Rejected: Allow list for the page. It hides a stale path, and the body forbids it.
- Rejected: Skip every
k8s/path. It misses a stale live path underk8s/.
- How does the change fix each finding, including the 63 findings on
main?: Each finding is fixed by rewording the sentence, linking the path or narrowing the stated scope. The module holds no list of accepted paths.AGENTS.mdrule 11 asks for the cause to be fixed. (best practice) [sources: AGENTS.md]- Chosen: Reword, link or narrow the stated scope. The document then names a path that exists, and the check stays true for the next change.
- Rejected: Allow list of accepted paths. It hides a stale path, and the body forbids it.
- Rejected: Fix only the 19 low-confidence tokens. The rule reports 63 findings on
main, so the row would fail.
- Should the prompt class be checked in this change?: No. The prompt class is deferred. Prompt documents hold illustrative paths such as
src/app.py:12andtests/roadmap/test_feature.py, which are not tracked files. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md, docs/TESTING.md]- Chosen: Defer the prompt class. The prompt examples are not tracked files, and the rule would report false findings.
- Rejected: Check the prompt class now. It reports illustrative paths as stale.
- Rejected: Skip every prompt path. It leaves a stale real path in a prompt unchecked with no marker.
- How does the change hold the 8 s budget of the docs row?: The rule starts one
git ls-filesand reads each document once. No test bounds elapsed wall-clock time from above, perdocs/TESTING.md. A person measures the docs row on the runner after the merge. (best practice) [sources: docs/TESTING.md]- Chosen: One git call and one read for each document. It is the smallest work that gives the tracked set and the code spans.
- Rejected: Test that asserts the row ends within 8 s.
docs/TESTING.mdforbids a test that bounds elapsed wall-clock time from above.
- When does the rule join the docs row?: The rule joins the docs row after docs: fix the stale statements that the content census found #4894 lands and when its run on
maingives 0 findings. The change fixes all findings onmainin the same pull request. (best practice) [sources: docs/ROUTINE_TASKS.md, AGENTS.md]- Chosen: Wait for docs: fix the stale statements that the content census found #4894 and 0 findings on
main. The body sets this precision rule, and a rule with findings onmainwould break the docs row. - Rejected: Add the rule before docs: fix the stale statements that the content census found #4894. The row would fail on paths that docs: fix the stale statements that the content census found #4894 fixes.
- Rejected: Add the rule with findings on
main. The docs row would fail at the merge.
- Chosen: Wait for docs: fix the stale statements that the content census found #4894 and 0 findings on
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 12, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(docs)scope of the title gives the scope.It catches a recurring class of documentation errors but does not block a release or fix a security issue.It prevents a known recurring class of wrong-path references in documentation.About 150 lines plus tests and updates to two files, estimated at 2.5 hours.Both address documents that name files that are gone or moved; 3508 fixes specific text, the candidate adds a check that catches such paths.devops-cli-service commentedon Nov 12, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The check prevents recurring stale paths, but it depends on 4894 and is not urgent.It stops wrong paths in docs from misleading users and agents.It needs about 150 lines, tests, and a decision on 19 low-confidence tokens.Both items address stale document paths from the content census; 4894 fixes the findings, while the candidate adds a check that prevents new ones.devops-cli-service commentedon Nov 14, 2026
Alternatives check: partly
Reason: The searches found only general Markdown link checkers; lychee validates local file link targets in a document, which covers the link-target half of keeping stale paths out of the docs. None of the tools parse inline code spans, resolve them against git ls-files, match globs or suggest the probable new path, so the rule this issue asks for is not covered.
Tool: lycheeverse/lychee (https://github.com/lycheeverse/lychee)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 16, 2026
Refine cannot set this item to Ready at fccb781 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
devops-cli-service commentedon Nov 26, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
6 remaining items
devops-cli-service commentedon Nov 28, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
chore(main): release 0.247.0 (#7752)
devops-cli-service commentedon Nov 29, 2026
Released in v0.247.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.247.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 16:17 UTC
feat(docs): check code-span paths in prompt documents (#7941)