8000 fix: documented errors for overflowing and non-numeric inputs, with the H2 edge-case corpus (#348) by rafatahmed · Pull Request #352 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

fix: documented errors for overflowing and non-numeric inputs, with the H2 edge-case corpus (#348) - #352

Merged
rafatahmed merged 2 commits into
mainfrom
test/h2-edge-case-corpus
Nov 27, 2026
Merged

rafatahmed merged 2 commits into
mainfrom
test/h2-edge-case-corpus

Conversation

@rafatahmed
Copy link
Copy Markdown
Owner

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: recommend targets and water (all ions), aqueous_model.solve and nitric_target (pH, totals, ionic strength, temperature), water JSON files, and the 13 numeric flags of flahax 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

  • A water or target value of 1e308 raised OverflowError in recommend, 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 an InputError.
  • solve and nitric_target raised TypeError for a pH, total or ionic strength that is not a number, and read True as pH 1. They now raise DeliveryError with 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.
  • A water file with measured_ph NaN 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-grams and --ph-min; --volume 1e308 stops 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.

@rafatahmed rafatahmed added the bug Something isn't working label Nov 27, 2026
@rafatahmed rafatahmed self-assigned this Nov 27, 2026
@read-the-docs-community
read-the-docs-community Bot commented Nov 27, 2026 •
Copy link
Copy Markdown

Documentation build overview

📚 Flahax | 🛠️ Build #36219548 | 📁 Comparing 47ff9ba against latest (27785a0)

  🔍 Preview build  

1 file changed
± changelog.html

@codecov
codecov Bot commented Nov 27, 2026 •
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (27785a0) to head (47ff9ba).
⚠️ Report is 3 commits behind head on main.

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     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@rafatahmed
rafatahmed marked this pull request as ready for review November 27, 2026 20:59
@rafatahmed
rafatahmed merged commit e1d4045 into main Nov 27, 2026
29 checks passed
@rafatahmed
rafatahmed deleted the test/h2-edge-case-corpus branch November 27, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0