90 lines
3.1 KiB
Python
90 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" / "physics-evaluation-agent.toml"
|
|
PHYSICS_EVALUATIONS_README = ROOT / "docs" / "physics-evaluations" / "README.md"
|
|
|
|
|
|
class PhysicsEvaluationAgentConfigTests(unittest.TestCase):
|
|
def test_physics_evaluation_agent_toml_has_required_codex_fields(self):
|
|
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
|
|
|
|
self.assertEqual(data["name"], "physics-evaluation-agent")
|
|
self.assertIn("physical plausibility", data["description"])
|
|
self.assertEqual(data["sandbox_mode"], "workspace-write")
|
|
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
|
self.assertIn("developer_instructions", data)
|
|
|
|
def test_physics_evaluation_agent_instructions_enforce_boundaries(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Do not edit source code.",
|
|
"Do not edit tests.",
|
|
"Do not edit CMake.",
|
|
"Do not run Abaqus, Nastran, or any reference solver.",
|
|
"Do not generate or modify Abaqus reference CSV files.",
|
|
"Do not change tolerances.",
|
|
"Do not approve release readiness.",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_physics_evaluation_agent_instructions_define_physics_checks(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"global equilibrium",
|
|
"reaction consistency",
|
|
"displacement direction",
|
|
"symmetry",
|
|
"element force balance",
|
|
"stress/strain",
|
|
"rigid body mode",
|
|
"energy/residual",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_physics_evaluation_agent_instructions_define_output_contract(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"HDF5",
|
|
"Abaqus reference CSV files",
|
|
"Input Evidence",
|
|
"Physics Checks",
|
|
"Failure Classification",
|
|
"Evaluation Verdict",
|
|
"Handoff Recommendation",
|
|
"No-Change Assertion",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_physics_evaluation_report_guide_defines_template_and_status_values(self):
|
|
guide = PHYSICS_EVALUATIONS_README.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"docs/physics-evaluations/<feature-id>-physics-evaluation.md",
|
|
"Input Evidence",
|
|
"Physics Checks",
|
|
"Failure Classification",
|
|
"Evaluation Verdict",
|
|
"Handoff Recommendation",
|
|
"No-Change Assertion",
|
|
"pass-for-release-agent",
|
|
"needs-correction",
|
|
"needs-reference-model",
|
|
"needs-upstream-decision",
|
|
):
|
|
self.assertIn(required_text, guide)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|