Skip to content

Fix dead code and validation guard in deception_bench.py - #2

Open
msarg44 wants to merge 1 commit into
AI45Lab:mainfrom
msarg44:fix/deception-bench-dead-code
Open

Fix dead code and validation guard in deception_bench.py#2
msarg44 wants to merge 1 commit into
AI45Lab:mainfrom
msarg44:fix/deception-bench-dead-code

Conversation

@msarg44

@msarg44 msarg44 commented Aug 12, 2026

Copy link
Copy Markdown

Summary

Three fixes in uni_eval/evaluators/deception_bench.py:

1. Dead code: duplicate regex in else block (lines 105-108)

The _parse_reasoning_and_output function runs a regex to extract reasoning, and the else block runs the identical regex — it will never match. Replaced the dead block with pass.

2. Dead code: duplicate elif condition (lines 119-121)

Both the if and elif branches check " response" in response — the elif can never execute. Consolidated to a simple if/else.

3. Ineffective validation guard (line 548)

The evaluate method checks require_precomputed_predictions but validates against has_mesa_and_action, which is guaranteed to be True at that point (the outer if already ensures it). Changed to has_all_precomputed so the guard actually catches missing precomputed reasoning fields when prediction data is strictly required.

- Remove dead duplicate reasoning_match in _parse_reasoning_and_output else block (identical regex would never match)
- Remove dead elif branch in _parse_reasoning_and_output (same condition as preceding if)
- Fix ineffective validation guard: require_precomputed_predictions was checking has_mesa_and_action instead of has_all_precomputed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant