test(accounting): X2 is killed -- a rejected document the bundle holds (H2)

The mirror of the `persisted` refusal, driven from both sides: a report
declaring `rejected` while a concept in the bundle names the document
is `invalid >= 1` with the note quoted, and the same declaration with
its elements booked as coded rejections and no concept naming it is
`invalid == 0` and `refused == 3`. Without the second arm the test
would pass on a gate that refused every rejected document.

Measured against the X2 mutant from the previous commit: rc 0 before
(98 passed), rc 1 after.

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

View file

@ -704,6 +704,43 @@ def test_a_document_refused_whole_is_not_made_clean_by_the_neighbour(tmp_path: P
assert any("b.md" in detail and "fail_secure" in detail for detail in row.details)
def test_a_document_declared_rejected_that_the_bundle_holds_is_never_clean(
tmp_path: Path,
) -> None:
"""H2 / mutant X2: the mirror of
`test_a_document_declared_persisted_that_is_not_in_the_bundle_is_never_clean`,
and the only one of B-1's six refusals no test drove. A report claiming a
document was refused while a concept in the bundle names it is the shape
that hides a persist gate that did not fire.
The known-negative on the same declaration: with no concept naming it,
the refusal is honest and the only finding is H1's own column."""
declared = _all_carried()
declared["documents"][0]["status"] = "rejected"
declared["documents"][0]["code"] = "fail_secure"
declared["files"][0]["fate"] = "carried"
corpus = _corpus(tmp_path)
assets = _assets(corpus / "graphics" / "x.png")
held = gate.account(
_inventory(), _build(accounting=declared, sources={"a.md"}, assets=assets), corpus
)[0]
assert held.invalid >= 1
assert "declared rejected" in "; ".join(held.notes)
honest = _all_carried()
honest["documents"][0]["status"] = "rejected"
honest["documents"][0]["code"] = "fail_secure"
honest["documents"][0]["fates"] = {
"heading": {"rejected": {"fail_secure": 2}},
"image": {"rejected": {"fail_secure": 1}},
}
honest["files"][0]["fate"] = "carried"
absent = gate.account(
_inventory(), _build(accounting=honest, sources=set(), assets=assets), corpus
)[0]
assert absent.invalid == 0
assert absent.refused == 3
def test_a_rejection_code_outside_the_closed_list_is_never_clean(tmp_path: Path) -> None:
declared = _all_carried()
declared["documents"][0]["status"] = "rejected"