test_print_next_stress.py python
33 lines 1.2 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 21 hours ago
1 """Stress — large handover with fence at end (§ONS.12)."""
2
3 from __future__ import annotations
4
5 import time
6 from pathlib import Path
7
8 from tools.print_next.extract import CurrentNextResult, extract_current_next
9
10 MARKER = "STRESS-FENCE-BODY-UNIQUE-TOKEN"
11 PERF_BOUND_S = 2.0
12
13
14 def test_stress_large_handover_fence_at_end(tmp_path: Path) -> None:
15 docs = tmp_path / "docs"
16 docs.mkdir(parents=True, exist_ok=True)
17 path = docs / "OVERSEER-HANDOVER.md"
18 done_rows = "\n".join(f"| **DONE-{i}** | Auto | **DONE** | filler |" for i in range(200))
19 filler = ("x" * 1024 + "\n") * (1550) # ≥1.5 MiB of padding before fence
20 body = (
21 f"# Handover\n\n## Queue\n\n{done_rows}\n\n{filler}\n"
22 f"### Paste-ready prompt — stress\n\n```text\n{MARKER}\nModel: Auto\n```\n"
23 )
24 path.write_text(body, encoding="utf-8")
25 assert path.stat().st_size >= int(1.5 * 1024 * 1024)
26
27 start = time.perf_counter()
28 result = extract_current_next(path, repo_relative_path="docs/OVERSEER-HANDOVER.md", lane=None)
29 elapsed = time.perf_counter() - start
30 assert isinstance(result, CurrentNextResult)
31 assert MARKER in result.fence
32 assert "Model: Auto" in result.fence
33 assert elapsed < PERF_BOUND_S
File History 1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 21 hours ago