test_checkpoints_large_template.py python
63 lines 2.1 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 2 days 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 2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 2 days ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439 feat: K1-P1 complete — agent provenance, build-verification… Sonnet 4.6 patch 53 days ago