87 lines
3.0 KiB
Python
87 lines
3.0 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" / "numerical-review-agent.toml"
|
|
NUMERICAL_REVIEWS_README = ROOT / "docs" / "numerical-reviews" / "README.md"
|
|
|
|
|
|
class NumericalReviewAgentConfigTests(unittest.TestCase):
|
|
def test_numerical_review_agent_toml_has_required_codex_fields(self):
|
|
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
|
|
|
|
self.assertEqual(data["name"], "numerical-review-agent")
|
|
self.assertIn("numerical correctness", data["description"])
|
|
self.assertEqual(data["sandbox_mode"], "read-only")
|
|
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
|
self.assertIn("developer_instructions", data)
|
|
|
|
def test_numerical_review_agent_instructions_enforce_boundaries(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Do not implement code.",
|
|
"Do not edit formulations directly.",
|
|
"Do not design C++ APIs",
|
|
"Do not run Abaqus, Nastran, or any reference solver.",
|
|
"Do not generate reference HDF5 artifacts or reference CSVs.",
|
|
"Do not approve release readiness.",
|
|
"docs/AGENT_RULES.md",
|
|
"docs/formulations/<feature-id>-formulation.md",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_numerical_review_agent_instructions_define_output_contract(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Review Verdict",
|
|
"Critical Findings",
|
|
"Numerical Risk Assessment",
|
|
"Consistency Checks",
|
|
"Verification Readiness",
|
|
"Required Revisions",
|
|
"Downstream Handoff",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_numerical_review_agent_instructions_define_risk_policy(self):
|
|
instructions = AGENT_PATH.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"rigid body modes",
|
|
"patch test",
|
|
"symmetry",
|
|
"positive definiteness",
|
|
"hourglass",
|
|
"locking",
|
|
"singular Jacobian",
|
|
"conditioning",
|
|
):
|
|
self.assertIn(required_text, instructions)
|
|
|
|
def test_numerical_review_document_guide_defines_output_contract(self):
|
|
guide = NUMERICAL_REVIEWS_README.read_text(encoding="utf-8")
|
|
|
|
for required_text in (
|
|
"Review Verdict",
|
|
"Critical Findings",
|
|
"Numerical Risk Assessment",
|
|
"Consistency Checks",
|
|
"Verification Readiness",
|
|
"Required Revisions",
|
|
"Downstream Handoff",
|
|
"pass-for-implementation-planning",
|
|
):
|
|
self.assertIn(required_text, guide)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|