Refresh WORK-RECORDS.md after every live record is archived.
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Multi-Context Image / build-and-push (push) Successful in 35s

C-33 returned early when the generator produced no rows, so a leftover
index kept listing archived workplans as active. Rewrite that file to an
empty table instead of leaving the stale rows in place.

Assistant: grok
Assistant-Session: 01a04d7c-846d-77e3-af8d-020019e4eb61
This commit is contained in:
tegwick 2026-08-29 14:39:42 +02:00
parent ef0b6df3b8
commit 037c8360e2
2 changed files with 55 additions and 4 deletions

View file

@ -17,6 +17,7 @@ from consistency_check import ( # noqa: E402
ConsistencyReport,
_check_work_record_index_freshness,
_generate_work_record_index,
_work_record_index_document,
)
REGISTRY_YAML = textwrap.dedent(
@ -185,3 +186,36 @@ class TestCheckWorkRecordIndexFreshness:
ctx = report.issues[0]._fix_context
assert ctx["index_file"] == tmp_path / "WORK-RECORDS.md"
assert "AWQ-001" in ctx["content"]
def test_flags_stale_index_when_only_archived_workplans_remain(
self, tmp_path, registry_file
):
wp_dir = tmp_path / "workplans" / "archived"
wp_dir.mkdir(parents=True)
(wp_dir / "260101-CUST-WP-0000-old.md").write_text(
"---\nid: CUST-WP-0000\nstatus: finished\n---\n", encoding="utf-8"
)
(tmp_path / "WORK-RECORDS.md").write_text(
"| workplan | CUST-WP-0000 | active | — | workplans/CUST-WP-0000-old.md |\n",
encoding="utf-8",
)
report = self._report(tmp_path)
assert len(report.issues) == 1
assert report.issues[0].check_id == "C-33"
content = report.issues[0]._fix_context["content"]
assert "CUST-WP-0000" not in content
assert "| Kind | ID | Status | Lane | Source |" in content
def test_no_issue_when_empty_index_matches_archived_only_repo(
self, tmp_path, registry_file
):
wp_dir = tmp_path / "workplans" / "archived"
wp_dir.mkdir(parents=True)
(wp_dir / "260101-CUST-WP-0000-old.md").write_text(
"---\nid: CUST-WP-0000\nstatus: finished\n---\n", encoding="utf-8"
)
(tmp_path / "WORK-RECORDS.md").write_text(
_work_record_index_document("testrepo", []), encoding="utf-8"
)
report = self._report(tmp_path)
assert report.issues == []