Repository navigation
fix: documented errors for overflowing and non-numeric inputs, with the H2 edge-case corpus (#348) - #352
Merged
Conversation
…, add the H2 edge-case corpus (#348)
…ot to maxima that mean no limit (#348)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #352 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 151 151
Lines 17754 17764 +10
Branches 3581 3583 +2
=========================================
+ Hits 17754 17764 +10
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:
|
rafatahmed
marked this pull request as ready for review
November 27, 2026 20:59
This was referenced Nov 27, 2026
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.
Part of #348 (roadmap H2). Does not close it: H4 convergence diagnostics, H5 composed-plan rejections and H8 build-tool pinning remain.
Method. I probed the public entry points with NaN, infinity, negatives, zero, 1e308, 1e-308, strings, None, booleans, lists and dicts:
recommendtargets and water (all ions),aqueous_model.solveandnitric_target(pH, totals, ionic strength, temperature), water JSON files, and the 13 numeric flags offlahax batch. 29 of 247 Python API cases and one water-file case misbehaved; the 91 command-line flag cases were already clean.Defects found and fixed
OverflowErrorinrecommend, or returned a result with non-finite masses. Concentrations above 2,000,000 mg/L (more than a litre of any aqueous solution can hold) and booleans are now anInputError.solveandnitric_targetraisedTypeErrorfor a pH, total or ionic strength that is not a number, and readTrueas pH 1. They now raiseDeliveryErrorwith the existing codes (out_of_range,invalid_totals,activity_model_out_of_range). A valid pH keeps its type (an int stays an int), so no result changes.measured_phNaN produced a blocked report labelled "measured pH nan"; it is now refused at the file.Behaviour that is correct and now pinned by tests: pH 0 and 14 are inside the scale but outside the Davies model (ionic strength above 0.1), reported as
activity_model_out_of_range; ionic strength 0.1 is accepted, above it is not; only 25 C is modelled; zero is valid for--range-percent,--max-solid-reagent-gramsand--ph-min;--volume 1e308stops with a message.For your decision: the 2,000,000 mg/L ceiling is a physical bound, not a catalogue number, but it is a number I chose. Say if you would rather reject on overflow only.
Added:
tests/test_edge_case_corpus.py(14 tests, about 19 s; each flag and value gets its own output folder).Verified locally: corpus passes on Python 3.11, 3.13 and 3.14; ruff check and format; 54 chemistry, delivery, public-contract and requirement tests (269 s); cross-version digits, performance budgets, kernel contracts, entry inputs, manifest, release hygiene and changelog tests. Before the fix the probe listed all 29 failures.
Not run: the full pre-push suite (hours); CI runs the full gate.