test(fixtures): a synthetic K2 denominator for pptx, odt and rtf
`docs/2026-09-04-k2-pptx-odt-rtf.md` measured the corpus denominator for these three office rows and found it ZERO: `K2/trinn1` holds 43 files and not one of them is a `pptx`, an `odt` or an `rtf`. So `extract._EVIDENCE` calls those rows `unmeasured` in the strongest sense available -- they work by construction and had never met a document at all. This is the smallest thing that changes that without inventing a corpus. One authored document -- a title, an intro, a 20-row label/value table, a caption and a 4x4 grid -- laid out three times in three containers, so the container and its reader are the only variable between the three measurements. `k2-office-fasit.json` carries the hand count taken from the AUTHORED content rather than from any converter's output: 56 cells, 20 pairs, 59 distinct strings, shared by all three. It is committed here, before the measurement runs, because a fasit written afterwards is a description of a result rather than a denominator for it. No converter wrote any of these files. `make_k2_office.py` lays every part by hand, for the reason `make_fixtures.py` already states and this set inherits: a file written by the converter and then read by the converter proves only that the converter agrees with itself, and stays green through any conversion defect that is symmetric. The commissioning order offered pandoc as one generator option; the committed fixture policy forbids it and the policy wins. Two converter behaviours were measured while laying the RTF out, both of them structurally plausible input read silently wrong, exit code 0 and no warning. Without `\pard\intbl` on cell paragraphs, consecutive `\trowd...\row` rows come back as each row NESTED inside the previous one: five label/value rows read as five levels of nested table, 2076 characters where 117 were expected. And the `\uN?` unicode escape -- the form Word emits -- loses the character after it: `A\u248?BC` reads back as `AoC` with the `B` gone, `A\u248?xBC` reads back as `AoBC`. The fixture writes `\uN ?` with an explicit space, which round-trips. Neither is worked around anywhere in `src/`. The generator and the fasit live one level above `k2-office/` and that is not tidiness: Door B walks its drop directory recursively, so anything parked beside the three documents would enter the run and N would stop being 3. Three synthetic documents in one house style are not a corpus. The rows stay `unmeasured` and the suite asserts that they do. Suite 1132 passed (1127 + 5), `ruff check` and `ruff format --check` clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
4ce14ae5dd
commit
a7b050b569
7 changed files with 593 additions and 0 deletions
50
tests/fixtures/README.md
vendored
50
tests/fixtures/README.md
vendored
|
|
@ -47,6 +47,56 @@ structurally valid input, silently reduced output, exit code 0 and no warning:
|
|||
the xlsx extracts with the sheet name intact and **every cell value gone**.
|
||||
The fixture therefore uses a `dimension` element and a shared string table.
|
||||
|
||||
## The K2 office fixture set (`k2-office/`)
|
||||
|
||||
`krav-presentasjon.pptx`, `krav-tekstdokument.odt` and
|
||||
`krav-rikt-tekstformat.rtf` are the synthetic denominator for the three office
|
||||
rows the corpus has none of. `docs/2026-09-04-k2-pptx-odt-rtf.md` measured that
|
||||
denominator at **zero** — `K2/trinn1` holds 43 files and not one is a `pptx`,
|
||||
an `odt` or an `rtf` — so those rows were `unmeasured` in the sense of never
|
||||
having met a document at all. Regenerated by `make_k2_office.py` in this
|
||||
directory:
|
||||
|
||||
```
|
||||
python3 tests/fixtures/make_k2_office.py
|
||||
```
|
||||
|
||||
**One document, three containers.** All three carry the same authored content —
|
||||
a title, an intro, a 20-row label/value table, a caption and a 4x4 grid — so
|
||||
the only variable between the three measurements is the container and the
|
||||
reader that opens it. The counts are hand-counted once, in
|
||||
`k2-office-fasit.json`, and shared: **56 cells, 20 pairs, 59 distinct strings.**
|
||||
|
||||
**The generator and the fasit live one level up, and that is not tidiness.**
|
||||
Door B walks its drop directory recursively, so anything parked inside
|
||||
`k2-office/` would enter the run and N would stop being 3.
|
||||
|
||||
Same policy as the office fixtures above, for the same reason: every part is
|
||||
hand-laid and no converter wrote any of them. The commissioning order offered
|
||||
pandoc as a generator option; a file written by the converter and then read by
|
||||
the converter would prove only that the converter agrees with itself.
|
||||
|
||||
Two things were measured while building this set, both against the vendored
|
||||
pandoc 3.9, and both are the house shape — structurally plausible input,
|
||||
silently wrong output, exit code 0 and no warning:
|
||||
|
||||
- **RTF cell paragraphs need `\pard\intbl`.** Without it, consecutive
|
||||
`\trowd…\row` rows are read as each row NESTED inside the previous one:
|
||||
five label/value rows came back as five levels of nested table, 2076
|
||||
characters where 117 were expected.
|
||||
- **The `\uN?` unicode escape loses the character after it.** Measured
|
||||
directly: `A\u248?BC` reads back as `AoC` (ring letter present, `B` gone) and
|
||||
`A\u248?xBC` reads back as `AoBC`. The `?` is taken as the control word's
|
||||
delimiter and `\uc1` then skips a real character. The fixture writes
|
||||
`\uN ?` with an explicit space, which round-trips. **This is the form Word
|
||||
emits**, so it is a converter finding rather than a fixture quirk — recorded
|
||||
in `docs/2026-09-07-k2-pptx-odt-rtf-fixtures.md`, not worked around anywhere
|
||||
in `src/`.
|
||||
|
||||
**Three synthetic documents in one house style are not a corpus.** The rows stay
|
||||
`unmeasured` in `extract._EVIDENCE` and `tests/test_k2_office_fixtures.py`
|
||||
asserts that they do.
|
||||
|
||||
## The proposer's default-profile golden
|
||||
|
||||
`propose-golden-default.json` is the artifact `tools/okf_propose_segments.py`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue