Repository navigation
fix: chemistry without unassurable gates (G1-G5, G8, G10, G11) - #219
Merged
Merged
Conversation
…as measured Product chemistry (#214, G5): a label is reconciled with its compound. The charge the compound's ions cannot balance is reported and left out of the chemistry; the nutrient fit keeps the label. The 1 % label charge gate and its refusals are removed. pH inputs (#215, G1-G4): calculate_equilibrium_ph drops complete_analysis and takes residual_charge. A water without HCO3 or alkalinity gives needs_input, an ionic strength above 0.1 gives not_calculated, and the recipe is produced in both cases. The summary states closed carbon, 25 C only and 1 L = 1 kg water. Charge balance (#216, G10, G11): a water analysis is accepted as measured and its imbalance is carried as a residual charge. Removed: the 5 % rejection, closing on Cl, Na or carbonate, the 0.1 % initial-charge gates of the acid and delivery planners, and the 10 % formula-imbalance flag. Carbon from a titrated alkalinity stays. Adds GLOSSARY.md and ADR 0001.
…nt search out of range calculate_ec_from_totals takes residual_charge_eq_per_kgw for its calculated-pH mode, so an imbalanced water is no longer forced to zero charge there. A reagent search that leaves the activity model's range gives the pH-adjustment stage not_calculated instead of blocked. The planning prompt no longer names complete_analysis.
…a nutrient its ions do not carry
…block nothing sets
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #219 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 113 114 +1
Lines 13191 13186 -5
Branches 2617 2599 -18
=========================================
- Hits
8000
13191 13186 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rafatahmed
marked this pull request as ready for review
November 5, 2026 17:41
rafatahmed
added a commit
that referenced
this pull request
Nov 7, 2026
…able-gates fix: chemistry without unassurable gates (G1-G5, G8, G10, G11)
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 #214
Closes #215
Closes #216
Summary
Evidence
HCO3gave stageblocked(missing_carbon); a 7 % cation excess was refused (charge_imbalance_exceeded); an imbalanced water forced the EC solve to pH 10.16.After: the same water gives
needs_inputwith the recipe still produced; the 7 % water is accepted withimbalance_percent≈ 7.0; the EC solve carries the residual charge and lands within 1e-6 pH of the equilibrium solve.test_ph_inputs,test_charge_balance_reporting,test_label_reconciliation; older tests moved to the new contract.test_file_headersfailures caused by a stray untrackedexamples/tutorial/0.3.0/.venvon this machine.main, wheel/sdist) was not run locally; CI is the first run of it.Merge Danger
Door: one-way for API and CLI consumers.
Removed public names:
complete_analysis, and thebalance_water_analysisparametersbalance_ion,maximum_imbalance_percent, 8000balance_ion_uncertainty_percent,fixed. A water file that setsbalance_ionis now refused withunknown_field.Blast Radius: API and saved water files
test_product_phreeqcis patched to bypass label reconciliation, so its captured reference only proves the pre-reconciliation conversion (assertions unchanged). Re-capturing the fixture is a follow-up decision.BalancedWaterAnalysiskeeps now-unused fields (balance_ion,balance_adjustment_molal); removing them would be another public-API change.blockedsummary until the three-tank and saturation work in later PRs lands.