Repository navigation
Hardening 1/4: entry points refuse bad input with a plain message, never a traceback - #118
Merged
Merged
Conversation
…nd line in JSON errors, plain acid and water messages (#117)
rafatahmed
added a commit
that referenced
this pull request
Nov 7, 2026
Hardening 1/4: entry points refuse bad input with a plain message, never a traceback
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.
Closes #117.
First of four hardening PRs (entry points, errors, PEP 8 and file headers, docstrings), from the audit of 2026-10-23.
Changes
flahax batch --ratio 0crashed (ZeroDivisionError). Every number option is now checked at the command line with its range:--ratio,--volume,--max-reagent-litresabove 0;--ph0-14;--water-shareabove 0 up to 100 ('--ratio must be above 0, not 0', exit 2).workflow,ec,size, the JSON request) gives the position too. New codesmissing_file,invalid_jsondocumented in the user guide.--acidassay or density is named.flahax batchterminal now shows the acid at 0.1 mL like the sheet and report (the Full report still shows '0' g for small weights and rounds the acid differently from the sheet #108 rule, one more place).Behaviour unchanged for valid input
A 97-result baseline (26 formulas through
recommend, 26 formulas x RO and the station-104 well through the full batch pipeline, 19 farmer sweep sessions) is identical before and after.Tests
tests/test_entry_inputs.py(ranges, named files, water and acid values, stdin positions, valid input unchanged). 534 tests with live PHREEQC required;tools/verify_distribution.pyPASS; LF.