8000 test: catch the defects the mutation run found unprotected by rafatahmed · Pull Request #506 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

test: catch the defects the mutation run found unprotected - #506

Merged
rafatahmed merged 1 commit into
mainfrom
test/mutation-gaps-499
Dec 5, 2026
Merged

rafatahmed merged 1 commit into
mainfrom
test/mutation-gaps-499

Conversation

@rafatahmed
Copy link
Copy Markdown
Owner

Summary

Tests for defects that every existing test passed in the 2026-12-05 mutation run. Tests and one changelog line only; no source or data file changes.

 tests/
+├── test_data_pins.py              # SHA-256 pin per packaged JSON file; totalN = sum of N forms
+├── test_equilibrium_reference.py  # mass-action laws and balances with literal constants
+├── test_input_refusals.py         # 33 refusals, each naming its code or message
 ├── test_result_wording.py         # blocked recipe gets no reagent quantities; oversize dose refused
 ├── test_grower_sheet.py           # same refusal on the pH reagent card
 ├── test_mix_results.py            # blocking reasons listed first
 ├── test_evaluated_remedies.py     # equipment requirement is blocked
 └── test_steiner_context.py        # advisories start below pH 5.0 and above pH 7

Closes #499
Closes #500
Closes #502

Refs #501, which stays open (see below).

Evidence

Each surviving defect was loaded in memory, one at a time, and the new tests were run against it.

Issue Defects now caught Not caught
#499 refusals 33 of 33 none
#500 blocked output 7 of 9 2, explained below
#501 constants 23 of 26 3, explained below
#502 data all 40 data changes that survived the first stage differ from their pin; totalN is also checked against the forms pins do not say a value is right
  • Before: those defects passed every test that was run against them. After: a new test fails for each one counted above.
  • The 54 new tests pass on the unchanged source. The edited and new test modules and the documentation and repository modules pass locally (Python 3.14); ruff check and ruff format --check pass.
  • The first version of five refusal tests passed with their raise deleted; they were aimed at the neighbouring statement or could be satisfied by another refusal, and were corrected before this commit.

Remaining limit

Row Why no test
fertilizer_equilibrium.py:176 it sits in a phosphate balance that does not close (#503, found while writing these tests); only calcium and magnesium are asserted there
trace_equilibrium.py:26, :32 METAL_CHARGE and COMPLEX_CHARGE are not read anywhere in src, tests or tools
result_wording.py:513 a second guard: rea 8000 gent_preparation already returns nothing for a blocked recipe
batch_summary.py:867 only matters for a workflow without a pH stage, which plan_fertilizer_workflow does not produce
  • The reference values are literal published constants and mass balances written in the test. They are not a comparison with a new PHREEQC run or with measurements.
  • The acid table test records the present values, including the two sulfur masses in the H2SO4 entry (bug: sulfuric acid molar mass and credited sulfur use different atomic masses #505).
  • Not run locally: the full suite under coverage, other Python versions and other operating systems. CI runs them.

Checked against earlier work

Merge Danger

Door: two-way. Tests and a changelog line.

Blast Radius: tests. From now on a deliberate change to a packaged JSON file needs its digest updated in tests/test_data_pins.py in the same commit.

Blocked reagent output and two pH advisory boundaries, the packaged data
files and stored total nitrogen, equilibrium constants and mass balances,
and 33 input refusals. Tests and one changelog line; no source changes.
@rafatahmed rafatahmed added the enhancement New feature or request label Dec 5, 2026
@rafatahmed rafatahmed self-assigned this Dec 5, 2026
@read-the-docs-community
Copy link
Copy Markdown

📖 1 file modified


Preview · build overview · Flahax · built Dec. 5, 2026, 9:21 a.m. UTC

@rafatahmed
rafatahmed marked this pull request as ready for review December 5, 2026 09:29
@codecov
codecov Bot commented Dec 5, 2026 •
Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #506   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          155       155           
  Lines        18403     18403           
  Branches      3719      3719           
=========================================
  Hits         18403     18403           
Flag Coverage Δ
unittests 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 merged commit 77b506a into main Dec 5, 2026
28 checks passed
@rafatahmed
rafatahmed deleted the test/mutation-gaps-499 branch December 5, 2026 09:29
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

1 participant

0