test_checkpoints_bounded.py
python
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83
chore(governance): sync handover+roadmap to 84db8c8 (drift:…
Human
1 day ago
| 1 | """Performance bounds for checkpoint verify-step.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import stat |
| 6 | import time |
| 7 | |
| 8 | import yaml |
| 9 | |
| 10 | from adapters.config import load_config |
| 11 | from tests.support import seed_checkpoint_repo |
| 12 | from tools.checkpoints.orchestrator import VerifyStepOptions, run_verify_step |
| 13 | |
| 14 | |
| 15 | def _seed_twenty_step(repo_root) -> None: |
| 16 | seed_checkpoint_repo(repo_root) |
| 17 | policy_path = repo_root / "policy" / "checkpoints.yaml" |
| 18 | policy = yaml.safe_load(policy_path.read_text(encoding="utf-8")) |
| 19 | steps = {} |
| 20 | template_steps = [] |
| 21 | for index in range(20): |
| 22 | step_id = f"p{index:02d}" |
| 23 | script_name = f"verify_{step_id}.py" |
| 24 | script_path = repo_root / "scripts" / "verify" / script_name |
| 25 | script_path.write_text("#!/usr/bin/env python3\nimport sys\nsys.exit(0)\n", encoding="utf-8") |
| 26 | script_path.chmod(script_path.stat().st_mode | stat.S_IXUSR) |
| 27 | steps[step_id] = {"verify_script": f"scripts/verify/{script_name}"} |
| 28 | template_steps.append(step_id) |
| 29 | policy["steps"].update(steps) |
| 30 | policy["templates"]["perf"] = {"steps": template_steps} |
| 31 | policy_path.write_text(yaml.safe_dump(policy), encoding="utf-8") |
| 32 | manifest = { |
| 33 | "schema_version": 1, |
| 34 | "template_id": "perf", |
| 35 | "slug": "perf", |
| 36 | "current_step": template_steps[0], |
| 37 | "meta": {}, |
| 38 | "steps": { |
| 39 | sid: {"verified": False, "verified_at": None, "artifact_sha256": None} |
| 40 | for sid in template_steps |
| 41 | }, |
| 42 | } |
| 43 | (repo_root / "manifests" / "work-unit.yaml").write_text(yaml.safe_dump(manifest), encoding="utf-8") |
| 44 | |
| 45 | |
| 46 | def test_twenty_step_all_bounded(repo_root) -> None: |
| 47 | _seed_twenty_step(repo_root) |
| 48 | config = load_config(repo_root / ".overseer" / "config.yaml") |
| 49 | start = time.monotonic() |
| 50 | result = run_verify_step( |
| 51 | config=config, |
| 52 | repo_root=repo_root, |
| 53 | options=VerifyStepOptions(verify_all=True), |
| 54 | ) |
| 55 | elapsed = time.monotonic() - start |
| 56 | assert result.exit_code == 0 |
| 57 | assert elapsed < 15.0 |
File History
1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199
fix(ISR): default require_independent_second_reviewer to require
Human
minor
⚠
1 day ago