fix(521): de-dup 6 overlapped records; guard duplicate metadata blocks; exclude retrieval-eval; complete eval bank [decisions-edit]
- Exclude docs/decisions/retrieval-eval.md from active decision parsing (_NON_DECISION_FILES); its `## N.` eval-question headings were being miscounted as 7 legacy-unmigrated records. - Add decisions_lib.metadata_line_count() + a decisions_validate guard that fails a record with more than one `key:` metadata line, so a stacked-metadata-block migration bug (which the parser silently tolerated by reading only the first block) can't recur unnoticed. TDD: test_duplicate_metadata_block_fails / test_single_metadata_block_passes. - De-duplicate the 6 docs/decisions.md records left with two stacked metadata blocks (scan.getoraddfolder-db-lookup #488, scan.musicvideo-reconciliation #494, scan.jellyfin-mixed-content-library #489, iptv.logo-drives-bug-preset #67, ffmpeg.qsv-decode-encode-split #498, ci.small-lane-git-only server-management#639), merging the union of Signals/paths/issues/Mechanics from both blocks and keeping the richer Rule wording; rationale prose untouched. - Fill in the deferred Q6b row in docs/decisions/retrieval-eval.md now that startup.parallel-orientation is active in docs/decisions.md, scoring it as a real active-vs-superseded question against the archived docs.queue-state-gitea-tracker. - Regenerate docs/decisions/README.md via build_decisions_catalog.py. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -137,6 +137,35 @@ def test_demoted_heading_fails():
|
||||
)
|
||||
|
||||
|
||||
def test_duplicate_metadata_block_fails():
|
||||
# A migration bug left records with two stacked metadata blocks; the parser only reads the
|
||||
# first, so only an explicit body scan (metadata_line_count) can catch the leftover second block.
|
||||
body = (
|
||||
"`key: a.b` · `status: active` · `since: 2026-01-01` · `supersedes: none` · `superseded-by: none`\n"
|
||||
"**Rule:** first block rule.\n"
|
||||
"\n"
|
||||
"`key: a.b` · `status: active` · `since: 2026-01-01` · `supersedes: none` · `superseded-by: none`\n"
|
||||
"**Rule:** second block rule.\n"
|
||||
"\n"
|
||||
"Rationale prose goes here."
|
||||
)
|
||||
rec = _rec(key="a.b", body=body)
|
||||
assert dl.metadata_line_count(rec) == 2
|
||||
assert any("duplicate metadata block" in e and "2 metadata blocks" in e for e in _v([rec]))
|
||||
|
||||
|
||||
def test_single_metadata_block_passes():
|
||||
body = (
|
||||
"`key: a.b` · `status: active` · `since: 2026-01-01` · `supersedes: none` · `superseded-by: none`\n"
|
||||
"**Rule:** the only rule.\n"
|
||||
"\n"
|
||||
"Rationale prose goes here."
|
||||
)
|
||||
rec = _rec(key="a.b", body=body)
|
||||
assert dl.metadata_line_count(rec) == 1
|
||||
assert not any("duplicate metadata block" in e for e in _v([rec]))
|
||||
|
||||
|
||||
def test_contents_heading_is_skipped():
|
||||
# docs/decisions/*.md topic files use "## Contents" as their index heading (the analog of
|
||||
# decisions.md's "## Index") — it carries no metadata and must not be miscounted as a
|
||||
|
||||
Reference in New Issue
Block a user