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