π§ͺ Add test for JSON decode error in security_guard#8
π§ͺ Add test for JSON decode error in security_guard#8google-labs-jules[bot] wants to merge 1 commit into
Conversation
This test validates the error handling logic in the `main` hook entry point when the tool host provides unparseable JSON on stdin. It patches `sys.stdin.read` and verifies that the process exits with code 0 (warning/allowed) and calls `debug_log` as expected.
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π― What: The testing gap addressed is the lack of unit test coverage for the case where the JSON string from
sys.stdinfed to the hook is unparseable insecurity_guard.py.π Coverage: The scenario tested is when
sys.stdin.readreturns invalid JSON. It checks thatjson.loadscorrectly raisesJSONDecodeError(which is caught) and that the exception handler correctly triggersdebug_log()before callingsys.exit(0).β¨ Result: Test coverage for
security_guard.pyhas been increased, ensuring that hook inputs won't cause hard crashes on the caller and will fail gracefully.PR created automatically by Jules for task 7880898409640050646 started by @zknpr