test(accounting): a corpus that measures no class says so (H6, red)

Reproduced 2026-09-19: `okf build` on N200 proposes 0 plans, prints
`FAILED - no segmentation plans` and exits 2 BEFORE the accounting door
is reached -- no accounting file is written at all. Every one of the
16 549 elements then lands as `u` with `no declared fates`, which reads
like a finding about the build and is a finding about the run.

Two tests and a known-negative, so a rule that calls every corpus blank
fails too.

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

View file

@ -947,6 +947,33 @@ def test_a_corpus_refused_whole_under_the_default_gate_is_red(tmp_path: Path) ->
assert gate.refused_whole(inventory["documents"], build) is not None
def test_a_corpus_whose_every_document_has_no_declared_fate_says_so() -> None:
"""H6: N200 contributes one blank red. `okf build` proposes 0 plans on it
and FAILS (exit 2) before the accounting door is reached -- reproduced
2026-09-19: no accounting file is written at all -- so all 16 549 elements
land as `u` with `no declared fates` and the corpus measures none of the
classes it was brought in for. The row has to say that instead of showing
a number that looks like a finding about the build."""
blank = [
gate.Unit("a.json", "document", 9, 0, notes=["no declared fates"]),
gate.Unit("b.json", "document", 7, 0, notes=["no declared fates"]),
]
said = gate.measures_no_class(blank)
assert said is not None
assert "2 of 2" in said and "no declared fate" in said
def test_a_corpus_with_one_declared_document_is_not_called_blank() -> None:
"""The known-negative: one document with a fate is a corpus that measures
something, however badly the rest went."""
mixed = [
gate.Unit("a.json", "document", 9, 0, notes=["no declared fates"]),
gate.Unit("b.xml", "document", 0, 0, verified=3),
]
assert gate.measures_no_class(mixed) is None
assert gate.measures_no_class([]) is None
def test_the_two_real_corpora_are_named_and_the_second_is_not_r761() -> None:
"""R761 holds 0 `fig`, 0 formulas and 0 references, so the gate's only
real corpus could not see the hole in the STS role map."""