test_k7_footprint_check.py file-level

at main · View file ↗ · Intel ↗

History
1 files
1 commits
0 hotspots
0 🧊 dead
0 💥 blast risk
sha256:6 fix(ISR): default require_independent_second_reviewer to require Opera… · aaronrene · Sep 2, 2026
1 """Performance tests for K7 status --check-footprint with bridge files (§K7.8 performance tier)."""
2
3 from __future__ import annotations
4
5 import time
6 from pathlib import Path
7
8 from cli.footprint import MUSE_BRIDGE_WORKFLOW_DEST
9 from tests.support import FIXTURES, muse_mirror_status_runner, run_cli, seed_muse_substrate
10
11
12 def test_check_footprint_bounded_with_bridge_files(tmp_path: Path) -> None:
13 runner = muse_mirror_status_runner(tmp_path)
14 assert (
15 run_cli(
16 [
17 "init",
18 "--from-config",
19 str(FIXTURES / "config-muse-git-mirror.yaml"),
20 "--non-interactive",
21 ],
22 cwd=tmp_path,
23 runner=runner,
24 )
25 == 0
26 )
27 seed_muse_substrate(tmp_path)
28 workflow = tmp_path / MUSE_BRIDGE_WORKFLOW_DEST
29 workflow.write_text(workflow.read_text(encoding="utf-8") + ("\n# padding\n" * 2000), encoding="utf-8")
30
31 start = time.perf_counter()
32 code = run_cli(["status", "--check-footprint", "--exit-code"], cwd=tmp_path, runner=runner)
33 elapsed = time.perf_counter() - start
34 assert code == 6 # footprint integrity mismatch (--exit-code precedence)
35 assert elapsed < 5.0
36
37 # Restore kit bytes and confirm fast OK path
38 run_cli(
39 [
40 "init",
41 "--from-config",
42 str(FIXTURES / "config-muse-git-mirror.yaml"),
43 "--non-interactive",
44 "--force",
45 ],
46 cwd=tmp_path,
47 runner=runner,
48 )
49 start = time.perf_counter()
50 assert run_cli(["status", "--check-footprint"], cwd=tmp_path, runner=runner) == 0
51 elapsed = time.perf_counter() - start
52 assert elapsed < 5.0