test_lt_integrity.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
2 days 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:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
2 days ago