Repository navigation
fix: refuse impossible water masses, huge integers and hidden characters in ratio inputs - #484
Merged
Merged
Conversation
…ers in ratio inputs - ratio and every SolventBasis refuse more than 2 kg of water per litre (#481) - caller-number checks use inputs.finite, so an integer too large for a float is refused by name instead of raising OverflowError (#482) - ratio product names and water analysis_id refuse control characters, and an unknown nutrient key is shown escaped (#483)
|
📖 4 files modified Preview · build overview · Flahax · built Dec. 3, 2026, 5:09 p.m. UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #484 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 155 155
Lines 18362 18380 +18
Branches 3713 3714 +1
=========================================
+ Hits 18362 18380 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 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.
Summary
Fixes the three bugs from the ratio command fuzzing audit (#437).
Closes #481
Closes #482
Closes #483
The diff is wide because the integer fix replaces every inline finiteness check outside the solver modules. A new test fails if
math.isfiniteappears again outside that listed set.Evidence
ratio, real water, 10 L,water_mass_kg10000passeddeclares 1000 kg of water per litreworkflowequilibrium, 100 L,water_mass_kg100000blocked,out_of_rangeratio,water_mass_kg1 followed by 400 zeroswater_mass_kg must be finitebatch --products, such an integer as an ion countK+ count must be a positive numberratioproduct name with an escape codeproduct name has a control charactertests/test_ratio_input_limits.pyfailed before the fix (699OverflowErrorsubtests among them) and passes after. It puts the integer into every numeric field of every ratio example, except insidestock_evidenceandbatch_stability, whose handlers already name the error.Remaining limit
Checked against earlier work
SolventBasis. The water-file message now starts "the solvent basis declares".inputs.numberandcomposition._finiteonly.text_without_controlsrule.Merge Danger
Door: two-way
Blast Radius: inputs
SolventBasisis public: a caller constructing more than 2 kg of water per litre now getsDeliveryError. For every other value,finiteanswers exactly asmath.isfinitedid.