test: regression tests for _safe_score error boundary integrity#545
Merged
isaacschepp merged 1 commit intomainfrom Apr 4, 2026
Merged
test: regression tests for _safe_score error boundary integrity#545isaacschepp merged 1 commit intomainfrom
isaacschepp merged 1 commit intomainfrom
Conversation
Add NoneReturningScorer that returns None (simulates missing return statement) and two tests verifying _safe_score produces a valid error Score and doesn't kill sibling scorers. These tests would fail if replace() is moved outside the try/except in _safe_score, since replace(None, ...) raises TypeError that escapes the error isolation boundary.
There was a problem hiding this comment.
Pull request overview
Adds regression coverage to ensure _safe_score’s error isolation boundary remains intact even when a scorer incorrectly returns None, preventing failures from escaping and canceling/losing sibling scorer results during parallel scoring.
Changes:
- Introduces a
NoneReturningScorertest helper that simulates a scorer missing a return statement. - Adds a regression test asserting
_safe_scoreconverts aNonereturn into a synthetic errorScore(including duration). - Adds a regression test asserting a
None-returning scorer does not prevent sibling scorers from completing inrun_scan(..., parallel_scoring=True).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Add regression tests that catch the structural bug where
replace()escapes_safe_score's error isolation boundary. ANoneReturningScorersimulates a scorer with a missingreturnstatement.How it prevents the bug
If someone moves
replace(score, duration_seconds=...)outside thetry/exceptin_safe_score, theNoneReturningScorercausesreplace(None, ...)which raisesTypeError. This escapes_safe_scoreand drops sibling scorer results. The test catches this because it asserts_safe_scorereturns a validScorewithpassed=Falseanddetails['error'].Tests Added
NoneReturningScorer— scorer that returns None (simulates missing return)test_safe_score_handles_none_returning_scorer— verifies error Score producedtest_none_returning_scorer_does_not_kill_siblings— verifies sibling scorers completeTest plan