82 lines
2.8 KiB
Python
82 lines
2.8 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-agent.toml"
|
|
|
|
|
|
class ImplementationAgentConfigTests(unittest.TestCase):
|
|
def test_implementation_agent_toml_has_required_codex_fields(self):
|
|
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
|
|
|
|
self.assertEqual(data["name"], "implementation-agent")
|
|
self.assertIn("C++17/MSVC", data["description"])
|
|
self.assertEqual(data["sandbox_mode"], "workspace-write")
|
|
self.assertEqual(data["model_reasoning_effort"], "high")
|
|
self.assertIn("developer_instructions", data)
|
|
|
|
def test_implementation_agent_instructions_define_tdd_execution_contract(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Write tests first",
|
|
"verify failure",
|
|
"minimum code",
|
|
"C++17",
|
|
"MSVC",
|
|
"CMake",
|
|
"CTest",
|
|
"RED -> GREEN -> VERIFY",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_implementation_agent_instructions_enforce_boundaries(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Do not run Abaqus, Nastran, or any reference solver.",
|
|
"Do not generate reference CSVs.",
|
|
"Do not approve release readiness.",
|
|
"Do not change requirements",
|
|
"Do not change formulations",
|
|
"Do not change I/O contracts",
|
|
"Do not change reference artifacts",
|
|
"Do not produce the final reference verification report.",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_implementation_agent_instructions_define_output_contract(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Test Evidence",
|
|
"Code Changes",
|
|
"Validation Evidence",
|
|
"Traceability",
|
|
"Downstream Handoff",
|
|
"Build/Test Executor Agent",
|
|
"Correction Agent",
|
|
"Reference Verification Agent",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_implementation_agent_instructions_define_validation_commands(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"python -m unittest discover -s scripts -p \"test_*.py\"",
|
|
"python scripts/validate_workspace.py",
|
|
"ctest -C Debug",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|