ci: Add codeowners-coverage to precommit#112330
Conversation
517bee5 to
fc32487
Compare
fc32487 to
1785e7c
Compare
| - id: codeowner-coverage | ||
| name: codeowner coverage | ||
| entry: .venv/bin/codeowners-coverage check | ||
| pass_filenames: false | ||
| language: system |
There was a problem hiding this comment.
Bug: The codeowner-coverage pre-commit hook is missing always_run: true, causing it to be skipped on commits where no files are staged, thus bypassing the check.
Severity: MEDIUM
Suggested Fix
Add always_run: true to the codeowner-coverage hook configuration in .pre-commit-config.yaml. This will ensure the hook runs on every commit, regardless of the files being changed, maintaining consistent code ownership validation.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: .pre-commit-config.yaml#L79-L83
Potential issue: The new `codeowner-coverage` pre-commit hook is configured without the
`always_run: true` property. According to the pre-commit framework's behavior, a hook
that does not specify a `files` pattern and lacks `always_run: true` will be skipped
during commits where no files are staged. Since the purpose of the `codeowners-coverage
check` is to perform a repository-wide validation on every commit, this omission means
the check will not run reliably. This defeats the purpose of the hook, which is intended
to replace a GitHub Actions workflow that previously ran unconditionally.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6570eb4. Configure here.
|
|
||
| - id: codeowner-coverage | ||
| name: codeowner coverage | ||
| entry: .venv/bin/codeowners-coverage check |
There was a problem hiding this comment.
Missing --allow-dirty-baseline flag in pre-commit hook
Medium Severity
The old CI workflow used codeowners-coverage check --allow-dirty-baseline, but the new pre-commit hook entry only runs codeowners-coverage check without that flag. The --allow-dirty-baseline flag permits the check to pass when the baseline file (.github/codeowners-coverage-baseline.txt) has uncommitted changes. In a pre-commit context, this is especially important — when a developer modifies the baseline file and stages it, the hook runs before the commit is finalized, so the baseline is inherently "dirty" and the check will fail.
Reviewed by Cursor Bugbot for commit 6570eb4. Configure here.
| - id: codeowner-coverage | ||
| name: codeowner coverage | ||
| entry: .venv/bin/codeowners-coverage check | ||
| pass_filenames: false | ||
| language: system |
There was a problem hiding this comment.
Bug: The codeowner-coverage pre-commit hook is missing always_run: true, causing it to be skipped on pull requests that only contain deleted files.
Severity: MEDIUM
Suggested Fix
Add always_run: true to the codeowner-coverage hook configuration in .pre-commit-config.yaml. This will ensure the hook runs on every commit, regardless of the files changed, which is necessary for a global coverage check.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: .pre-commit-config.yaml#L79-L83
Potential issue: The `codeowner-coverage` pre-commit hook is configured with
`pass_filenames: false` but lacks `always_run: true`. The associated CI workflow is
designed to run pre-commit only on added or modified files. Consequently, if a pull
request contains only file deletions, the list of files to check is empty, and the
`codeowner-coverage` hook is silently skipped. This is a regression, as it replaces a
dedicated workflow that likely ran unconditionally, and it allows a reduction in
CODEOWNERS coverage to go undetected in pull requests that only remove files.


If we put this in pre-commit maybe people will be able to keep it up to date more easily.
Ideally thought the
suggestcommand is something that can be more flexible and automatic. If it were to find whatever agent is available on your system and run automatically then people wouldn't need to setup ollama and the check could fix itself if it was failing.https://pypi.org/project/codeowners-coverage/
https://github.com/getsentry/codeowners-coverage