test_large_footprint.py
file-level
1
files
1
commits
0
hotspots
0
🧊 dead
0
💥 blast risk
| 1 | """Stress tests for large footprint handling.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from pathlib import Path |
| 6 | |
| 7 | from cli.version_lock import read_version_lock |
| 8 | from tests.support import run_cli |
| 9 | |
| 10 | |
| 11 | def test_large_footprint_only_scope(tmp_path: Path, monkeypatch) -> None: |
| 12 | kit = tmp_path / "kit" |
| 13 | kit.mkdir() |
| 14 | (kit / "VERSION").write_text("0.1.0\n", encoding="utf-8") |
| 15 | for sub in ("templates", "policy", "cursor/rules", "cursor/skills/big"): |
| 16 | (kit / sub).mkdir(parents=True) |
| 17 | (kit / "templates" / "OVERSEER-HANDOVER.template.md").write_text("# {{repo.name}}\n", encoding="utf-8") |
| 18 | (kit / "templates" / "ROADMAP.template.md").write_text("# Roadmap\n", encoding="utf-8") |
| 19 | (kit / "templates" / "STANDING-DECISIONS.template.md").write_text("| SD-1 |\n", encoding="utf-8") |
| 20 | |
| 21 | for index in range(200): |
| 22 | (kit / "policy" / f"p{index}.yaml").write_text(f"k: {index}\n", encoding="utf-8") |
| 23 | (kit / "cursor" / "rules" / f"r{index}.mdc").write_text(f"rule {index}\n", encoding="utf-8") |
| 24 | (kit / "cursor" / "skills" / "big" / "SKILL.md").write_text("x" * 100_000 + "\n", encoding="utf-8") |
| 25 | |
| 26 | repo = tmp_path / "repo" |
| 27 | repo.mkdir() |
| 28 | assert run_cli( |
| 29 | ["init", "--regime", "git-only", "--non-interactive"], |
| 30 | cwd=repo, |
| 31 | kit=kit, |
| 32 | ) == 0 |
| 33 | |
| 34 | conflict = repo / ".overseer" / "policy" / "p0.yaml" |
| 35 | conflict.write_text("edited\n", encoding="utf-8") |
| 36 | |
| 37 | code = run_cli( |
| 38 | ["sync", "-y", "--only", ".overseer/policy/p1.yaml"], |
| 39 | cwd=repo, |
| 40 | kit=kit, |
| 41 | ) |
| 42 | assert code == 0 |
| 43 | lock = read_version_lock(repo / ".overseer" / "version.lock") |
| 44 | assert len(lock.footprint) >= 200 |