test_q1_app_e2e.py python
85 lines 2.9 KB
Raw
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83 chore(governance): sync handover+roadmap to 84db8c8 (drift:… Human 9 hours ago
1 """End-to-end tests for Track Q / Q1 overseer app (§Q0.12)."""
2
3 from __future__ import annotations
4
5 from pathlib import Path
6
7 from cli.kit_root import kit_root
8 from tests.fixtures.app import seed_app_e2e_repo, seed_app_repo, start_test_app
9 from tests.support import FIXTURES, make_runner, ok, pass_provider_factory, run_cli
10
11
12 def _governance_runner(tmp_path: Path):
13 return make_runner(
14 {
15 "git rev-parse --abbrev-ref HEAD": ok("main"),
16 "git status --porcelain": ok(""),
17 "git rev-parse origin/main": ok("cafebabe"),
18 "gh pr list --state merged --limit 5 --json number,title,mergeCommit,mergedAt": ok("[]"),
19 "git remote get-url origin": ok("[email protected]:owner/repo.git"),
20 "git merge-base --is-ancestor": ok(""),
21 }
22 )
23
24
25 def test_full_operator_flow(tmp_path: Path) -> None:
26 artifact = seed_app_e2e_repo(tmp_path)
27 rel = artifact.relative_to(tmp_path).as_posix()
28
29 docs = tmp_path / "docs"
30 (docs / "OVERSEER-HANDOVER.md").write_text(
31 (FIXTURES / "governance-handover-drift.md").read_text(encoding="utf-8"),
32 encoding="utf-8",
33 )
34 (docs / "ROADMAP.md").write_text(
35 (FIXTURES / "governance-roadmap-drift.md").read_text(encoding="utf-8"),
36 encoding="utf-8",
37 )
38
39 handle, client = start_test_app(
40 tmp_path,
41 runner=_governance_runner(tmp_path),
42 review_provider_factory=pass_provider_factory(),
43 )
44 try:
45 status, health = client.get("/api/health")
46 assert status == 200
47 assert health["result"]["status"] == "ok"
48
49 _s, status_payload = client.get("/api/status")
50 assert status_payload["result"]["initialized"] is True
51
52 _s, roadmap = client.get("/api/docs/roadmap")
53 assert "ROADMAP" in roadmap["result"]["text"] or "roadmap" in roadmap["result"]["text"].lower()
54
55 _s, handover = client.get("/api/docs/handover")
56 assert handover["ok"] is True
57
58 _s, freeze = client.post("/api/review/freeze", {"path": rel, "dry_run": True})
59 assert freeze["exit_code"] == 0
60
61 _s, sync = client.post("/api/governance-sync", {"write": False})
62 assert sync["exit_code"] == 0
63
64 _s, ledger = client.get("/api/ledger/show")
65 assert ledger["exit_code"] == 0
66
67 _s, verify = client.post("/api/ledger/verify", {})
68 assert verify["exit_code"] == 0
69
70 _s, honesty = client.post(
71 "/api/honesty-status",
72 {"hook": "board_done", "artifact": "artifacts/sample.txt"},
73 )
74 assert honesty["exit_code"] in {0, 20, 33}
75
76 cli_status = run_cli(
77 ["status", "--json", "--exit-code"],
78 cwd=tmp_path,
79 runner=_governance_runner(tmp_path),
80 kit=kit_root(),
81 json_mode=True,
82 )
83 assert status_payload["exit_code"] == cli_status
84 finally:
85 handle.shutdown()
File History 1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199 fix(ISR): default require_independent_second_reviewer to require Human minor 9 hours ago