8000 refactor: one number check, flahax.inputs.number by rafatahmed · Pull Request #319 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

refactor: one number check, flahax.inputs.number - #319

Merged
rafatahmed merged 6 commits into
mainfrom
refactor/input-primitives
Nov 26, 2026
Merged

rafatahmed merged 6 commits into
mainfrom
refactor/input-primitives

Conversation

@rafatahmed
Copy link
Copy Markdown
Owner

Closes #318.

One flahax.inputs.number(value, name, *, minimum=0.0, positive=False, maximum=None, code=None, type_code='invalid_value') replaces nine private _number copies. DeliveryError moves to inputs.py and is re-exported from delivery_contracts.

  • The three domain codes (invalid_ratio_input, invalid_stock_dosing, invalid_solubility_input) are kept through code=; no error code changes.
  • Behaviour changes: delivery_contracts no longer coerces numeric strings and gives None the code missing_field; stock_evidence, ph_evidence and batch_stability raise DeliveryError (a ValueError, caught where ValueError was caught).
  • batch_cli drops three re-checks of typed numbers (alkalinity, solid cap, reagent density). The other CLI guards parse text and stay.
  • Only a malformed value or a declared bound blocks (ADR 0001). Added tests/test_inputs.py; regenerated the API reference because DeliveryError's module changed.

Verification: every test module passes (record in outputs/test-runs/2026-11-26-refactor-input-primitives/). test_file_headers fails the same 434 cases on main on this Windows machine. The slowest ratio tests take about 205 to 255 s alone, the same on main; they were run one by one. Not run locally: the full pre-push script (over the 5-minute limit); CI covers coverage and the build check. PHREEQC fixture not re-captured: no chemistry changed, only input validation.

…l copies

DeliveryError moves to inputs.py and is re-exported from delivery_contracts.
conductivity, equilibrium_delivery and joint_problem use inputs.number.
…mber

Each keeps its own error code through code=. Adds tests/test_inputs.py.
A numeric string is no longer coerced to a number; a missing value is
missing_field. stock_evidence, ph_evidence and batch_stability raise
DeliveryError (a ValueError) for a malformed number, caught as before.
@rafatahmed rafatahmed added the enhancement New feature or request label Nov 26, 2026
@rafatahmed rafatahmed self-assigned this Nov 26, 2026
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 Flahax | 🛠️ Build #36175922 | 📁 Comparing 906cb8c against latest (09ffc33)

  🔍 Preview build  

2 files changed
± changelog.html
± reference/api.html

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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (09ffc33) to head (906cb8c).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #319   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          141       142    +1     
  Lines        17441     17406   -35     
  Branches      3555      3539   -16     
=========================================
- Hits         17441     17406   -35     
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 26, 2026 01:02
@rafatahmed
rafatahmed merged commit e5c6a66 into main Nov 26, 2026
29 checks passed
@rafatahmed
rafatahmed deleted the refactor/input-primitives branch November 26, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

One number check for caller-supplied numbers, replacing nine private copies

1 participant

0