Files
ersatztv/scripts/tests/test_build_catalog.py
T
timothyandClaude Opus 4.8 67619b2bf6 feat(521): active-catalog generator
Adds scripts/build_decisions_catalog.py, which renders docs/decisions/README.md
as a compact table of only 'active' decision records (sorted by key), and its
test scripts/tests/test_build_catalog.py. Supports --check for CI drift
detection. No decision records are migrated yet, so the generated catalog is
currently empty (banner + header only) — expected at this stage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 02:58:58 +02:00

40 lines
1.0 KiB
Python

from pathlib import Path
import scripts.build_decisions_catalog as bc
import scripts.decisions_lib as dl
def test_catalog_lists_only_active_sorted_by_key():
recs = [
dl.Record(
heading="H2",
source=Path("x"),
lineno=1,
key="z.a",
status="active",
rule="Zeta rule",
),
dl.Record(
heading="H1",
source=Path("x"),
lineno=1,
key="a.b",
status="active",
rule="Alpha rule",
),
dl.Record(
heading="Old",
source=Path("x"),
lineno=1,
key="a.b",
status="superseded",
rule="old",
),
]
out = bc.render_catalog(recs)
assert "a.b" in out and "z.a" in out
assert out.index("a.b") < out.index("z.a") # sorted
assert "Alpha rule" in out and "Zeta rule" in out
assert "old" not in out # superseded excluded
assert "GENERATED" in out # do-not-edit banner