8000 refactor: one HCO3 molar mass, shared between mix_water and water_input by rafatahmed · Pull Request #331 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

refactor: one HCO3 molar mass, shared between mix_water and water_input - #331

Merged
rafatahmed merged 2 commits into
mainfrom
refactor/share-water-constants
Nov 26, 2026
Merged

rafatahmed merged 2 commits into
mainfrom
refactor/share-water-constants

Conversation

@rafatahmed
Copy link
Copy Markdown
Owner

Closes #323.

  • water_input.HCO3_MOLAR_MASS is the only definition of 61.0168. mix_water imports it, and water_input.WATER_KEYS['HCO3'] uses it, so the lab-water prompts and the water reader can no longer disagree.
  • mix_water.IONS takes the N, S and P masses from MOLAR_MASS instead of repeating 14.0067, 32.06 and 30.973762. The values are identical, so no result changes and there is no data difference to decide.
  • New tests/test_water_constants.py: the HCO3 mass has one definition (checked by identity), every water key the prompts can produce is one the reader accepts, and both use the same mass for each water key. The first test fails on main's source and passes here.
  • IONS and WATER_KEYS stay separate: they are different mappings (lab name to water key, and water key to equilibrium species), so merging them would not remove duplication.

Verification: the nitrogen snapshot (48 files) and the batch and mix snapshot (31 files) from main are identical (64-hex hashes masked). Every runnable test module passes; test_grower_outputs, test_mix_cli and test_grower_journey were run test by test. test_file_headers fails the same 434 cases as main on Windows. Not run locally: the slow ratio modules and the pre-push script (over 5 minutes). No chemistry changed, so the PHREEQC fixture is not re-captured. No changelog entry: nothing a user sees changes.

…ab-water prompts (#323)

water_input.HCO3_MOLAR_MASS is the only definition of 61.0168; mix_water imports it
and takes the N, S and P masses from MOLAR_MASS (the values are identical). A new
test checks that the prompts and the water reader agree on the water keys and masses.
@rafatahmed rafatahmed added the enhancement New feature or request label Nov 26, 2026
@rafatahmed rafatahmed self-assigned this Nov 26, 2026
@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 (6f735fd) to head (954aefc).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #331   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          148       148           
  Lines        17464     17466    +2     
  Branches      3539      3539           
=========================================
+ Hits         17464     17466    +2     
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 15:51
@rafatahmed
rafatahmed merged commit ec7597f into main Nov 26, 2026
29 checks passed
@rafatahmed
rafatahmed deleted the refactor/share-water-constants branch November 26, 2026 16:23
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.

Share the HCO3 molar mass and the N, S and P masses between mix_water and water_input

1 participant

0