test_checkpoints_orchestrator.py python
69 lines 2.4 KB
Raw
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83 chore(governance): sync handover+roadmap to 84db8c8 (drift:… Human 8 hours ago
1 """Integration tests for built-in checkpoint orchestrator."""
2
3 from __future__ import annotations
4
5 from pathlib import Path
6
7 import yaml
8
9 from tests.support import load_checkpoint_config, seed_checkpoint_repo
10 from tools.checkpoints.orchestrator import VerifyStepOptions, run_verify_step
11
12
13 def test_step_pass_updates_manifest(repo_root: Path) -> None:
14 config = load_checkpoint_config(repo_root)
15 result = run_verify_step(
16 config=config,
17 repo_root=repo_root,
18 options=VerifyStepOptions(step_id="alpha"),
19 )
20 assert result.exit_code == 0
21 manifest = yaml.safe_load((repo_root / "manifests" / "work-unit.yaml").read_text(encoding="utf-8"))
22 assert manifest["steps"]["alpha"]["verified"] is True
23 assert manifest["current_step"] == "beta"
24 progress = (repo_root / "PROGRESS.md").read_text(encoding="utf-8")
25 assert "alpha" in progress
26
27
28 def test_verify_fail_exit_10_no_write(repo_root: Path) -> None:
29 seed_checkpoint_repo(repo_root)
30 manifest_path = repo_root / "manifests" / "work-unit.yaml"
31 data = yaml.safe_load(manifest_path.read_text(encoding="utf-8"))
32 data["template_id"] = "three_step"
33 data["current_step"] = "gamma"
34 data["steps"]["alpha"]["verified"] = True
35 data["steps"]["beta"]["verified"] = True
36 data["steps"]["gamma"] = {
37 "verified": False,
38 "verified_at": None,
39 "artifact_sha256": None,
40 }
41 manifest_path.write_text(yaml.safe_dump(data), encoding="utf-8")
42 from adapters.config import load_config
43
44 config = load_config(repo_root / ".overseer" / "config.yaml")
45 before = manifest_path.read_bytes()
46 result = run_verify_step(
47 config=config,
48 repo_root=repo_root,
49 options=VerifyStepOptions(step_id="gamma"),
50 )
51 assert result.exit_code == 10
52 assert manifest_path.read_bytes() == before
53
54
55 def test_artifact_sha256_persisted(repo_root: Path) -> None:
56 config = load_checkpoint_config(repo_root)
57 run_verify_step(
58 config=config,
59 repo_root=repo_root,
60 options=VerifyStepOptions(step_id="alpha"),
61 )
62 result = run_verify_step(
63 config=config,
64 repo_root=repo_root,
65 options=VerifyStepOptions(step_id="beta"),
66 )
67 assert result.exit_code == 0
68 manifest = yaml.safe_load((repo_root / "manifests" / "work-unit.yaml").read_text(encoding="utf-8"))
69 assert manifest["steps"]["beta"]["artifact_sha256"] == "abcdef0123456789"
File History 1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199 fix(ISR): default require_independent_second_reviewer to require Human minor 7 hours ago