Coverage gate fails a judge hook whose tests skip the shared base - #531
Open
EdbertChan wants to merge 1 commit into
Open
Coverage gate fails a judge hook whose tests skip the shared base#531EdbertChan wants to merge 1 commit into
EdbertChan wants to merge 1 commit into
Conversation
…base check_hook_test_coverage now checks every hook folder, not only ones with detect.py, so diu-stop and llm-judge are covered. It reads imports and class bases with ast instead of a substring match, and reports a file it could not parse as unchecked rather than clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013smxPCr4XeE7R77zVtN1u4 Change-Id: I09dbaf2ffd8b6c394201c530dce90516517ece05
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_79f7b212-00a9-43bb-a421-39889aac862f) |
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.
Summary
A repo check makes sure each checker has the test cases it needs.
The new judge rule only looked at some checkers, skipped files it could not read, and trusted a name in a comment.
It now checks every checker, reads real imports, and reports unreadable files.
Review Claim
The coverage check fails any judge-calling checker whose test cases do not use the shared setup.
Review Lane
behavior
Review Unit
engine-runtime
Safety Invariant
Check-only. It lands after every judge-calling hook already uses the shared base, so the real tree passes. Unreadable files are reported, never passed.
Slice Rationale
The gate goes last so it never blocks a hook that has not switched yet.
Stack position 7 of 7, split from one bundled change. Merge bottom-up.
Non-goals
Test Plan
Test Plan
check_hook_test_coverage: OK (36 hook(s) checked); this slice —FAIL/diu-stop: imports llm-judge but no test imports or subclasses JudgeTestCasepython3 -m unittest tests.test_check_hook_test_coverage—Ran 14 tests/OK; against the original gate,test_hit_hook_without_detect_py_is_still_checked_by_main—FAILpython3 scripts/check_hook_test_coverage.py—check_hook_test_coverage: OK (37 hook(s) checked)bash scripts/run_all_tests.shon the stack tip —run_all_tests exit=0, 53 suitesOK, 1970 tests (one skipped)uvx ruff check . --select E9,F—All checks passed!python3 engine/skills/make-pr/scripts/preflight.py --base <stack parent>—ok preflight passedRevert Plan
Revert Plan
git revert <merge-commit-sha>🤖 Generated with Claude Code
https://claude.ai/code/session_013smxPCr4XeE7R77zVtN1u4
Note
Low Risk
Check-only CI script and tests; no hook runtime or auth/data paths change, though AST heuristics could false-positive on unusual import patterns.
Overview
Extends
check_hook_test_coveragewith a judge isolation pass that runs for every hook directory (including those withoutdetect.py), not only hooks covered by the existing positive/negative/unreadable rules.The gate uses AST parsing to detect real
judgeimports in hook source and requires at least one test file to import or subclassJudgeTestCase. Hooks that import judge but lack compliant tests fail; unparseable Python is reported as unchecked rather than treated as passing. MentioningJudgeTestCaseonly in a comment no longer satisfies the rule.main()now runs the new checks in a second loop over CLI targets or allhook_dirs(). Unit tests inTestJudgeIsolationRulecover failure/pass cases, unreadable sources, and a hook-without-detect.pypath throughmain().Reviewed by Cursor Bugbot for commit f61550d. Bugbot is set up for automated code reviews on this repo. Configure here.