test_model_routing_integrity.py
python
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83
chore(governance): sync handover+roadmap to 84db8c8 (drift:…
Human
8 hours ago
| 1 | """Data-integrity tests for Track P / P-route (§PR.8).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from cli.footprint import resolve_footprint |
| 6 | from cli.kit_root import kit_root |
| 7 | from tests.fixtures.model_routing import seed_routing_repo |
| 8 | from tests.support import git_status_runner, run_cli |
| 9 | from tools.model_routing.policy import validate_routing_policy |
| 10 | from tools.model_routing.resolve import resolve_route |
| 11 | from tools.model_routing.types import RouteSelector |
| 12 | |
| 13 | |
| 14 | def test_resolution_idempotent(tmp_path) -> None: |
| 15 | policy_path = seed_routing_repo(tmp_path) |
| 16 | from tools.model_routing.policy import load_routing_policy |
| 17 | |
| 18 | policy = load_routing_policy(policy_path, kit_root=kit_root()) |
| 19 | query = RouteSelector(gate="freeze_review", phase_tier="thinking") |
| 20 | assert resolve_route(policy, query) == resolve_route(policy, query) |
| 21 | |
| 22 | |
| 23 | def test_validate_deterministic(tmp_path) -> None: |
| 24 | policy_path = seed_routing_repo(tmp_path) |
| 25 | first = validate_routing_policy(policy_path, kit_root=kit_root()) |
| 26 | second = validate_routing_policy(policy_path, kit_root=kit_root()) |
| 27 | assert first == second |
| 28 | |
| 29 | |
| 30 | def test_routing_policy_in_footprint(git_only_config) -> None: |
| 31 | dests = {item.destination for item in resolve_footprint(git_only_config)} |
| 32 | assert ".overseer/policy/model-routing.yaml" in dests |
| 33 | assert ".overseer/policy/model-labels.yaml" in dests |
| 34 | |
| 35 | |
| 36 | def test_validate_does_not_mutate_policy_file(tmp_path) -> None: |
| 37 | policy_path = seed_routing_repo(tmp_path) |
| 38 | before = policy_path.read_bytes() |
| 39 | run_cli( |
| 40 | ["route", "--validate"], |
| 41 | cwd=tmp_path, |
| 42 | runner=git_status_runner(), |
| 43 | kit=kit_root(), |
| 44 | ) |
| 45 | after = policy_path.read_bytes() |
| 46 | assert before == after |
File History
1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199
fix(ISR): default require_independent_second_reviewer to require
Human
minor
⚠
7 hours ago