test_nxp_advisories.py
python
sha256:c07f2f34a0db9f43fe866f157d1935322008545ff8940c06c7c921eb219c55ab
NXP-b DONE: independent BV-r2 pass + ISR (SD-17)
Human
minor
⚠ breaking
23 hours ago
| 1 | """Integration — NXP check-next + status board-name advisories (§NXP.5 / §NXP.6).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from pathlib import Path |
| 6 | |
| 7 | from adapters.config import load_config |
| 8 | from cli.kit_root import kit_root |
| 9 | from tests.support import FIXTURES, git_status_runner, run_cli, write_config |
| 10 | from tools.workspace.board_names import ( |
| 11 | check_next_unconfigured_advisory, |
| 12 | expected_handover_basename, |
| 13 | status_board_name_advisory, |
| 14 | ) |
| 15 | |
| 16 | |
| 17 | def test_check_next_unconfigured_bare_advisory(tmp_path: Path, capsys) -> None: |
| 18 | write_config(tmp_path, "config-git-only.yaml") |
| 19 | (tmp_path / "docs").mkdir(exist_ok=True) |
| 20 | (tmp_path / "docs" / "OVERSEER-HANDOVER.md").write_text("# h\n", encoding="utf-8") |
| 21 | (tmp_path / "docs" / "ROADMAP.md").write_text("# r\n", encoding="utf-8") |
| 22 | code = run_cli(["workspace", "check-next"], cwd=tmp_path, kit=kit_root()) |
| 23 | out = capsys.readouterr().out |
| 24 | assert code == 0 |
| 25 | assert "workspace not configured" in out |
| 26 | assert "OVERSEER-HANDOVER.md" in out |
| 27 | assert "TEST-GIT-OVERSEER-HANDOVER.md" in out |
| 28 | |
| 29 | |
| 30 | def test_check_next_unconfigured_compliant_advisory(tmp_path: Path, capsys) -> None: |
| 31 | write_config(tmp_path, "config-git-only.yaml") |
| 32 | cfg_path = tmp_path / ".overseer" / "config.yaml" |
| 33 | text = cfg_path.read_text(encoding="utf-8") |
| 34 | text = text.replace( |
| 35 | "handover: OVERSEER-HANDOVER.md", |
| 36 | "handover: TEST-GIT-OVERSEER-HANDOVER.md", |
| 37 | ).replace("roadmap: ROADMAP.md", "roadmap: TEST-GIT-ROADMAP.md") |
| 38 | cfg_path.write_text(text, encoding="utf-8") |
| 39 | docs = tmp_path / "docs" |
| 40 | docs.mkdir(exist_ok=True) |
| 41 | (docs / "TEST-GIT-OVERSEER-HANDOVER.md").write_text("# h\n", encoding="utf-8") |
| 42 | (docs / "TEST-GIT-ROADMAP.md").write_text("# r\n", encoding="utf-8") |
| 43 | code = run_cli(["workspace", "check-next"], cwd=tmp_path, kit=kit_root()) |
| 44 | out = capsys.readouterr().out |
| 45 | assert code == 0 |
| 46 | assert "board names already compliant" in out |
| 47 | |
| 48 | |
| 49 | def test_status_advisory_when_bare(tmp_path: Path, capsys) -> None: |
| 50 | write_config(tmp_path, "config-git-only.yaml") |
| 51 | docs = tmp_path / "docs" |
| 52 | docs.mkdir(exist_ok=True) |
| 53 | (docs / "OVERSEER-HANDOVER.md").write_text( |
| 54 | (FIXTURES / "print-next-handover.md").read_text(encoding="utf-8"), |
| 55 | encoding="utf-8", |
| 56 | ) |
| 57 | (docs / "ROADMAP.md").write_text("# Roadmap\n", encoding="utf-8") |
| 58 | # Minimal lock so status proceeds past lock_error into advisory path. |
| 59 | (tmp_path / ".overseer" / "version.lock").write_text( |
| 60 | "lock_version: 1\nkit_version: 0.1.0\nconfig_version: 1\n" |
| 61 | "footprint_digest: " |
| 62 | + ("0" * 64) |
| 63 | + "\ninstalled_at: 2026-01-01T00:00:00Z\nsynced_at: 2026-01-01T00:00:00Z\n" |
| 64 | "footprint: []\n", |
| 65 | encoding="utf-8", |
| 66 | ) |
| 67 | code = run_cli( |
| 68 | ["status"], |
| 69 | cwd=tmp_path, |
| 70 | runner=git_status_runner(), |
| 71 | kit=kit_root(), |
| 72 | ) |
| 73 | out = capsys.readouterr().out |
| 74 | assert code == 0 |
| 75 | assert "board naming:" in out |
| 76 | assert "OVERSEER-HANDOVER.md" in out or "prefer" in out |
| 77 | |
| 78 | |
| 79 | def test_status_advisory_absent_when_prefixed(tmp_path: Path, capsys) -> None: |
| 80 | write_config(tmp_path, "config-git-only.yaml") |
| 81 | cfg_path = tmp_path / ".overseer" / "config.yaml" |
| 82 | text = cfg_path.read_text(encoding="utf-8") |
| 83 | text = text.replace( |
| 84 | "handover: OVERSEER-HANDOVER.md", |
| 85 | "handover: TEST-GIT-OVERSEER-HANDOVER.md", |
| 86 | ).replace("roadmap: ROADMAP.md", "roadmap: TEST-GIT-ROADMAP.md") |
| 87 | cfg_path.write_text(text, encoding="utf-8") |
| 88 | docs = tmp_path / "docs" |
| 89 | docs.mkdir(exist_ok=True) |
| 90 | (docs / "TEST-GIT-OVERSEER-HANDOVER.md").write_text( |
| 91 | (FIXTURES / "print-next-handover.md").read_text(encoding="utf-8"), |
| 92 | encoding="utf-8", |
| 93 | ) |
| 94 | (docs / "TEST-GIT-ROADMAP.md").write_text("# Roadmap\n", encoding="utf-8") |
| 95 | (tmp_path / ".overseer" / "version.lock").write_text( |
| 96 | "lock_version: 1\nkit_version: 0.1.0\nconfig_version: 1\n" |
| 97 | "footprint_digest: " |
| 98 | + ("0" * 64) |
| 99 | + "\ninstalled_at: 2026-01-01T00:00:00Z\nsynced_at: 2026-01-01T00:00:00Z\n" |
| 100 | "footprint: []\n", |
| 101 | encoding="utf-8", |
| 102 | ) |
| 103 | code = run_cli( |
| 104 | ["status"], |
| 105 | cwd=tmp_path, |
| 106 | runner=git_status_runner(), |
| 107 | kit=kit_root(), |
| 108 | ) |
| 109 | out = capsys.readouterr().out |
| 110 | assert code == 0 |
| 111 | assert "board naming:" not in out |
| 112 | |
| 113 | |
| 114 | def test_advisory_helpers_unit(tmp_path: Path) -> None: |
| 115 | write_config(tmp_path, "config-git-only.yaml") |
| 116 | config = load_config(tmp_path / ".overseer" / "config.yaml") |
| 117 | msg = check_next_unconfigured_advisory(config) |
| 118 | assert "OVERSEER-HANDOVER.md" in msg |
| 119 | assert expected_handover_basename("test-git") in msg |
| 120 | status_msg = status_board_name_advisory(config) |
| 121 | assert status_msg is not None |
| 122 | assert "board naming:" in status_msg |
File History
1 commit
sha256:c07f2f34a0db9f43fe866f157d1935322008545ff8940c06c7c921eb219c55ab
NXP-b DONE: independent BV-r2 pass + ISR (SD-17)
Human
minor
⚠
23 hours ago