test(round-builder): the sum's own guard, measured apart from the one upstream of it

A green mutation is a finding. Of the twelve planted against this file, eleven fell and
one survived: dropping `row["validated"]` from validated_ore's filter changed nothing.

It is equivalent — but only for as long as the OTHER guard holds. derive_outcome already
refuses to put a refused row's figure into (d), so on every outcome this builder writes,
validated_nok is None wherever validated is False and the two guards are
indistinguishable from the outside. Deleting either one alone is free today; deleting
both is the leak, and nothing witnessed that.

validated_ore is public and takes any outcome mapping, so the arm that separates them
hands it the outcome a future coverage writer could produce: a refused row whose amount
already sits in validated_nok. 137 000 002 øre, counted from the table, against the
227 000 002 a leak would give.

12 of 12 mutants now fall; control in the clone is 40 of 40.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-19 10:26:49 +02:00
commit 470fd00f89
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q

View file

@ -453,6 +453,30 @@ def test_a_refused_rows_amount_never_becomes_a_validated_saving(tmp_path: Path)
assert "2 270 000,02" not in text, "a refused claim was counted as a validated saving"
def test_only_a_validated_row_counts_even_when_a_refused_one_carries_a_figure() -> None:
"""The SECOND of the two guards, measured on its own.
``derive_outcome`` already refuses to put a refused row's figure into (d), so on every outcome
this builder writes the two guards are indistinguishable measured 19.09, the mutant that
drops the sum's own guard survives the whole file for exactly that reason, and it is
equivalent only for as long as the first guard holds. ``validated_ore`` is public and takes
any outcome mapping, so the arm that separates them hands it the outcome a future coverage
writer could produce: a refused row with an amount already sitting in ``validated_nok``."""
leaky: dict[str, Any] = {
"approaches": [
{"id": aid, "validated": status == "validated", "validated_nok": nok}
for aid, _label, status, nok, *_rest in _SPEC
]
}
leaked_rows = [
row["id"]
for row in leaky["approaches"]
if not row["validated"] and row["validated_nok"] is not None
]
assert leaked_rows == ["a2-faerre-kummer"], "the table lost the row this arm needs"
assert rb.validated_ore(leaky) == _VALIDATED_ORE == 137_000_002
def test_the_outcome_is_derived_row_for_row_from_the_runs_own_coverage(tmp_path: Path) -> None:
"""(a)-(d) per approach, counted from the table. ``feedback_ids`` is empty on every row: no
run records which feedback item produced which row, and the builder invents no tracking."""