test(gates): retire the K2 track; re-measure the retrieval gate's premises for BM25

Operator decision 2026-09-21: the test track built on material tied to the
operator's employer (K2) is retired -- not re-measured, not frozen. Public
tests and gates run on invented material.

Retrieval gate:
- The four FUSION_PREMISE xfails are gone and pass through their INPUTS: the
  synthetic MISS, LOOKUP and QUOTA bundles were re-measured for BM25 (the
  miss fasit no longer shares the rare word `maa`; lookup and quota decoys
  carry the question's words so each partition and the quota decide their
  own fixture). SPECS_SHA256 moved with them. Rows 2 and 3 green again.
- Row 7's mutants M04, M06, M07, M08, M10 now patch `bm25`, the code the
  default runs. Three survive with 0 ranks moved (passage body, title
  weight, bm25.RRF_K), each with its mechanism printed. M07 was not forced:
  every synthetic body carries its title as a heading.
- Row 9 (K2) removed; row 8 requires `wiki-20` alone, the `r761` and
  `vegnormal` adapters are gone. Chose the broad reading of "K2" because the
  operator decision defines it as employer-tied material and the order's
  grep includes `vegnormal`.

Also removed: tests/test_default_bundle_pin.py, the K2 arms of
test_okf_consume, the four real-arm tests of test_quality, the R761 soft
hyphen test, the N101/N200 delivery tests and okf_accounting_gate's default
real corpus (and H5's guard, which only existed for those defaults). Two
fixtures carrying road-standard identifiers are rewritten with invented ones.

Gate after: 1 10/10, 2 7/7, 3 5/5, 4 6/6, 5 0/1, 6 10/10, 7 11/14,
8 NOT RUN -> GATE RED: rows 5, 7, 8. Suite 2423 passed, 1 skipped,
0 xfailed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-21 10:05:43 +02:00
commit 3d149f955a
12 changed files with 288 additions and 1096 deletions

View file

@ -35,14 +35,14 @@ FIXTURES = Path(__file__).parent / "fixtures"
# The form the producer actually ships, copied from a bundle: a query string
# carries `?`, `=` and `&`, and no flow form of it passes both PyYAML and the
# guard -- which is why the producer moved to the block form at all.
VEGNORMAL = """\
PRODUCER_FORM = """\
---
type: Krav
title: Krav 10.2-2 Beredskap
source_file: normal.xml
source_file: haandbok.xml
sources:
- resource: https://viewers.test.invalid/api/nisosts/860019?languageCode=nb&v=2
title: N500:2024
- resource: https://viewers.test.invalid/api/documents/4711?languageCode=nb&v=2
title: H500:2024
---
## Krav
@ -70,12 +70,12 @@ Body.
# the document's namespace.
NESTED_TITLE = """\
---
title: N100.2 Kryss og avkjoersler
title: H100.2 Hytter og uthus
generated: true
source_file: vegnormal.md
source_file: haandbok.md
sources:
- resource: https://example.test/bruprosjektering.pdf
title: N200.7 Bruprosjektering
- resource: https://example.test/broeyting.pdf
title: H200.7 Broeyting
---
Body.
@ -118,7 +118,7 @@ QUOTED_LEAVES = """\
title: Krav 1
sources:
- resource: "a, b.pdf"
title: 'N100'
title: 'H100'
---
Body.
@ -161,12 +161,12 @@ def _read_sources(text: str, tmp_path: Path) -> tuple[tuple[object, ...], bool]:
def test_control_read_sources_reads_the_block_form(tmp_path: Path) -> None:
entries, present = _read_sources(VEGNORMAL, tmp_path)
entries, present = _read_sources(PRODUCER_FORM, tmp_path)
assert present
assert [dict(entry) for entry in entries] == [
{
"resource": "https://viewers.test.invalid/api/nisosts/860019?languageCode=nb&v=2",
"title": "N500:2024",
"resource": "https://viewers.test.invalid/api/documents/4711?languageCode=nb&v=2",
"title": "H500:2024",
}
]
@ -174,12 +174,12 @@ def test_control_read_sources_reads_the_block_form(tmp_path: Path) -> None:
def test_control_both_reference_readers_read_the_block_form() -> None:
expected = [
{
"resource": "https://viewers.test.invalid/api/nisosts/860019?languageCode=nb&v=2",
"title": "N500:2024",
"resource": "https://viewers.test.invalid/api/documents/4711?languageCode=nb&v=2",
"title": "H500:2024",
}
]
assert _pyyaml_sources(VEGNORMAL) == expected
assert _guard_sources(VEGNORMAL) == expected
assert _pyyaml_sources(PRODUCER_FORM) == expected
assert _guard_sources(PRODUCER_FORM) == expected
# --- the defect, once per copy of the grammar -----------------------------
@ -187,10 +187,10 @@ def test_control_both_reference_readers_read_the_block_form() -> None:
@pytest.mark.parametrize("reader", ["materialize", "structure", "profiles"])
def test_block_sources_reaches_every_flat_reader(reader: str, tmp_path: Path) -> None:
value = _flat_readings(VEGNORMAL, tmp_path)[reader]["sources"]
value = _flat_readings(PRODUCER_FORM, tmp_path)[reader]["sources"]
assert value != ""
assert _parse_flow_mappings(value) == _pyyaml_sources(VEGNORMAL)
assert _parse_flow_mappings(value) == _guard_sources(VEGNORMAL)
assert _parse_flow_mappings(value) == _pyyaml_sources(PRODUCER_FORM)
assert _parse_flow_mappings(value) == _guard_sources(PRODUCER_FORM)
@pytest.mark.parametrize("reader", ["materialize", "structure", "profiles"])
@ -213,13 +213,13 @@ def test_a_nested_title_still_does_not_substitute(reader: str, tmp_path: Path) -
"""The most important control here: reading the block is not a licence to
let a nested key into the document's namespace."""
flat = _flat_readings(NESTED_TITLE, tmp_path)[reader]
assert flat["title"] == "N100.2 Kryss og avkjoersler"
assert flat["title"] == "H100.2 Hytter og uthus"
assert "resource" not in flat
assert set(flat) == {"title", "generated", "source_file", "sources"}
assert _parse_flow_mappings(flat["sources"]) == [
{
"resource": "https://example.test/bruprosjektering.pdf",
"title": "N200.7 Bruprosjektering",
"resource": "https://example.test/broeyting.pdf",
"title": "H200.7 Broeyting",
}
]
@ -255,7 +255,7 @@ def test_quoted_leaves_follow_the_k3_22_rule(reader: str, tmp_path: Path) -> Non
value = _flat_readings(QUOTED_LEAVES, tmp_path)[reader]["sources"]
entries, _present = _read_sources(QUOTED_LEAVES, tmp_path)
assert _parse_flow_mappings(value) == [dict(entry) for entry in entries]
assert _parse_flow_mappings(value) == [{"resource": "a, b.pdf", "title": "'N100'"}]
assert _parse_flow_mappings(value) == [{"resource": "a, b.pdf", "title": "'H100'"}]
# --- the shipped fixtures, all of them, not a sample ----------------------