test_model_routing_performance.py python
49 lines 1.4 KB
Raw
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83 chore(governance): sync handover+roadmap to 84db8c8 (drift:… Human 1 day ago
1 """Performance tests for Track P / P-route (§PR.8)."""
2
3 from __future__ import annotations
4
5 import time
6 from unittest.mock import patch
7
8 from cli.kit_root import kit_root
9 from tests.fixtures.model_routing import seed_routing_repo
10 from tests.support import git_status_runner, run_cli
11 from tools.model_routing.policy import validate_routing_policy
12
13 BOUND_MS = 500
14
15
16 def test_route_resolve_bounded(tmp_path) -> None:
17 seed_routing_repo(tmp_path)
18 start = time.perf_counter()
19 code = run_cli(
20 ["route", "--position", "worker", "--gate", "default"],
21 cwd=tmp_path,
22 runner=git_status_runner(),
23 kit=kit_root(),
24 )
25 elapsed_ms = (time.perf_counter() - start) * 1000
26 assert code == 0
27 assert elapsed_ms < BOUND_MS
28
29
30 def test_route_validate_bounded(tmp_path) -> None:
31 policy_path = seed_routing_repo(tmp_path)
32 start = time.perf_counter()
33 result = validate_routing_policy(policy_path, kit_root=kit_root())
34 elapsed_ms = (time.perf_counter() - start) * 1000
35 assert result.valid is True
36 assert elapsed_ms < BOUND_MS
37
38
39 def test_route_does_not_scan_vcs(tmp_path) -> None:
40 seed_routing_repo(tmp_path)
41 with patch("cli.vcs_status.read_vcs_status") as mocked:
42 mocked.side_effect = AssertionError("route must not scan VCS")
43 code = run_cli(
44 ["route", "--validate"],
45 cwd=tmp_path,
46 runner=git_status_runner(),
47 kit=kit_root(),
48 )
49 assert code == 0
File History 1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199 fix(ISR): default require_independent_second_reviewer to require Human minor 1 day ago