test_governance_sync_dry_run.py python
56 lines 1.9 KB
Raw
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83 chore(governance): sync handover+roadmap to 84db8c8 (drift:… Human 22 hours ago
1 """Integration tests for governance-sync dry-run (§8 integration tier)."""
2
3 from __future__ import annotations
4
5 from pathlib import Path
6
7 from cli.kit_root import kit_root
8 from tests.support import FIXTURES, ok, run_cli, write_config
9
10
11 def _seed_governance_repo(tmp_path: Path) -> None:
12 write_config(tmp_path, "config-git-only.yaml")
13 docs = tmp_path / "docs"
14 docs.mkdir(parents=True, exist_ok=True)
15 (docs / "OVERSEER-HANDOVER.md").write_text(
16 (FIXTURES / "governance-handover-drift.md").read_text(encoding="utf-8"),
17 encoding="utf-8",
18 )
19 (docs / "ROADMAP.md").write_text(
20 (FIXTURES / "governance-roadmap-drift.md").read_text(encoding="utf-8"),
21 encoding="utf-8",
22 )
23
24
25 def _governance_runner(tmp_path: Path):
26 root = str(tmp_path.resolve())
27 return {
28 "git rev-parse --abbrev-ref HEAD": ok("main"),
29 "git status --porcelain": ok(""),
30 "git rev-parse origin/main": ok("cafebabe"),
31 "gh pr list --state merged --limit 5 --json number,title,mergeCommit,mergedAt": ok("[]"),
32 f"git remote get-url origin": ok("[email protected]:owner/repo.git"),
33 "git merge-base --is-ancestor": ok(""),
34 }
35
36
37 def test_governance_sync_dry_run_tree_unchanged(tmp_path: Path) -> None:
38 _seed_governance_repo(tmp_path)
39 handover = tmp_path / "docs" / "OVERSEER-HANDOVER.md"
40 roadmap = tmp_path / "docs" / "ROADMAP.md"
41 before_h = handover.read_text(encoding="utf-8")
42 before_r = roadmap.read_text(encoding="utf-8")
43
44 from tests.support import make_runner
45
46 runner = make_runner(_governance_runner(tmp_path))
47 code = run_cli(
48 ["governance-sync", "--json"],
49 cwd=tmp_path,
50 runner=runner,
51 kit=kit_root(),
52 json_mode=True,
53 )
54 assert code == 0
55 assert handover.read_text(encoding="utf-8") == before_h
56 assert roadmap.read_text(encoding="utf-8") == before_r
File History 1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199 fix(ISR): default require_independent_second_reviewer to require Human minor 22 hours ago