fix(MedCalc_Bench): guard calid-69 ground_truth regex match (AttributeError)#2523
Open
WatchTree-19 wants to merge 1 commit into
Open
fix(MedCalc_Bench): guard calid-69 ground_truth regex match (AttributeError)#2523WatchTree-19 wants to merge 1 commit into
WatchTree-19 wants to merge 1 commit into
Conversation
…ibuteError) check_correctness used re.search(...).group() on ground_truth unguarded, while the identical regex on the model answer two lines below is guarded with 'if match'. A calid-69 reference that doesn't fit the (N weeks, M days) pattern raised AttributeError, crashing scoring. Guard both symmetrically. +test. Signed-off-by: WatchTree-19 <119982314+WatchTree-19@users.noreply.github.com>
ssiq
approved these changes
Jul 22, 2026
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.
problem
in
MedCalc_Bench.check_correctness, thecalid == 69(date-difference) branch matches theground_truthwith a regex and immediately calls.group()unguarded:the identical regex applied to the model
answertwo lines down is guarded (if match:), so the asymmetry is clearly unintentional. a calid-69 reference that doesn't fit the(N weeks, M days)pattern makesre.searchreturnNone, andNone.group(1)raisesAttributeError, crashing scoring for the run.fix
guard the
ground_truthmatch the same way as theanswermatch: only build the normalized tuple when both match, otherwise score the item as incorrect (can't be compared).test
added
tests/dataset/test_medcalc_check_correctness.py: an unparseable calid-69 ground_truth now scores0instead of raising; a well-formed one still scores correctly.