Require a log when a caught exception is not rethrown - #1209
EdbertChan wants to merge 4 commits into
Conversation
A log line, including console.error, still counts as handling the exception. Co-authored-by: Cursor <cursoragent@cursor.com> Change-Id: I9440b5b3f39e69c99b032041d0f298b03c5f29f3
An empty catch, a comment-only catch, and void err are suppression. Co-authored-by: Cursor <cursoragent@cursor.com> Change-Id: I8409b8f5933df08f9ebf6cd9bffc1f7a32ee3720
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_941d6a05-d14e-431d-af4d-f5e1faa29e01) |
The skill rule and the failure hook use the same check. Co-authored-by: Cursor <cursoragent@cursor.com> Change-Id: Iaa3d592599511b1f6b4e2da117e82965a83741ea
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_76147cf2-1d7d-4f55-992a-002013706960) |
…f its head did not move Exit code: 0
…f its head did not move Exit code: 0
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
…validate) Exit code: 0
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_ae758b4d-dd9f-473d-b18f-71ad7ddc660e) |
|
Mergify repair stopped: required check failed: validate. The retry cap was reached for current head 0b8dc8d. |
Summary
A caught exception that is not rethrown still has to be logged.
An empty handler, a comment-only handler, and a discarded error are suppression.
Review Claim
The explicit-errors skill requires a log when a caught exception does not propagate.
Review Lane
behavior
Review Unit
corpus-lesson
Safety Invariant
The skill text matches the hook. Silence is not a way to handle an exception.
Slice Rationale
This slice is only the skill. The hook change is the parent pull request.
Non-goals
No change to the hook detector.
Test Plan
Test Plan
python3 -m unittest corpus/skills/principle-explicit-errors/tests/test_void_discard.py -qpython3 scripts/ci/check_skill_test_coverage.py --base fix/explicit-failures-log-void --head HEADpython3 scripts/ci/check_skills_three_harnesses.pypython3 scripts/ci/check_ecosystem_boundaries.pyRevert Plan
Revert Plan
git revert e6e98d49 609c0712Note
Low Risk
Documentation and corpus tests only; no runtime hook changes in this PR, with low blast radius for agent guidance.
Overview
Tightens the
principle-explicit-errorsskill so caught exceptions cannot be “handled” by silence: empty/comment-only catches and discard-only handlers (void err,.catch(() => {}), etc.) are explicit suppression, and “Never suppress an exception. Silence is not a policy.”When an exception must not propagate (diagnostics, metrics, best-effort side paths), the skill now requires logging that names the operation and attaches the original exception—comments and
void errdo not count. The Grounding section drops PEP 20’s “unless explicitly silenced” as permission to drop errors.The fires example adds a review-bot scenario where swapping
void reportingFailureforcatch {}is still wrong.test_void_discard.pyasserts the skill’s discard rule matchesengine/hooks/explicit-failures’sdetect.scan_js(void-only catch flagged; logged catch clean)—hook behavior unchanged in this slice per PR scope.Reviewed by Cursor Bugbot for commit 0b8dc8d. Bugbot is set up for automated code reviews on this repo. Configure here.