You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
• Removed external VerificationType import • Added local VerificationType class with extra variants • Added no-dependency comment and imported Enum locally
The new usable_runtime_data_by_test_case logic appends runtimes for failed tests instead of passed ones. Passed tests with valid runtimes are not collected, leading to incorrect data aggregation.
usable_id_to_runtime=defaultdict(list)
forresultinself.test_results:
ifresult.did_pass:
ifnotresult.runtime:
msg= (
f"Ignoring test case that passed but had no runtime -> {result.id}, "f"Loop # {result.loop_index}, Test Type: {result.test_type}, "f"Verification Type: {result.verification_type}"
)
logger.debug(msg)
else:
usable_id_to_runtime[result.id].append(result.runtime)
returnusable_id_to_runtime
VerificationType is duplicated in this module and in codeflash/models/models.py. Centralize or share the definition to prevent maintenance drift.
classVerificationType(str, Enum):
FUNCTION_CALL= (
"function_call"# Correctness verification for a test function, checks input values and output values)
)
INIT_STATE_FTO="init_state_fto"# Correctness verification for fto class instance attributes after initINIT_STATE_HELPER="init_state_helper"# Correctness verification for helper class instance attributes after init
if result.did_pass:
- if not result.runtime:+ if result.runtime:+ usable_id_to_runtime[result.id].append(result.runtime)+ else:
msg = (
f"Ignoring test case that passed but had no runtime -> {result.id}, "
f"Loop # {result.loop_index}, Test Type: {result.test_type}, "
f"Verification Type: {result.verification_type}"
)
logger.debug(msg)
-else:- usable_id_to_runtime[result.id].append(result.runtime)
Suggestion importance[1-10]: 10
__
Why: The current logic mistakenly appends runtimes for failed tests; this change fixes the bug by only collecting runtimes for passed tests and logs missing runtime cases.
High
General
Simplify enum assignment
Simplify the enum member assignment by removing unnecessary parentheses and consolidating it into a single line for consistency.
-FUNCTION_CALL = (- "function_call" # Correctness verification for a test function, checks input values and output values)-)+FUNCTION_CALL = "function_call" # Correctness verification for a test function, checks input values and output values
Suggestion importance[1-10]: 3
__
Why: This reduction of parentheses is a minor stylistic cleanup that has no functional impact but improves consistency.
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
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.
User description
The current code was not optimized as it was using multiple list and dictionary comprehensions which could be collated into a single for loop.
PR Type
Enhancement
Description
Refactor runtime grouping into single loop
Decouple capture module dependency removal
Duplicate
VerificationTypewith extra membersAdd TODO for duplicated class notice
Changes walkthrough 📝
models.py
Refactor runtime data grouping logiccodeflash/models/models.py
• Added TODO about duplicated
VerificationTypeclass• Replaced comprehensions with single loop + defaultdict
• Improved logging for missing runtimes
codeflash_capture.py
Decouple capture from core modulecodeflash/verification/codeflash_capture.py
• Removed external
VerificationTypeimport• Added local
VerificationTypeclass with extra variants• Added no-dependency comment and imported Enum locally