Repository navigation
feat: add hub-completeness guard to prevent instruction/prompt README drift - #3322
pratik wayase (PratikWayase) wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3322 +/- ##
==========================================
+ Coverage 85.25% 85.28% +0.03%
==========================================
Files 198 199 +1
Lines 40650 40842 +192
Branches 201 201
==========================================
+ Hits 34655 34833 +178
- Misses 5924 5938 +14
Partials 71 71
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Bill Berry (WilliamBerryiii)
left a comment
There was a problem hiding this comment.
Thank you for adding the completeness check and tests. Please address the repository-root handling issue noted inline and add regression coverage before merging.
| $changedFiles = @() | ||
| if ($ChangedFilesOnly) { | ||
| try { | ||
| $changedFiles = @(Get-ChangedFilesFromGit -BaseBranch $BaseBranch -FileExtensions @('*.instructions.md', '*.prompt.md')) |
There was a problem hiding this comment.
Thank you for adding the completeness check and tests; all 25 submitted tests and the normal lint command passed when rerun.
$changedFiles = @(Get-ChangedFilesFromGit -BaseBranch $BaseBranch -FileExtensions @('*.instructions.md', '*.prompt.md'))Could you normalize RepoRoot to an absolute path and run this Git lookup from that directory?
In a controlled fixture, -RepoRoot . -ChangedFilesOnly returned success with zero artifacts checked, while the same target with an absolute root found its missing entry; invoking from another checkout also used that checkout's changes instead of the selected target's.
Please add regression tests for both forms.
Description
Adds a CI-style guard that fails when an instruction or prompt artifact exists on disk but isn't referenced in its hub README. The two hub indexes (
.github/instructions/README.mdand.github/prompts/README.md) are hand-maintained and excluded fromlint:mdcoverage, so drift between the README and the actual files goes undetected until someone notices manually.The validator (
scripts/linting/Test-DocHubCompleteness.ps1) follows the same dot-sourceable core + CLI guard pattern used byTest-ExtensionArtifactNaming.ps1. It enumerates both hubs, applies thedt-method-*exclusion for per-method coaching prompts, and checks each artifact's filename as a case-insensitive substring in the README text. Supports-ChangedFilesOnlyfor PR-scoped validation and exports JSON results with CI annotations + step summary via the sharedCIHelpers/LintingHelpersmodules.Also reconciles 10 instruction artifacts that were already missing from the instructions README Directory Structure tree (caught by the guard on first run).
Related Issue(s)
Closes #2435
Type of Change
Code & Documentation:
Infrastructure & Configuration:
Other:
.ps1,.sh,.py)Testing
npm run lint:doc-hubs— passes against current repo (59 artifacts checked, 0 missing)Invoke-Pester -Path scripts/tests/linting/Test-DocHubCompleteness.Tests.ps1 -Output Detailed— 25/25 tests passnpm run lint:ps— PSScriptAnalyzer cleannpm run lint:md— passesnpm run lint:frontmatter— 0 errorsChecklist
Required Checks
Required Local Checks
npm run validate:localnpm run validate:docsnpm run spell-checknpm run lint:md-linksSecurity Considerations
Additional Notes
The guard is wired into
validate:localimmediately afterlint:extension-artifact-naming. Thedt-method-*exclusion matches the prompts hub convention of summarizing per-method coaching prompts in a note rather than linking them individually.Duplicate basenames (e.g.,
pull-request.instructions.mdexists at both the instructions root and underhve-core/) are detected and reported as non-fatal warnings rather than failures, since the current repo has this case and pure basename matching would false-pass if at least one copy is referenced. This can be tightened to path-aware matching in a follow-up if needed.