Guard against false-positive command coverage check when package commands fail to load#216
Merged
swissspidy merged 2 commits intoadd/command-check-workflowfrom Mar 4, 2026
Merged
Conversation
…mands Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Address feedback on workflow for detecting missing commands in README
Guard against false-positive command coverage check when package commands fail to load
Mar 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the reusable README-regeneration workflow to avoid a false-positive “command coverage” pass when wp cli cmd-dump succeeds but the package’s commands never actually register (e.g., autoloader failure), by ensuring there’s evidence that the package’s documented command roots are present in the dumped command set.
Changes:
- Add a pre-flight check that verifies at least one documented root command appears in the registered command list before running the missing-command detection.
- Fail early with a GitHub Actions
::error::...message when none of the documented roots are found, preventing a vacuous pass.
Comments suppressed due to low confidence (1)
.github/workflows/reusable-regenerate-readme.yml:117
- The failure message implies only a package load problem, but this condition can also happen when
extra.commandsis out of sync (e.g., roots renamed/removed) even if the package loaded correctly. Consider expanding the message to mention both likely causes and include the documented roots to aid debugging.
if [ "$FOUND_ROOT" -eq 0 ]; then
echo "::error::None of the documented root commands were found in the registered commands. Package commands may have failed to load."
exit 1
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If
wp cli cmd-dumpsucceeds but the package's commands never registered (e.g. autoloader failure),REGISTEREDcontains only built-in WP-CLI commands. The existing loop finds no mismatches and exits cleanly with "All commands correctly documented." — a silent false positive.Changes
REGISTERED, iterate over the documented root commands (ROOTS) and assert at least one is present in the registered set. If none match, fail with an actionable error:🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.