__init__.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago
| 1 | """P-evidence fixture helpers (§PE.10).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import json |
| 6 | import shutil |
| 7 | from pathlib import Path |
| 8 | |
| 9 | import yaml |
| 10 | |
| 11 | from adapters.config import OverseerConfig, load_config |
| 12 | from tests.support import HONESTY, seed_honesty_repo |
| 13 | |
| 14 | FIXTURES = Path(__file__).resolve().parent |
| 15 | P_EVIDENCE_ENTRIES = FIXTURES / "entries" |
| 16 | |
| 17 | |
| 18 | def load_p_evidence_entry(name: str) -> dict: |
| 19 | """Load a verification_evidence entry fixture.""" |
| 20 | return json.loads((P_EVIDENCE_ENTRIES / name).read_text(encoding="utf-8")) |
| 21 | |
| 22 | |
| 23 | def seed_p_evidence_repo( |
| 24 | repo_root: Path, |
| 25 | *, |
| 26 | require_verification_evidence: str = "off", |
| 27 | regime_config: str | None = None, |
| 28 | ) -> OverseerConfig: |
| 29 | """Seed honesty repo with optional verification-evidence config.""" |
| 30 | seed_honesty_repo(repo_root) |
| 31 | cfg_path = repo_root / ".overseer" / "config.yaml" |
| 32 | data = yaml.safe_load(cfg_path.read_text(encoding="utf-8")) |
| 33 | data["honesty"]["require_verification_evidence"] = require_verification_evidence |
| 34 | if regime_config is not None: |
| 35 | regime_src = Path(__file__).resolve().parents[2] / "fixtures" / Path(regime_config).name |
| 36 | regime_data = yaml.safe_load(regime_src.read_text(encoding="utf-8")) |
| 37 | for key in ("vcs", "repo", "docs", "thresholds", "freeze_contract"): |
| 38 | if key in regime_data: |
| 39 | data[key] = regime_data[key] |
| 40 | if regime_data.get("vcs", {}).get("regime", "").startswith("muse"): |
| 41 | from tests.support import seed_muse_substrate |
| 42 | |
| 43 | seed_muse_substrate(repo_root) |
| 44 | cfg_path.write_text(yaml.safe_dump(data), encoding="utf-8") |
| 45 | docs = repo_root / "docs" |
| 46 | docs.mkdir(parents=True, exist_ok=True) |
| 47 | (docs / "PHASE-TRACK-P-P-EVIDENCE.md").write_text("# frozen spec\n", encoding="utf-8") |
| 48 | archive = repo_root / "docs" / "archive" / "verify" |
| 49 | archive.mkdir(parents=True, exist_ok=True) |
| 50 | (archive / "p-evidence-status.png").write_bytes(b"\x89PNG\r\n\x1a\nfake") |
| 51 | return load_config(cfg_path) |
| 52 | |
| 53 | |
| 54 | def copy_p_evidence_entries(repo_root: Path) -> None: |
| 55 | """Copy entry fixtures into repo for CLI append tests.""" |
| 56 | dest = repo_root / "entries" |
| 57 | if dest.exists(): |
| 58 | shutil.rmtree(dest) |
| 59 | shutil.copytree(P_EVIDENCE_ENTRIES, dest) |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago