test(frontmatter): what okf writes must be YAML a YAML reader reads back the same

K3-22, red first. SPEC SS 11 point 1 requires "a parseable YAML frontmatter
block" in every file. Measured with PyYAML 6.0.3 before any code moved: the
K2 default bundle this repository pins fails safe_load on 41 of 455
frontmatter blocks, all on `title` (a leading `- `, `**` or `*`, or ": "),
and the R761 build on 1 of 2 763 (a title ending in `:`). No `sources` value
okf itself wrote failed; the 4 605 consumer failures come from that
consumer's own writer.

Each case goes through a public path (render_inbox_concept, the profile
emitter, Door A's sources renderer, skill.render) and is held to three
readers: safe_load must not raise, BaseLoader must return the same strings
as parse_frontmatter / read_sources, and the pinned guard must admit it. The
guard is why quoting inside a flow mapping is not the fix: 1.3.0 refuses any
quote in a flow mapping (measured), so a `sources` leaf PyYAML needs quoted
has no form both readers accept, and is refused instead.

57 of 85 red on 0308169; the 28 green are the known-negatives and controls.
The rest of the suite is unchanged: 1695 passed (1667 + 28), 1 skipped.

pyyaml joins [dependency-groups] dev and nothing else; uv.lock moves by
exactly the two lines that dev dependency adds.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-11 10:56:05 +02:00
commit 06e61a5acf
3 changed files with 387 additions and 1 deletions

View file

@ -124,7 +124,14 @@ ocr = ["rapidocr>=3.9,<4", "onnxruntime>=1.20,<2", "pypdfium2>=4,<6"]
# tree read green while 0.16.6 found 148 things in it. The floor is now the
# version the acceptance was measured under, and the ceiling is the next minor,
# because 0.16 is itself the release that widened the default rule set.
dev = ["pytest>=8", "mypy>=1.14", "ruff>=0.16.6,<0.17"]
#
# pyyaml is a TEST reader and nothing else (K3-22): SPEC SS 11 requires "a
# parseable YAML frontmatter block" in every file, and the only way to measure
# that is to ask a YAML reader. How a value is WRITTEN stays decided by a rule
# in `profiles`, never by a parser, so `src/` imports no yaml; the tests
# validate the rule against this reader. The floor is the version it was
# measured under (6.0.3, 2026-09-11).
dev = ["pytest>=8", "mypy>=1.14", "ruff>=0.16.6,<0.17", "pyyaml>=6.0.3,<7"]
[tool.hatch.build.targets.wheel]
packages = ["src/llm_ingestion_okf"]