refactor(fp-stability): extract _empty_result helper#1514
Closed
lb1192176991-lab wants to merge 1 commit into
Closed
refactor(fp-stability): extract _empty_result helper#1514lb1192176991-lab wants to merge 1 commit into
lb1192176991-lab wants to merge 1 commit into
Conversation
The identical 13-key result dict was duplicated in _run_case() (line 970) and the exception handler in _run_stability_checks() (line 1322). Extract a single _empty_result(name, threshold) helper and use it from both call sites. Fixes part (a) of MFlowCode#1512.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1514 +/- ##
=======================================
Coverage 60.64% 60.64%
=======================================
Files 73 73
Lines 20213 20213
Branches 2936 2936
=======================================
Hits 12259 12259
Misses 5966 5966
Partials 1988 1988 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
What
Extracts the identical 13-key empty result dict into a reusable
_empty_result(name, threshold)helper function, replacing both manual dict literals with a single call.Why
The default result dict
{name, passed, max_dev, threshold, float_proxy, vprec, dd_sym_syms, dd_line_locs, cancellation_locs, mca_dev, mca_sigbits, float_max_locs}appeared at:toolchain/mfc/fp_stability.py:970-983(in_run_case)toolchain/mfc/fp_stability.py:1322-1335(error handler in_run_stability_checks)Any future field addition or default change must be edited in lockstep. The helper keeps this in one place.
Testing
Pure extraction — identical constants, identical control flow. No behavior change. The existing FP-stability CI paths exercise both call sites.
Fixes part (a) of #1512.