test_k7_footprint_check.py
python
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83
chore(governance): sync handover+roadmap to 84db8c8 (drift:…
Human
1 day ago
| 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 |
File History
1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199
fix(ISR): default require_independent_second_reviewer to require
Human
minor
⚠
1 day ago