8000 fix: refuse water files that cannot describe a real water by rafatahmed · Pull Request #480 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

fix: refuse water files that cannot describe a real water - #480

Merged
rafatahmed merged 1 commit into
mainfrom
fix/water-file-inputs-476
Dec 3, 2026
Merged

rafatahmed merged 1 commit into
mainfrom
fix/water-file-inputs-476

Conversation

@rafatahmed
Copy link
Copy Markdown
Owner

Closes #476
Closes #477
Closes #478
Closes #479

Part of #437 (full batch runs on malformed water files).

Summary

 read_water
+  below_detection: an object, or absent/null; each limit at most 2,000,000 mg/L   (#479)
+  measured_ph too large for a float: named refusal                                (#477)
+  id: a non-empty string without control, hidden or surrogate characters          (#478)
   water_basis
+    more than 2 kg of water per litre: refused                                    (#476)

The same large-number refusal covers mg_per_litre, detection limits and the solvent basis (#477). The 2 kg bound reuses composition.MAX_MG_PER_L (a litre of solution weighs less).

Evidence

Water file Before After
water_mass_kg 998 per 1 L ready, EC 0.0039 mS/cm, 318.1 mL acid, exit 0 refused naming the unit mistake, exit 1
density_kg_per_litre 998 ready, exit 0 refused, exit 1
huge integer (four fields) traceback named refusal
id with ESC / newline / bidi override written raw into the sheets refused
below_detection: [] ignored refused
  • A correct file and a correct 0.998 kg/L basis give the same acid dose as before (151.8 mL) on a real batch.
  • New tests/test_water_file_inputs.py failed on unchanged code (19 failures, 4 errors) and passes.
  • 78 affected test modules pass on Python 3.14 in batches; ruff 0.17.6 check and format and tools/verify_distribution.py pass.

Remaining limit

  • A smaller basis mistake is still accepted: up to 2 kg of water per litre calculates with nothing said about the basis. This is documented.
  • The full coverage gate and documentation build were not run locally; CI runs them.

Checked against earlier work

Merge Danger

Door: two-way

Blast Radius: inputs

A hand-written water file with a non-string or hidden-character id, a non-object below_detection, or a basis above 2 kg/L now stops with a message instead of calculating.

@rafatahmed rafatahmed added the bug Something isn't working label Dec 3, 2026
@rafatahmed rafatahmed self-assigned this Dec 3, 2026
@read-the-docs-community
Copy link
Copy Markdown

📖 4 files modified


Preview · build overview · Flahax · built Dec. 3, 2026, 3:54 p.m. UTC

@rafatahmed
rafatahmed marked this pull request as ready for review December 3, 2026 16:02
@rafatahmed
rafatahmed merged commit d823cce into main Dec 3, 2026
26 checks passed
@rafatahmed
rafatahmed deleted the fix/water-file-inputs-476 branch December 3, 2026 16:02
@codecov
codecov Bot commented Dec 3, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (751d6d5) to head (b433382).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #480   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          155       155           
  Lines        18334     18362   +28     
  Branches      3708      3713    +5     
=========================================
+ Hits         18334     18362   +28     
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.

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

1 participant

0