test_lt_integrity.py python
53 lines 2.3 KB
Raw
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83 chore(governance): sync handover+roadmap to 84db8c8 (drift:… Human 1 day ago
1 """Data-integrity tests for LT loop tightening (§LT.10)."""
2
3 from __future__ import annotations
4
5 from pathlib import Path
6
7 from tests.support import load_fixture_config, write_config
8 from tools.footprint_coverage import check_footprint_coverage
9 from tools.handover_compact import compact_handover_change_log
10
11
12 def test_compact_twice_second_no_op(tmp_path: Path) -> None:
13 config = load_fixture_config(tmp_path, "config-git-only.yaml")
14 handover = tmp_path / "docs" / "OVERSEER-HANDOVER.md"
15 handover.parent.mkdir(parents=True, exist_ok=True)
16 bullets = "\n\n".join(f"- **2026-01-{day:02d}** — entry {day}" for day in range(1, 21))
17 handover.write_text(
18 f"<!-- overseer:anchor:change-log -->\n{bullets}\n"
19 "<!-- /overseer:anchor:change-log -->\n",
20 encoding="utf-8",
21 )
22 first = compact_handover_change_log(config, tmp_path, keep=15, write=True)
23 archive = tmp_path / first.archive
24 first_bytes = archive.read_bytes()
25 second = compact_handover_change_log(config, tmp_path, keep=15, write=True)
26 assert second.compacted == 0
27 assert archive.read_bytes() == first_bytes
28
29
30 def test_coverage_does_not_rewrite_lock(tmp_path: Path) -> None:
31 write_config(tmp_path, "config-git-only.yaml")
32 config = load_fixture_config(tmp_path, "config-git-only.yaml")
33 lock_path = tmp_path / ".overseer" / "version.lock"
34 lock_path.write_text("footprint: []\n", encoding="utf-8")
35 before = lock_path.read_bytes()
36 check_footprint_coverage(tmp_path, config)
37 assert lock_path.read_bytes() == before
38
39
40 def test_dry_run_compact_writes_nothing(tmp_path: Path) -> None:
41 config = load_fixture_config(tmp_path, "config-git-only.yaml")
42 handover = tmp_path / "docs" / "OVERSEER-HANDOVER.md"
43 handover.parent.mkdir(parents=True, exist_ok=True)
44 original = (
45 "<!-- overseer:anchor:change-log -->\n"
46 + "\n\n".join(f"- **2026-01-{d:02d}** — e" for d in range(1, 21))
47 + "\n<!-- /overseer:anchor:change-log -->\n"
48 )
49 handover.write_text(original, encoding="utf-8")
50 report = compact_handover_change_log(config, tmp_path, keep=15, write=False)
51 assert report.compacted == 5
52 assert handover.read_text(encoding="utf-8") == original
53 assert not (tmp_path / "docs" / "archive" / "handover" / "CHANGE-LOG.md").exists()
File History 1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199 fix(ISR): default require_independent_second_reviewer to require Human minor 1 day ago