test(errors): reunite the segmentation codes with the conformance suite

The registry file says one test per code and that this file IS the
conformance suite. During the 1-to-N voyage the byte-stability pin over
tests/ was the verification mechanism, so editing this file was
forbidden and six new codes were covered in the new segmentation
modules instead. That was right then. The end-to-end gate run released
the pin, so the convention applies again -- a conformance suite split
across two files stops being one quietly, which is why this was carried
as an obligation rather than a preference.

All seven segmentation codes now have a test here, including
segmentation_plan_unmatched from this session. The behavioural tests in
test_segmentation.py and test_segmented_inbox.py stay where they are:
they exercise the parser and the door, a different question from
whether every documented code has a raise site.

Measured after: 49 documented codes, 48 covered in this file. The one
gap, source_reference_unquotable, predates this work and is tested in
tests/test_okf_v0_2_profile.py:351 -- reported, not silently closed.

Also records both defects and this migration as closed in the decision
record's known-gaps list.

Co-Authored-By: Claude <claude-opus-5>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-01 19:31:51 +02:00
commit ac6dffe51e
2 changed files with 152 additions and 12 deletions

View file

@ -118,23 +118,43 @@ hidden: a consumer meets both mechanisms.
## Known gaps, stated rather than left to be discovered
1. **`derived` marks a declared title as inferred.** A segmented concept's
`title` is DECLARED by the adjudicator, but structure derivation runs over
the segment body and adds `title` to `derived`. The marker is therefore
wrong in the one direction this repo cares about — a consumer that distrusts
derived fields will distrust a fact the producer stated. The golden pins
today's behaviour; the fix belongs with the code that composes the two.
2. **A plan matching no dropped file is silent.** A typo'd `source_sha256`
segments nothing and reports nothing, which is the silent skip this library
refuses elsewhere.
1. ~~**`derived` marks a declared title as inferred.**~~ **Closed 2026-09-01.**
A segmented concept's `title` is DECLARED by the adjudicator, but structure
derivation ran over the segment body and added `title` to `derived`. The
marker pointed the wrong way in the one direction this repo cares about — a
consumer that distrusts derived fields would have distrusted a fact the
producer stated. `title` is now dropped from `derived` when a segment is
present, and only then. The fix is scoped to `title` alone and pinned that
way: an inferred `number` still marks itself on a segment, because nothing
about segmentation makes a derived document number declared, and blunting
the marker would be the opposite defect. The `SEGMENTED_V1` golden moved
with it; the four others were measured byte-identical to baseline.
2. ~~**A plan matching no dropped file is silent.**~~ **Closed 2026-09-01.**
A typo'd `source_sha256` segmented nothing and reported nothing, which is
the silent skip this library refuses elsewhere. `process_inbox` now refuses
fail-fast with `segmentation_plan_unmatched` before any disk mutation. Two
sharper questions had to be settled to make the refusal correct rather than
merely loud. It asks whether a covering plan was **found**, not whether
every file was examined, so an unreadable drop cannot suppress it. And
coverage is recorded at **selection**, not after path validation: the first
cut asked the later question, and a plan whose hash matched but whose entry
paths were then refused looked identical to a plan that matched nothing —
the operator would have been sent to check a hash that was already right.
An existing collision test caught it; the case now has its own test,
verified red against the earlier form.
3. **`status: deprecated` has no producer.** `status` is named as a facet key
and nothing writes it, so a deprecated parent cannot carry one.
4. **An unchanged round still rewrites.** `write_bytes` writes
unconditionally; the bytes are identical, so no contract is broken, but
"an unchanged round writes nothing" is not true today.
5. **Six new error codes live in `tests/test_segmentation.py`, not
`tests/test_error_codes.py`.** The baseline pin forbade editing the
registry file. Migrate once the pin is released.
5. ~~**Six new error codes live in `tests/test_segmentation.py`, not
`tests/test_error_codes.py`.**~~ **Closed 2026-09-01.** The baseline pin
forbade editing the registry file while it was the voyage's verification
mechanism. The gate run above released it, so the registry convention — one
test per code, this file IS the conformance suite — applies again, and the
codes were migrated. A conformance suite split across two files stops being
one quietly, which is why this was carried as an obligation rather than a
preference.
## The end-to-end gate run, and its one failure