test_pilot_status_bounded.py python
58 lines 1.9 KB
Raw
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439 feat: K1-P1 complete — agent provenance, build-verification… Sonnet 4.6 patch 61 days ago
1 """Performance: pilot status + governance-sync dry-run bounded (§K6.10)."""
2
3 from __future__ import annotations
4
5 import json
6 import time
7 from pathlib import Path
8
9 from tests.support import PILOT, muse_mirror_status_runner, ok, run_cli, seed_pilot_tree
10
11
12 def test_pilot_status_and_dry_run_bounded(tmp_path: Path) -> None:
13 seed_pilot_tree(
14 tmp_path,
15 handover_rel="docs/OVERSEER-HANDOVER.md",
16 handover_text="# H\n" + ("row\n" * 500),
17 roadmap_rel="docs/ROADMAP.md",
18 roadmap_text="# R\n" + ("row\n" * 500),
19 )
20 runner = muse_mirror_status_runner(tmp_path)
21 root = str(tmp_path.resolve())
22 runner.responses.update(
23 {
24 f"muse -C {root} rev-parse main": ok('{"commit_id": "' + "a" * 40 + '"}'),
25 "git rev-parse origin/main": ok("b" * 40),
26 "gh pr list --state merged --limit 5 --json number,title,mergeCommit,mergedAt": ok(
27 json.dumps([])
28 ),
29 }
30 )
31 (tmp_path / ".muse").mkdir(exist_ok=True)
32 (tmp_path / ".muse" / "git-bridge.toml").write_text(
33 '[last_export]\ngit_sha = "' + ("c" * 40) + '"\n'
34 '[last_import]\ngit_sha = "' + ("c" * 40) + '"\n',
35 encoding="utf-8",
36 )
37 assert (
38 run_cli(
39 [
40 "init",
41 "--migrate",
42 "--from-config",
43 str(PILOT / "config-scooling.yaml"),
44 "--non-interactive",
45 ],
46 cwd=tmp_path,
47 runner=runner,
48 )
49 == 0
50 )
51
52 start = time.perf_counter()
53 assert run_cli(["status", "--check-footprint"], cwd=tmp_path, runner=runner) == 0
54 run_cli(["governance-sync", "--dry-run"], cwd=tmp_path, runner=runner)
55 elapsed = time.perf_counter() - start
56 assert elapsed < 5.0
57 # Bounded VCS scans: status + dry-run must not unbounded-loop
58 assert len(runner.calls) < 40
File History 1 commit
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439 feat: K1-P1 complete — agent provenance, build-verification… Sonnet 4.6 patch 61 days ago