test_print_next_e2e.py
python
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83
chore(governance): sync handover+roadmap to 84db8c8 (drift:…
Human
1 day ago
| 1 | """E2E — write new fence then ``ok next`` prints the new body (§ONS.12).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from pathlib import Path |
| 6 | |
| 7 | from cli.kit_root import kit_root |
| 8 | from tests.support import FIXTURES, git_status_runner, run_cli, seed_git_repo, write_config |
| 9 | from tools.print_next.extract import CURRENT_NEXT_HEADING |
| 10 | |
| 11 | |
| 12 | NEW_BODY = """You are Auto — NEW FENCE BODY TOKEN abc123. |
| 13 | |
| 14 | Model: Auto |
| 15 | """ |
| 16 | |
| 17 | |
| 18 | def test_e2e_new_fence_then_idempotent(tmp_path: Path, capsys) -> None: |
| 19 | write_config(tmp_path, "config-git-only.yaml") |
| 20 | seed_git_repo(tmp_path) |
| 21 | docs = tmp_path / "docs" |
| 22 | docs.mkdir(parents=True, exist_ok=True) |
| 23 | handover = docs / "OVERSEER-HANDOVER.md" |
| 24 | handover.write_text( |
| 25 | (FIXTURES / "print-next-handover.md").read_text(encoding="utf-8"), |
| 26 | encoding="utf-8", |
| 27 | ) |
| 28 | (docs / "ROADMAP.md").write_text("# Roadmap\n", encoding="utf-8") |
| 29 | |
| 30 | runner = git_status_runner(branch="feat/ons-operator-next-surfacing") |
| 31 | code1 = run_cli(["next"], cwd=tmp_path, runner=runner, kit=kit_root()) |
| 32 | out1 = capsys.readouterr().out |
| 33 | assert code1 == 0 |
| 34 | assert "ONS fixture" in out1 |
| 35 | assert "NEW FENCE BODY TOKEN" not in out1 |
| 36 | |
| 37 | handover.write_text( |
| 38 | "# Handover\n\n### Paste-ready prompt — new\n\n```text\n" |
| 39 | + NEW_BODY |
| 40 | + "```\n", |
| 41 | encoding="utf-8", |
| 42 | ) |
| 43 | |
| 44 | code2 = run_cli(["next"], cwd=tmp_path, runner=runner, kit=kit_root()) |
| 45 | out2 = capsys.readouterr().out |
| 46 | assert code2 == 0 |
| 47 | assert CURRENT_NEXT_HEADING in out2 |
| 48 | assert "NEW FENCE BODY TOKEN abc123" in out2 |
| 49 | assert "ONS fixture" not in out2 |
| 50 | |
| 51 | code3 = run_cli(["next"], cwd=tmp_path, runner=runner, kit=kit_root()) |
| 52 | out3 = capsys.readouterr().out |
| 53 | assert code3 == 0 |
| 54 | assert out3 == out2 |
| 55 | |
| 56 | # main tip fixture path unused; ensure we never checked out main via runner. |
| 57 | assert all("checkout" not in cmd for cmd, _ in runner.calls) |
File History
1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199
fix(ISR): default require_independent_second_reviewer to require
Human
minor
⚠
1 day ago