fix(okf): one unquoting rule for frontmatter scalars (kø-(a)/(i))
Two rules existed. verdicts._unquote took quotes off correctly; the
bundle_context title renderer stripped only `"`. Measured before the fix:
`title: " Spaced "` rendered as `## concept: Spaced ` (the whitespace
half kø-(a) named), and `title: 'Single'` rendered its quotes verbatim —
both ordinary YAML a hand-authoring curator writes, and both reach the
agent's read-context.
The (p) defect class: a duplicated conversion drifts, and the drifted copy
decides something. Same fix shape — ONE source, owned by the module that
owns parse_frontmatter. okf.unquote_scalar is now the rule; verdicts
delegates by identity, so the structural key that _mint_id hashes is
unchanged.
The commons-owned nav-goldens could never have caught this: every golden
title is double-quoted with no inner whitespace, so both rules render them
byte-identically. That is asserted as a control, and it goes RED if a
future golden gains a discriminating title.
Load-bearing MEASURED against the whole suite, three mutations:
- weaken the renderer back to .strip('"') -> ONLY the 2 new rows red,
643 others green (incl. nav-goldens) = it covers ground nothing did
- reintroduce a private _unquote copy in verdicts -> only the identity
test red, 644 green (the copy is behaviourally identical TODAY, which
is exactly why identity is the only thing that catches the class)
- (control, kø-(n)) add `import numpy` to a second src module -> the
existing test_semretrieval_is_the_sole_numpy_importer goes red alone,
confirming that gate is live rather than green-but-dead
638 -> 645 tests.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVMsih6tXx39VMyq6wJ5H7
This commit is contained in:
parent
1515a474d6
commit
fbc7a6120a
3 changed files with 130 additions and 5 deletions
|
|
@ -488,10 +488,12 @@ class VerdictFrontmatterError(ValueError):
|
|||
malformed files because anyone may drop anything there."""
|
||||
|
||||
|
||||
def _unquote(raw: str) -> str:
|
||||
"""``parse_frontmatter`` preserves quotes (OKF SPEC §4); the structural fields are compared and
|
||||
hashed against the IR projection's RAW JSON values, so the quotes have to come off here."""
|
||||
return raw.strip().strip('"').strip("'").strip()
|
||||
# ``parse_frontmatter`` preserves quotes (OKF SPEC §4); the structural fields are compared and
|
||||
# hashed against the IR projection's RAW JSON values, so the quotes have to come off. DELEGATED,
|
||||
# not copied: this was a private implementation while ``okf.bundle_context`` stripped only ``"``,
|
||||
# and a duplicated conversion drifts (the (p) precedent). ``okf`` owns ``parse_frontmatter``, so it
|
||||
# owns the unquoting rule. Gated by ``tests/test_frontmatter_unquote_loadbearing.py``.
|
||||
_unquote = okf.unquote_scalar
|
||||
|
||||
|
||||
def _parse_affected_codes(raw: str) -> frozenset[str]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue