fix: inline Fortran constant defaults in _fc() to prevent Homebrew sync failures#1419
Conversation
…nc failures
Previously, _fc() raised if a constant was absent from _FALLBACK_CONSTANTS,
a separate dict that could silently drift from definitions.py. This caused
the v5.3.1 Homebrew build to fail: NIB = _fc('num_ib_patches_max') was added
to definitions.py but _FALLBACK_CONSTANTS was never updated, so every Homebrew
install hit a RuntimeError on startup.
Fix: _fc(name, default) now requires an inline default — the default lives
alongside the call, so they can't get out of sync. Remove _FALLBACK_CONSTANTS
and simplify get_fortran_constants() to return {} when src/ is unavailable.
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
Claude Code ReviewHead SHA: f9316a4 Files changed:
Findings
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1419 +/- ##
=======================================
Coverage 64.95% 64.95%
=======================================
Files 72 72
Lines 18880 18880
Branches 1573 1573
=======================================
Hits 12263 12263
Misses 5641 5641
Partials 976 976 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #1420.
Summary
RuntimeError: Fortran constant 'num_ib_patches_max' not found in m_constants.fppNIB = _fc("num_ib_patches_max")was added todefinitions.py(Ib collisions #1348) but_FALLBACK_CONSTANTSinnamelist_parser.pywas never updated — two places that must stay in sync with no enforcementsrc/is not installed soget_fortran_constants()returns{}, making_fc()fall through to the stale fallbackFix
_fc(name, default)now requires an inline default value co-located with the call site. There is no longer a separate dict to forget. Adding a new_fc()call without a default is a type error._FALLBACK_CONSTANTSand the fallback logic inget_fortran_constants()are removed. The function now simply returns{}whensrc/common/m_constants.fppis unavailable.Test plan
./mfc.sh precheckpasses (CI lint gate)