test_cli_check_ok.py
python
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83
chore(governance): sync handover+roadmap to 84db8c8 (drift:…
Human
1 day ago
| 1 | """Integration — ``ok check-ok`` scaffolds then delegates to review --freeze.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from datetime import date |
| 6 | from pathlib import Path |
| 7 | |
| 8 | from cli.kit_root import kit_root |
| 9 | from tests.support import git_status_runner, pass_provider_factory, run_cli, write_config |
| 10 | from tools.check_ok.scaffold import scaffold_side_check |
| 11 | |
| 12 | |
| 13 | def test_scaffold_only_creates_artifact(tmp_path: Path) -> None: |
| 14 | write_config(tmp_path, "config-git-only.yaml") |
| 15 | code = run_cli( |
| 16 | ["check-ok", "--topic", "integration-spike", "--scaffold-only"], |
| 17 | cwd=tmp_path, |
| 18 | runner=git_status_runner(), |
| 19 | kit=kit_root(), |
| 20 | ) |
| 21 | assert code == 0 |
| 22 | reviews = list((tmp_path / "docs" / "reviews").glob("*-integration-spike.md")) |
| 23 | assert len(reviews) == 1 |
| 24 | assert "frozen: true" in reviews[0].read_text(encoding="utf-8") |
| 25 | |
| 26 | |
| 27 | def test_check_ok_runs_same_review_engine(tmp_path: Path) -> None: |
| 28 | write_config(tmp_path, "config-git-only.yaml") |
| 29 | result = scaffold_side_check( |
| 30 | tmp_path, |
| 31 | topic="wired", |
| 32 | scope="Integration scope with seven-tier test matrix and file+line citations.", |
| 33 | today=date(2026, 7, 17), |
| 34 | ) |
| 35 | code = run_cli( |
| 36 | ["check-ok", "--path", result.rel_path, "--dry-run", "--json"], |
| 37 | cwd=tmp_path, |
| 38 | runner=git_status_runner(), |
| 39 | kit=kit_root(), |
| 40 | review_provider_factory=pass_provider_factory(), |
| 41 | json_mode=True, |
| 42 | ) |
| 43 | # Local checklist may still emit findings; engine must run (not usage/refuse-init). |
| 44 | assert code in {0, 7, 8} |
| 45 | |
| 46 | |
| 47 | def test_path_escape_refused(tmp_path: Path) -> None: |
| 48 | write_config(tmp_path, "config-git-only.yaml") |
| 49 | code = run_cli( |
| 50 | ["check-ok", "--path", "../outside.md", "--scaffold-only"], |
| 51 | cwd=tmp_path, |
| 52 | runner=git_status_runner(), |
| 53 | kit=kit_root(), |
| 54 | ) |
| 55 | assert code == 4 |
File History
1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199
fix(ISR): default require_independent_second_reviewer to require
Human
minor
⚠
1 day ago