88 lines
3.1 KiB
Python
88 lines
3.1 KiB
Python
import unittest
|
|
from pathlib import Path
|
|
|
|
try:
|
|
import tomllib
|
|
except ModuleNotFoundError: # pragma: no cover
|
|
import tomli as tomllib
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
AGENT_PATH = ROOT / ".codex" / "agents" / "implementation-planning-agent.toml"
|
|
IMPLEMENTATION_PLANS_README = ROOT / "docs" / "implementation-plans" / "README.md"
|
|
|
|
|
|
class ImplementationPlanningAgentConfigTests(unittest.TestCase):
|
|
def test_implementation_planning_agent_toml_has_required_codex_fields(self):
|
|
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
|
|
|
|
self.assertEqual(data["name"], "implementation-planning-agent")
|
|
self.assertIn("TDD-first C++/MSVC implementation plans", data["description"])
|
|
self.assertEqual(data["sandbox_mode"], "read-only")
|
|
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
|
self.assertIn("developer_instructions", data)
|
|
|
|
def test_implementation_planning_agent_instructions_enforce_boundaries(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Do not implement code.",
|
|
"Do not write tests.",
|
|
"Do not edit CMake.",
|
|
"Do not run CMake/CTest.",
|
|
"Do not run Abaqus, Nastran, or any reference solver.",
|
|
"Do not generate reference HDF5 files or deterministic CSV views.",
|
|
"Do not compare solver results.",
|
|
"Do not approve release readiness.",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_implementation_planning_agent_instructions_define_tdd_msvc_contract(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"C++17",
|
|
"MSVC",
|
|
"CMake",
|
|
"CTest",
|
|
"TDD",
|
|
"failing unit tests first",
|
|
"reference comparison tests",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_implementation_planning_agent_instructions_define_output_contract(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Readiness Check",
|
|
"Work Breakdown",
|
|
"TDD Test Plan",
|
|
"CMake/CTest Plan",
|
|
"Acceptance Traceability Matrix",
|
|
"Validation Commands",
|
|
"Downstream Handoff",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_implementation_planning_document_guide_defines_output_contract(self):
|
|
guide = IMPLEMENTATION_PLANS_README.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"docs/implementation-plans/<feature-id>-implementation-plan.md",
|
|
"Readiness Check",
|
|
"Work Breakdown",
|
|
"TDD Test Plan",
|
|
"CMake/CTest Plan",
|
|
"Acceptance Traceability Matrix",
|
|
"Validation Commands",
|
|
"Downstream Handoff",
|
|
"python scripts/validate_workspace.py",
|
|
"ctest -C Debug",
|
|
):
|
|
self.assertIn(required_text, guide)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|