fix(docs-review): check related docs by name and directory, not just identifier grep#55
Conversation
…identifier grep The docs-review skill finds stale docs by grepping for identifiers from the diff. This misses docs that describe the same feature area but don't mention any specific changed identifier — common when a PR adds new behavior rather than renaming existing behavior. Add a step to check whether documentation files covering the same feature exist based on file name and directory structure, and evaluate them as candidates even without grep matches. Update the quick-scan pass to handle candidates without grep hits by reading section headings instead. Signed-off-by: csoceanu <csoceanu@redhat.com>
PR Summary by QodoImprove docs-review stale-doc detection with name/directory doc matching
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
55 rules 1. Protected skills/ files modified
|
| Additionally, for each changed code file, check whether a | ||
| documentation file covering the same feature exists based on file | ||
| name and directory structure. If one exists, is not already in the | ||
| candidate list, and is not modified in this PR, add it. |
There was a problem hiding this comment.
1. Protected skills/ files modified 📜 Skill insight § Compliance
This PR modifies files under skills/, which is a protected governance/infrastructure path and must not be auto-approved; it requires explicit human review. Ensure the PR has appropriate authorization/justification recorded (ideally via a linked issue) before merging.
Agent Prompt
## Issue description
Protected governance/infrastructure paths were modified under `skills/`, which must be flagged for human review and should include explicit authorization/justification (preferably a linked issue) to avoid accidental auto-approval.
## Issue Context
Compliance requires raising a finding whenever protected paths are modified. If there is no linked issue, add one (or otherwise document explicit authorization) in the PR description.
## Fix Focus Areas
- skills/docs-review/SKILL.md[127-139]
- skills/pr-review/sub-agents/docs-currency.md[18-22]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| Additionally, for each changed code file, check whether a | ||
| documentation file covering the same feature exists based on file | ||
| name and directory structure. If one exists, is not already in the | ||
| candidate list, and is not modified in this PR, add it. |
There was a problem hiding this comment.
2. Doc match heuristic unclear 🐞 Bug ⚙ Maintainability
Docs-review step 4 adds a requirement to include candidate docs by “file name and directory structure” but does not define a matching heuristic (mapping rules, tie-breaking, or scope), which can produce inconsistent candidate sets across reviewers/runs.
Agent Prompt
## Issue description
Step 4 introduces “related docs by name/directory” candidate selection, but the instructions don’t specify how to perform the match (how to map code paths to doc paths, how to handle multiple matches, what directories to consider, etc.). This ambiguity makes the skill harder to apply consistently.
## Issue Context
The docs-review process is used verbatim by the `docs-currency` sub-agent; unclear heuristics can lead to inconsistent candidate lists and noisy or missed findings.
## Fix Focus Areas
- skills/docs-review/SKILL.md[127-130]
- skills/pr-review/sub-agents/docs-currency.md[18-22]
## Suggested fix
Add a short, explicit heuristic with examples and tie-breakers, e.g.:
- Normalize changed code file basename (drop extension, `_test`, etc.)
- Prefer docs in the nearest feature directory (e.g., `docs/<feature>/`, or same top-level component dir)
- Match on basename similarity (`foo/bar/baz.ts` → `docs/**/baz*.md|.rst|.adoc`)
- If multiple candidates match, pick the closest path distance, and cap to N (e.g., 1–3) to prevent candidate explosion.
- If no reasonable match is found, explicitly say “skip name/directory match for this code file.”
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| in context). For candidates added by name/directory match without | ||
| grep hits, read the doc's section headings to determine if it | ||
| describes behavior changed in this PR. Record a verdict for every |
There was a problem hiding this comment.
3. Headings scan underspecified 🐞 Bug ☼ Reliability
Step 5’s quick-scan instruction for candidates without grep hits says to “read the doc’s section headings,” but the skill explicitly includes .rst and .adoc docs and does not describe how to identify headings in those formats.
Agent Prompt
## Issue description
The quick-scan path for candidates added without grep hits relies on reading “section headings,” but the skill’s doc set includes `.md`, `.rst`, and `.adoc`. Without format-specific guidance, reviewers may miss headings or apply inconsistent scanning.
## Issue Context
Step 3/4 explicitly include `.rst` and `.adoc` files in the doc corpus and grep script, so step 5 should explain how to quickly find headings across those formats.
## Fix Focus Areas
- skills/docs-review/SKILL.md[87-88]
- skills/docs-review/SKILL.md[109-110]
- skills/docs-review/SKILL.md[134-138]
## Suggested fix
Update step 5 to define a quick heading-extraction approach per format, e.g.:
- Markdown: lines starting with `#`
- AsciiDoc: lines starting with `=`
- reStructuredText: detect common underline/overline patterns (or instruct to read the first ~50 lines / TOC section)
Optionally include a simple command snippet per type (e.g., `grep -nE '^(#|=)'` for md/adoc) and a fallback (“if heading syntax is unclear, read the intro + TOC”).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
The docs-review skill finds stale docs by grepping for identifiers from the diff. This misses docs that describe the same feature area but don't mention any specific changed identifier — common when a PR adds new behavior rather than renaming existing behavior.
This PR adds a step to check whether documentation files covering the same feature exist based on file name and directory structure, and evaluate them as candidates even without grep matches.
Changes
docs-review/SKILL.mdstep 4: after the identifier grep, also check for related doc files by name/directory matchdocs-review/SKILL.mdstep 5: handle candidates without grep hits by reading section headings in the quick-scan passdocs-currency.md: align the sub-agent instructions with the updated skillContext
An impact analysis of 111 merged PRs found that the skill missed stale docs in 7 PRs (6% false negative rate). In most of these cases, the PR added new user-visible behavior and the related doc file wasn't found because the new identifiers didn't exist in existing docs. This change addresses that gap by matching code files to doc files by name and directory structure, not just identifier grep.
Same change as fullsend-ai/fullsend#3233, opened here per @rh-hemartin's request since agents are migrating to this repo.