test(propose): pin the default artifact with a committed golden

This commit is contained in:
Kjell Tore Guttormsen 2026-09-07 01:20:31 +02:00
commit c97e250f69
3 changed files with 140 additions and 0 deletions

View file

@ -47,6 +47,30 @@ 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 proposer's default-profile golden
`propose-golden-default.json` is the artifact `tools/okf_propose_segments.py`
produces for `OUTLINE_DOCUMENT` (defined in `tests/test_propose_segments.py`)
with **no flags at all**, generated at commit `798f64a` with
`--proposed-at 2026-09-03T00:00:00Z`. The timestamp is an explicit argument
because the artifact carries it verbatim; a wall-clock default would make the
golden unreproducible by construction.
**Why the fixture is `OUTLINE_DOCUMENT` and not `DOCUMENT`.** The golden exists
to go red if any later rule is accidentally defaulted ON. `DOCUMENT` was
measured to contain **zero** bare-integer lines, so a golden over it would stay
byte-identical through exactly the regression it was named to catch -- a trap
written down but unable to fire. `OUTLINE_DOCUMENT` carries a bare-integer
ascending run of three, which today's rules do not match (measured: bare `1` /
`1.` / `1)` yield 0 candidates), so the golden pins that absence and breaks the
moment it stops being true.
**It transitively pins `observed_extractor_version`**
(`src/llm_ingestion_okf/segmentation.py`): the field is written into every
artifact, so a converter or extractor bump turns this golden red. That red is
legitimate -- read the diff and decide, exactly as for the frozen PDF literal
below. Regenerate only after that decision, never to make a red go away.
## Why the expected office text is frozen as a literal
The same reason as the PDF text below, with one addition: the literals are

View file

@ -0,0 +1,52 @@
{
"version": "1",
"source_sha256": "5eb8f9f9c1c7584f66182beb886de3aec9fab3446892a5a430509bb6fc68031b",
"text_sha256": "5eb8f9f9c1c7584f66182beb886de3aec9fab3446892a5a430509bb6fc68031b",
"extractor_id": "md",
"extractor_version": "stdlib-1",
"adjudicated_at": "2026-09-03T00:00:00Z",
"adjudicated": false,
"proposed_by": "okf-propose-segments/1",
"entries": [
{
"segment_id": "p1",
"path": "stange-skole-teknisk-grunnlag.md",
"title": "Stange skole -- teknisk grunnlag",
"okf_type": "reference",
"span": [
0,
297
],
"ingested_at": "2026-09-03T00:00:00Z",
"anchor": {
"quote": "# Stange skole -- teknisk grunnlag\n\nInnledende tekst som gir dokumentet en kropp foer kapitlene begynner.\n\n1 Innledning\n\nBakgrunnen for prosjektet og omfanget av arbeidet.\n\n2 Krav\n\nKrav til seksjonering av bygget over flere etasjer.\n\n3 Gjennomfoering\n\nFramdrift, faser og overlevering av bygget.\n\n",
"prefix": "",
"suffix": "1.1 Brannkonsept\n\nTo uavhengige roemningsveier f"
},
"derived": [
"PROPOSED",
"rule:heading"
]
},
{
"segment_id": "p2",
"path": "1-1/brannkonsept.md",
"title": "Brannkonsept",
"okf_type": "reference",
"span": [
297,
365
],
"ingested_at": "2026-09-03T00:00:00Z",
"anchor": {
"quote": "1.1 Brannkonsept\n\nTo uavhengige roemningsveier fra hver branncelle.\n",
"prefix": "g\n\nFramdrift, faser og overlevering av bygget.\n\n",
"suffix": ""
},
"derived": [
"PROPOSED",
"rule:heading"
]
}
]
}