test_cli_init_sync_status.py python
76 lines 2.2 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 15 hours ago
1 """Integration tests for init/sync/status across regimes."""
2
3 from __future__ import annotations
4
5 from pathlib import Path
6
7 import pytest
8 import yaml
9
10 from adapters.config import load_config
11 from cli.footprint import resolve_footprint
12 from cli.kit_root import kit_root
13 from tests.support import (
14 FIXTURES,
15 git_status_runner,
16 muse_mirror_status_runner,
17 muse_status_runner,
18 run_cli,
19 )
20
21
22 @pytest.mark.parametrize(
23 ("fixture", "runner_factory"),
24 [
25 ("config-git-only.yaml", lambda p: git_status_runner()),
26 ("config-muse-only.yaml", lambda p: muse_status_runner(p)),
27 ("config-muse-git-mirror.yaml", lambda p: muse_mirror_status_runner(p)),
28 ],
29 )
30 def test_init_full_footprint_per_regime(tmp_path: Path, fixture: str, runner_factory) -> None:
31 code = run_cli(
32 ["init", "--from-config", str(FIXTURES / fixture), "--non-interactive"],
33 cwd=tmp_path,
34 kit=kit_root(),
35 )
36 assert code == 0
37 config = load_config(tmp_path / ".overseer" / "config.yaml")
38 footprint = resolve_footprint(config, kit=kit_root())
39 for item in footprint:
40 assert (tmp_path / item.destination).is_file()
41
42 sd = tmp_path / ".overseer" / "STANDING-DECISIONS.reference.md"
43 assert sd.is_file()
44 assert "SD-1" in sd.read_text(encoding="utf-8")
45
46 if config.docs.coordination is None:
47 coord = [
48 f.destination
49 for f in footprint
50 if f.source.endswith("CROSS-REPO-COORDINATION.template.md")
51 ]
52 assert coord == []
53
54 code = run_cli(
55 ["status", "--json"],
56 cwd=tmp_path,
57 runner=runner_factory(tmp_path),
58 )
59 assert code == 0
60
61 code = run_cli(["sync", "-y"], cwd=tmp_path, runner=runner_factory(tmp_path))
62 assert code == 0
63
64
65 def test_destination_collision_fails_closed(tmp_path: Path) -> None:
66 data = yaml.safe_load((FIXTURES / "config-git-only.yaml").read_text(encoding="utf-8"))
67 data["docs"]["handover"] = "ROADMAP.md"
68 data["docs"]["roadmap"] = "ROADMAP.md"
69 cfg = tmp_path / "collision.yaml"
70 cfg.write_text(yaml.safe_dump(data), encoding="utf-8")
71 code = run_cli(
72 ["init", "--from-config", str(cfg), "--non-interactive"],
73 cwd=tmp_path,
74 kit=kit_root(),
75 )
76 assert code == 2
File History 2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 15 hours ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439 feat: K1-P1 complete — agent provenance, build-verification… Sonnet 4.6 patch 52 days ago