test(accounting): the log must say where the soft-hyphen count comes from (red)

`normalised_soft_hyphen` is read off the RUN (`result.normalised`) and never
recounted from the source. It is the one number the accounting publishes with
no independent denominator behind it, and nothing in the output said so.

RED on the claim:

    assert "The count is the door's own, read off the run and not recounted" in log
    AssertionError: ... '* **Normalisation**: 5 soft hyphen(s) (U+00AD) removed
    from 1 of 1 document(s) before the persist gate. No other character is
    touched.'

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

View file

@ -156,6 +156,23 @@ def test_a_source_with_soft_hyphens_passes_the_default_gate(tmp_path: Path) -> N
assert "5 soft hyphen(s) (U+00AD) removed" in log
def test_the_log_says_where_the_soft_hyphen_count_comes_from(tmp_path: Path) -> None:
"""`normalised_soft_hyphen` is read off the RUN (`result.normalised`) and
never recounted from the source, so it is the one number in the accounting
with no independent denominator behind it. PM 2026-09-19 named the choice:
a second counter, or a stated provenance. The second was taken, and this
holds it -- an unstated one is the same class of defect as the door's own
unheld promise beside it."""
inbox = tmp_path / "inbox"
inbox.mkdir()
(inbox / "notat.md").write_text(_SOURCE.format(s=SHY), encoding="utf-8")
code, err = _build(inbox, tmp_path / "b", tmp_path / "a.json")
assert code == 0, err
log = (tmp_path / "b" / "log.md").read_text(encoding="utf-8")
assert "The count is the door's own, read off the run and not recounted" in log
assert "from the source." in log
def test_the_text_is_byte_identical_apart_from_the_removed_characters(tmp_path: Path) -> None:
"""The door removes the N characters and nothing else. Stated as an EXACT
invariant rather than a share: the extracted text with the soft hyphens put