Skip to content

refactor(fp-stability): extract _empty_result helper#1514

Closed
lb1192176991-lab wants to merge 1 commit into
MFlowCode:masterfrom
lb1192176991-lab:refactor/fp-stability-empty-result
Closed

refactor(fp-stability): extract _empty_result helper#1514
lb1192176991-lab wants to merge 1 commit into
MFlowCode:masterfrom
lb1192176991-lab:refactor/fp-stability-empty-result

Conversation

@lb1192176991-lab
Copy link
Copy Markdown

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.

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
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.64%. Comparing base (08d12f8) to head (fa18b6f).
⚠️ Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants