test_substrate_health.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago
| 1 | """Unit tests for Muse substrate health checks.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from pathlib import Path |
| 6 | |
| 7 | from adapters.config import load_config |
| 8 | from tests.support import FIXTURES |
| 9 | from tools.substrate_health import check_substrate |
| 10 | |
| 11 | |
| 12 | def test_git_only_not_applicable(tmp_path: Path) -> None: |
| 13 | config = load_config(FIXTURES / "config-git-only.yaml") |
| 14 | report = check_substrate(config, tmp_path) |
| 15 | assert report.ok |
| 16 | assert report.state == "not_applicable" |
| 17 | |
| 18 | |
| 19 | def test_muse_mirror_healthy(repo_root: Path, muse_git_mirror_config) -> None: |
| 20 | muse = repo_root / ".muse" |
| 21 | muse.mkdir(parents=True) |
| 22 | (muse / "HEAD").write_text("ref: refs/heads/main\n", encoding="utf-8") |
| 23 | (muse / "repo.json").write_text("{}", encoding="utf-8") |
| 24 | (muse / "config.toml").write_text("", encoding="utf-8") |
| 25 | report = check_substrate(muse_git_mirror_config, repo_root) |
| 26 | assert report.ok |
| 27 | assert report.state == "healthy" |
| 28 | |
| 29 | |
| 30 | def test_muse_mirror_hollow(repo_root: Path, muse_git_mirror_config) -> None: |
| 31 | (repo_root / ".muse").mkdir(parents=True) |
| 32 | (repo_root / ".museattributes").write_text("", encoding="utf-8") |
| 33 | report = check_substrate(muse_git_mirror_config, repo_root) |
| 34 | assert not report.ok |
| 35 | assert report.state == "hollow" |
| 36 | assert report.remediation == "muse init --force ." |
| 37 | assert ".muse/HEAD" in report.missing |
| 38 | |
| 39 | |
| 40 | def test_muse_mirror_missing_dir(repo_root: Path, muse_git_mirror_config) -> None: |
| 41 | report = check_substrate(muse_git_mirror_config, repo_root) |
| 42 | assert not report.ok |
| 43 | assert report.state == "missing" |
| 44 | assert report.remediation == "muse init ." |
File History
2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439
feat: K1-P1 complete — agent provenance, build-verification…
Sonnet 4.6
patch
53 days ago