56 lines
1.9 KiB
Python
56 lines
1.9 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" / "requirement-agent.toml"
|
|
REQUIREMENTS_README = ROOT / "docs" / "requirements" / "README.md"
|
|
|
|
|
|
class RequirementAgentConfigTests(unittest.TestCase):
|
|
def test_requirement_agent_toml_has_required_codex_fields(self):
|
|
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
|
|
|
|
self.assertEqual(data["name"], "requirement-agent")
|
|
self.assertIn("verifiable requirements", data["description"])
|
|
self.assertEqual(data["sandbox_mode"], "read-only")
|
|
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
|
self.assertIn("developer_instructions", data)
|
|
|
|
def test_requirement_agent_instructions_enforce_boundaries(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Do not implement code.",
|
|
"Do not write finite element formulations.",
|
|
"Do not run Abaqus, Nastran, or any reference solver.",
|
|
"Do not create reference HDF5 outputs or deterministic CSV views.",
|
|
"Requirement Verification Matrix",
|
|
"docs/SOLVER_AGENT_DESIGN.md",
|
|
"references/<feature>",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_requirement_document_guide_defines_output_contract(self):
|
|
guide = REQUIREMENTS_README.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"feature_id",
|
|
"Verification Quantities",
|
|
"Tolerance Policy",
|
|
"Reference Artifact Requirements",
|
|
"Requirement Verification Matrix",
|
|
"Downstream Handoff",
|
|
"FESA-REQ-<FEATURE>-001",
|
|
):
|
|
self.assertIn(required_text, guide)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|