__init__.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago
| 1 | """ISR fixture helpers (§ISR.11).""" |
| 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 seed_honesty_repo |
| 13 | |
| 14 | FIXTURES = Path(__file__).resolve().parent |
| 15 | ISR_ENTRIES = FIXTURES / "entries" |
| 16 | |
| 17 | |
| 18 | def load_isr_entry(name: str) -> dict: |
| 19 | """Load an independent_second_review entry fixture.""" |
| 20 | return json.loads((ISR_ENTRIES / name).read_text(encoding="utf-8")) |
| 21 | |
| 22 | |
| 23 | def seed_isr_repo( |
| 24 | repo_root: Path, |
| 25 | *, |
| 26 | require_independent_second_reviewer: str = "off", |
| 27 | require_verification_evidence: str = "off", |
| 28 | honesty_enabled: bool = True, |
| 29 | regime_config: str | None = None, |
| 30 | ) -> OverseerConfig: |
| 31 | """Seed honesty repo with optional ISR gate config.""" |
| 32 | seed_honesty_repo(repo_root) |
| 33 | cfg_path = repo_root / ".overseer" / "config.yaml" |
| 34 | data = yaml.safe_load(cfg_path.read_text(encoding="utf-8")) |
| 35 | data["honesty"]["enabled"] = honesty_enabled |
| 36 | data["honesty"]["require_independent_second_reviewer"] = require_independent_second_reviewer |
| 37 | data["honesty"]["require_verification_evidence"] = require_verification_evidence |
| 38 | if "modules" in data and isinstance(data["modules"], dict): |
| 39 | honesty_mod = data["modules"].setdefault("honesty", {}) |
| 40 | if isinstance(honesty_mod, dict): |
| 41 | honesty_mod["enabled"] = honesty_enabled |
| 42 | if regime_config is not None: |
| 43 | regime_src = Path(__file__).resolve().parents[2] / "fixtures" / Path(regime_config).name |
| 44 | regime_data = yaml.safe_load(regime_src.read_text(encoding="utf-8")) |
| 45 | for key in ("vcs", "repo", "docs", "thresholds", "freeze_contract"): |
| 46 | if key in regime_data: |
| 47 | data[key] = regime_data[key] |
| 48 | if regime_data.get("vcs", {}).get("regime", "").startswith("muse"): |
| 49 | from tests.support import seed_muse_substrate |
| 50 | |
| 51 | seed_muse_substrate(repo_root) |
| 52 | cfg_path.write_text(yaml.safe_dump(data), encoding="utf-8") |
| 53 | docs = repo_root / "docs" |
| 54 | docs.mkdir(parents=True, exist_ok=True) |
| 55 | (docs / "archive" / "phases").mkdir(parents=True, exist_ok=True) |
| 56 | ( |
| 57 | docs / "archive" / "phases" / "PHASE-ISR-INDEPENDENT-SECOND-REVIEWER.md" |
| 58 | ).write_text("# frozen isr\n", encoding="utf-8") |
| 59 | return load_config(cfg_path) |
| 60 | |
| 61 | |
| 62 | def copy_isr_entries(repo_root: Path) -> None: |
| 63 | """Copy entry fixtures into repo for CLI append tests.""" |
| 64 | dest = repo_root / "entries" |
| 65 | if dest.exists(): |
| 66 | shutil.rmtree(dest) |
| 67 | shutil.copytree(ISR_ENTRIES, dest) |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago