test_post_land_sync_stress.py python
42 lines 1.5 KB
Raw
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83 chore(governance): sync handover+roadmap to 84db8c8 (drift:… Human 1 day ago
1 """Stress tier §PLS.10 — N≥20 alternating dirty-skip / clean-sync cycles."""
2
3 from __future__ import annotations
4
5 from pathlib import Path
6
7 from tests.support import FakeGitRunner
8 from tools.close_ritual.post_land_sync import run_post_land_sync
9
10 FORBIDDEN_TOKENS = ("--force", "reset", "clean", "stash", "merge", "push", "gh")
11 ALLOWED_OPS = {"fetch", "status", "rev-parse", "checkout", "pull"}
12
13
14 def test_alternating_dirty_and_clean_cycles_never_clobber(repo_root: Path) -> None:
15 cycles = 24
16 for i in range(cycles):
17 dirty = i % 2 == 0
18 git = FakeGitRunner(
19 porcelain=f" M docs/file-{i}.md\n" if dirty else "",
20 branch="feat/pls-stress" if i % 4 == 1 else "main",
21 )
22 report = run_post_land_sync(
23 repo_root=repo_root,
24 regime="git-only",
25 remote="origin",
26 main_branch="main",
27 git_runner=git,
28 )
29 ops = [c[1] for c in git.calls]
30 if dirty:
31 # Never clobber: no checkout/pull after a dirty porcelain read.
32 assert report.status == "skipped_dirty"
33 assert "checkout" not in ops
34 assert "pull" not in ops
35 else:
36 assert report.status == "synced"
37 assert git.calls[-1] == ["git", "pull", "--ff-only", "origin", "main"]
38 for call in git.calls:
39 assert call[0] == "git"
40 assert call[1] in ALLOWED_OPS
41 for token in FORBIDDEN_TOKENS:
42 assert token not in call[1:]
File History 1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199 fix(ISR): default require_independent_second_reviewer to require Human minor 1 day ago