From ce9ea7d7b46fa92e93305aafd2ee12d6d39224af Mon Sep 17 00:00:00 2001 From: Rishet Mehra Date: Thu, 23 Jul 2026 22:30:48 +0530 Subject: [PATCH] test(hooks): surface bash failures in _shell_verdict helper Assert returncode == 0 so a malformed case snippet fails fast with stderr instead of silently returning an empty string. Addresses Copilot review feedback on #2133. --- tests/test_hooks.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_hooks.py b/tests/test_hooks.py index c38bd88f..2f0fc588 100644 --- a/tests/test_hooks.py +++ b/tests/test_hooks.py @@ -440,6 +440,11 @@ def _shell_verdict(pattern: str, candidate: str) -> str: ["bash", "-c", f'case "$1" in\n{pattern}) echo REJECTED ;;\n*) echo ACCEPTED ;;\nesac', "_", candidate], capture_output=True, text=True, ) + # Fail loudly on a malformed case snippet instead of returning "" and + # producing a confusing ACCEPTED/REJECTED mismatch downstream. + assert result.returncode == 0, ( + f"bash exited {result.returncode} for pattern {pattern!r}: {result.stderr.strip()}" + ) return result.stdout.strip()