80 lines
2.7 KiB
Python
80 lines
2.7 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" / "research-agent.toml"
|
|
RESEARCH_README = ROOT / "docs" / "research" / "README.md"
|
|
|
|
|
|
class ResearchAgentConfigTests(unittest.TestCase):
|
|
def test_research_agent_toml_has_required_codex_fields(self):
|
|
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
|
|
|
|
self.assertEqual(data["name"], "research-agent")
|
|
self.assertIn("FEM theory", data["description"])
|
|
self.assertEqual(data["sandbox_mode"], "read-only")
|
|
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
|
self.assertIn("developer_instructions", data)
|
|
|
|
def test_research_agent_instructions_enforce_boundaries(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Do not implement code.",
|
|
"Do not finalize FEM formulations.",
|
|
"Do not run Abaqus, Nastran, or any reference solver.",
|
|
"Do not generate reference HDF5 artifacts or reference CSVs.",
|
|
"docs/AGENT_RULES.md",
|
|
"docs/requirements/<feature-id>.md",
|
|
"Separate verified facts from inference.",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_research_agent_instructions_define_output_contract(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Source Inventory",
|
|
"Candidate Benchmarks",
|
|
"Verification Relevance",
|
|
"Applicability Limits",
|
|
"Downstream Handoff",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_research_agent_instructions_define_source_policy(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"ASME V&V 10",
|
|
"Abaqus Verification Guide",
|
|
"Abaqus Benchmarks Guide",
|
|
"NAFEMS benchmarks",
|
|
"NASA FEMCI",
|
|
"MMS and MES papers",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_research_document_guide_defines_output_contract(self):
|
|
guide = RESEARCH_README.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Source Reliability Tier",
|
|
"Source Inventory",
|
|
"Candidate Benchmarks",
|
|
"Verification Relevance",
|
|
"Applicability Limits",
|
|
"Downstream Handoff",
|
|
):
|
|
self.assertIn(required_text, guide)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|