__init__.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
4 days ago
| 1 | """P-deploy fixture helpers (§PD.9).""" |
| 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 | P_DEPLOY_ENTRIES = FIXTURES / "entries" |
| 16 | |
| 17 | |
| 18 | def load_p_deploy_entry(name: str) -> dict: |
| 19 | """Load a verification_evidence entry fixture for Mode C tests.""" |
| 20 | return json.loads((P_DEPLOY_ENTRIES / name).read_text(encoding="utf-8")) |
| 21 | |
| 22 | |
| 23 | def seed_p_deploy_repo( |
| 24 | repo_root: Path, |
| 25 | *, |
| 26 | require_deploy_health: str = "off", |
| 27 | require_verification_evidence: str = "off", |
| 28 | regime_config: str | None = None, |
| 29 | ) -> OverseerConfig: |
| 30 | """Seed honesty repo with optional deploy-health gate config.""" |
| 31 | seed_honesty_repo(repo_root) |
| 32 | cfg_path = repo_root / ".overseer" / "config.yaml" |
| 33 | data = yaml.safe_load(cfg_path.read_text(encoding="utf-8")) |
| 34 | data["honesty"]["require_deploy_health"] = require_deploy_health |
| 35 | data["honesty"]["require_verification_evidence"] = require_verification_evidence |
| 36 | if regime_config is not None: |
| 37 | regime_src = Path(__file__).resolve().parents[2] / "fixtures" / Path(regime_config).name |
| 38 | regime_data = yaml.safe_load(regime_src.read_text(encoding="utf-8")) |
| 39 | for key in ("vcs", "repo", "docs", "thresholds", "freeze_contract"): |
| 40 | if key in regime_data: |
| 41 | data[key] = regime_data[key] |
| 42 | if regime_data.get("vcs", {}).get("regime", "").startswith("muse"): |
| 43 | from tests.support import seed_muse_substrate |
| 44 | |
| 45 | seed_muse_substrate(repo_root) |
| 46 | cfg_path.write_text(yaml.safe_dump(data), encoding="utf-8") |
| 47 | docs = repo_root / "docs" |
| 48 | docs.mkdir(parents=True, exist_ok=True) |
| 49 | (docs / "PHASE-TRACK-P-P-DEPLOY.md").write_text("# frozen deploy gate\n", encoding="utf-8") |
| 50 | health = repo_root / "artifacts" |
| 51 | health.mkdir(parents=True, exist_ok=True) |
| 52 | (health / "deploy-health.json").write_text('{"status":"ok"}\n', encoding="utf-8") |
| 53 | return load_config(cfg_path) |
| 54 | |
| 55 | |
| 56 | def copy_p_deploy_entries(repo_root: Path) -> None: |
| 57 | """Copy entry fixtures into repo for CLI append tests.""" |
| 58 | dest = repo_root / "entries" |
| 59 | if dest.exists(): |
| 60 | shutil.rmtree(dest) |
| 61 | shutil.copytree(P_DEPLOY_ENTRIES, dest) |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
4 days ago