8000 fix: report target misses once, honour declared ranges, default to 10 % and 20 °C by rafatahmed · Pull Request #378 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

fix: report target misses once, honour declared ranges, default to 10 % and 20 °C - #378

Merged
rafatahmed merged 1 commit into
mainfrom
fix/repeated-target-fit-finding
Nov 29, 2026
Merged

rafatahmed merged 1 commit into
mainfrom
fix/repeated-target-fit-finding

Conversation

@rafatahmed
@rafatahmed rafatahmed commented Nov 29, 2026 •
Copy link
Copy Markdown
Owner

NOT READY until CI is green.

Closes #377

Closes #379

Closes #380

What changes

The pH stage's review message ("incidental nutrient contributions need review; targets missed: ...") restates the formulation stage's misses. The matrix collected both, so the Target fit line named every miss twice, the second time with the engine's reason code. _ph_findings now adds no Target fit finding for a review status of the pH stage; target fit is judged on the chosen recipe.

Also

The pH stage judges targets strictly and ignored declared ranges, so a mix with every miss inside a 10 % range and maximums on ammonium and sodium still read "review required". A review status of that stage now adds no Target fit finding; target fit is judged on the chosen recipe, which already uses the ranges and maximums. This also removes the repeat, so the earlier parameter is gone.

Defaults (#380)

A 10 % acceptable range now applies unless --range-percent says otherwise (0 turns it off), and the stock temperature for the solubility check is 20 °C (was 25 °C), matching the catalogue solubility values. The chemistry stays at 25 °C. Real run: flahax batch --formula "Cucumber (Howard Resh)" --water ro --volume 10000 --ph 6 --limit N_NH4=15 --limit Na=5 is ready with preparation fits; without the two maximums it still needs review. Changelog, migration table, CLI reference and API reference updated; the flahax mix prompt default and its interview-prefix fixture follow (the historical transcripts are untouched).

Why

Seen in the trial of the 0.7.2.dev0 example: three Target fit findings, two of them repeating the same misses. The verdict was right; the wording was not. The status matrix is unreleased, so no changelog entry.

Tests

  • A unit test on _ph_findings (a review status adds no finding), and a real batch with range 10 % and maximums on ammonium and sodium: target fit is ready (failed before the fix).
  • One real default batch: "targets missed" appears once in the Target fit findings (failed before the fix).
  • Run locally and passing: status matrix wiring, status matrix, result wording, mix TUI, grower sheet, Sonneveld appendix I. Lint and format clean with ruff 0.8.4. Full suite, coverage gate and strict docs build run in CI.

No chemistry inputs touched, so the PHREEQC fixture is unchanged.

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

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #378   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          152       152           
  Lines        17991     17993    +2     
  Branches      3637      3638    +1     
=========================================
+ Hits         17991     17993    +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 29, 2026 18:22
@rafatahmed
rafatahmed merged commit 2ccb52c into main Nov 29, 2026
29 checks passed
@rafatahmed
rafatahmed deleted the fix/repeated-target-fit-finding branch November 29, 2026 18:22
@rafatahmed rafatahmed changed the title fix: report the target misses once in the status matrix fix: report target misses once, honour declared ranges, default to 10 % and 20 °C Nov 29, 2026
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