Require a log when a caught exception is not rethrown. - #1222
Merged
Conversation
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_578df34c-5142-4497-aabc-12b2eae49864) |
4 tasks
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
Owner
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
This pull request spent 44 minutes 57 seconds in the queue, including 44 minutes 35 seconds running CI. Required conditions to merge
|
6 tasks
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 catch that only throws the error away must now write a log. The log has to name what failed and keep the original error. A comment or a void line does not count. The skill text and its test both say that.
Review Claim
The skill now says a caught error must be logged, and the test checks the same void and logged cases the hook already checks.
Review Lane
behavior
Review Unit
corpus-lesson
Safety Invariant
A catch that only discards the error is not a handled error. The skill text matches the hook that is already on main.
Slice Rationale
The hook change is already on main. This pull request is only the skill text and the test that reads that hook.
Non-goals
Test Plan
Test Plan
python3 -m unittest corpus/skills/principle-explicit-errors/tests/test_void_discard.py -qRevert Plan
Revert Plan
git revert 96d5f912Note
Low Risk
Documentation and corpus tests only; no production pipeline or hook logic changes in the diff.
Overview
Tightens the
principle-explicit-errorsskill so caught exceptions may not be silently dropped: disposition must be fail fast, propagate, translate to a domain result, or log with the original exception. It explicitly bans empty/comment-only handlers and discard-only patterns (void err,except: pass, etc.), and states that comments are not logs.The Grounding section no longer treats Zen of Python’s “unless explicitly silenced” as permission to suppress; non-propagating paths must log.
fires_example.mdnow covers both emptycatch {}and swappingvoid reportingFailurefor an empty catch—neither is OK without logging—and expects tests on the log.test_void_discard.pylocks the skill toengine/hooks/explicit-failures:void-only catches are flagged; catches thatconsole.errorthe error are not.Reviewed by Cursor Bugbot for commit 96d5f91. Bugbot is set up for automated code reviews on this repo. Configure here.