add agents

This commit is contained in:
김경종
2026-06-02 16:33:25 +09:00
parent dd50f8c093
commit 535a680197
36 changed files with 3837 additions and 3 deletions
@@ -0,0 +1,86 @@
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" / "build-test-executor-agent.toml"
BUILD_TEST_REPORTS_README = ROOT / "docs" / "build-test-reports" / "README.md"
class BuildTestExecutorAgentConfigTests(unittest.TestCase):
def test_build_test_executor_agent_toml_has_required_codex_fields(self):
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
self.assertEqual(data["name"], "build-test-executor-agent")
self.assertIn("C++/MSVC/CMake/CTest validation", data["description"])
self.assertEqual(data["sandbox_mode"], "workspace-write")
self.assertEqual(data["model_reasoning_effort"], "high")
self.assertIn("developer_instructions", data)
def test_build_test_executor_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 reference CSVs.",
"Do not approve release readiness.",
):
self.assertIn(required_text, instructions)
def test_build_test_executor_agent_instructions_define_validation_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"python scripts/validate_workspace.py",
"HARNESS_VALIDATION_COMMANDS",
"msvc-debug",
"CMake/MSVC x64 Debug",
"ctest --test-dir",
"--output-on-failure",
"-C Debug",
):
self.assertIn(required_text, instructions)
def test_build_test_executor_agent_instructions_define_output_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Execution Environment",
"Command Log Summary",
"Validation Results",
"Failure Classification",
"Failed Test Inventory",
"Handoff Recommendation",
"No-Change Assertion",
):
self.assertIn(required_text, instructions)
def test_build_test_report_guide_defines_template_and_status_values(self):
guide = BUILD_TEST_REPORTS_README.read_text(encoding="utf-8")
for required_text in (
"docs/build-test-reports/<feature-id>-build-test.md",
"Execution Environment",
"Command Log Summary",
"Validation Results",
"Failure Classification",
"Failed Test Inventory",
"Handoff Recommendation",
"No-Change Assertion",
"pass-for-reference-verification",
"needs-correction",
"needs-environment-fix",
):
self.assertIn(required_text, guide)
if __name__ == "__main__":
unittest.main()
+102
View File
@@ -0,0 +1,102 @@
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" / "coordinator-agent.toml"
COORDINATION_README = ROOT / "docs" / "coordination" / "README.md"
class CoordinatorAgentConfigTests(unittest.TestCase):
def test_coordinator_agent_toml_has_required_codex_fields(self):
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
self.assertEqual(data["name"], "coordinator-agent")
self.assertIn("workflow state", data["description"])
self.assertEqual(data["sandbox_mode"], "workspace-write")
self.assertEqual(data["model_reasoning_effort"], "high")
self.assertIn("developer_instructions", data)
def test_coordinator_agent_instructions_enforce_boundaries(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Do not implement code.",
"Do not edit source code.",
"Do not edit tests.",
"Do not edit CMake.",
"Do not run build/test validation.",
"Do not run Abaqus, Nastran, or any reference solver.",
"Do not generate reference CSVs.",
"Do not automatically spawn subagents.",
"Do not approve release readiness independently.",
):
self.assertIn(required_text, instructions)
def test_coordinator_agent_instructions_define_workflow_and_status_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"INTAKE -> STATE AUDIT -> GATE DECISION -> HANDOFF PACKAGE -> STATUS REPORT",
"Requirement Agent",
"Research Agent",
"Formulation Agent",
"Numerical Review Agent",
"I/O Definition Agent",
"Reference Model Agent",
"Implementation Planning Agent",
"Implementation Agent",
"Build/Test Executor Agent",
"Correction Agent",
"Reference Verification Agent",
"Physics Evaluation Agent",
"Release Agent",
"ready-for-implementation",
"pass-for-reference-verification",
"pass-for-physics-evaluation",
"pass-for-release-agent",
"ready-for-release",
"completed",
):
self.assertIn(required_text, instructions)
def test_coordinator_agent_instructions_define_output_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Gate Evidence Inventory",
"Decision Log",
"Next Agent Handoff",
"Traceability Snapshot",
"Risk and Blocker Register",
"Rework Loop Control",
"No-Change Assertion",
):
self.assertIn(required_text, instructions)
def test_coordination_guide_defines_template_and_status_values(self):
guide = COORDINATION_README.read_text(encoding="utf-8")
for required_text in (
"docs/coordination/<feature-id>-coordination.md",
"Gate Evidence Inventory",
"Decision Log",
"Next Agent Handoff",
"Traceability Snapshot",
"Risk and Blocker Register",
"Rework Loop Control",
"No-Change Assertion",
"needs-user-decision",
"blocked",
"python scripts/validate_workspace.py",
):
self.assertIn(required_text, guide)
if __name__ == "__main__":
unittest.main()
+90
View File
@@ -0,0 +1,90 @@
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" / "correction-agent.toml"
CORRECTIONS_README = ROOT / "docs" / "corrections" / "README.md"
class CorrectionAgentConfigTests(unittest.TestCase):
def test_correction_agent_toml_has_required_codex_fields(self):
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
self.assertEqual(data["name"], "correction-agent")
self.assertIn("C++/MSVC/CMake/CTest fixes", data["description"])
self.assertEqual(data["sandbox_mode"], "workspace-write")
self.assertEqual(data["model_reasoning_effort"], "high")
self.assertIn("developer_instructions", data)
def test_correction_agent_instructions_enforce_boundaries(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Do not change requirements",
"Do not change formulations",
"Do not change I/O contracts",
"Do not change reference artifacts",
"Do not change tolerance policies",
"Do not run Abaqus, Nastran, or any reference solver.",
"Do not generate reference CSVs.",
"Do not approve release readiness.",
):
self.assertIn(required_text, instructions)
def test_correction_agent_instructions_define_triage_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"TRIAGE -> MINIMAL FIX -> VERIFY -> REPORT",
"configure",
"compile",
"link",
"test",
"reference-comparison",
"harness",
"environment",
"upstream-contract",
):
self.assertIn(required_text, instructions)
def test_correction_agent_instructions_define_output_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Failure Triage",
"Root Cause Summary",
"Correction Scope",
"Verification Evidence",
"Traceability",
"Handoff Recommendation",
"Stop Condition",
):
self.assertIn(required_text, instructions)
def test_correction_report_guide_defines_template_and_status_values(self):
guide = CORRECTIONS_README.read_text(encoding="utf-8")
for required_text in (
"docs/corrections/<feature-id>-correction.md",
"Failure Triage",
"Root Cause Summary",
"Correction Scope",
"Verification Evidence",
"Traceability",
"Handoff Recommendation",
"Stop Condition",
"corrected-for-build-test",
"needs-upstream-decision",
"python scripts/validate_workspace.py",
):
self.assertIn(required_text, guide)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,81 @@
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()
@@ -0,0 +1,87 @@
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-planning-agent.toml"
IMPLEMENTATION_PLANS_README = ROOT / "docs" / "implementation-plans" / "README.md"
class ImplementationPlanningAgentConfigTests(unittest.TestCase):
def test_implementation_planning_agent_toml_has_required_codex_fields(self):
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
self.assertEqual(data["name"], "implementation-planning-agent")
self.assertIn("TDD-first C++/MSVC implementation plans", data["description"])
self.assertEqual(data["sandbox_mode"], "read-only")
self.assertEqual(data["model_reasoning_effort"], "high")
self.assertIn("developer_instructions", data)
def test_implementation_planning_agent_instructions_enforce_boundaries(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Do not implement code.",
"Do not write tests.",
"Do not edit CMake.",
"Do not run CMake/CTest.",
"Do not run Abaqus, Nastran, or any reference solver.",
"Do not generate reference CSVs.",
"Do not compare solver results.",
"Do not approve release readiness.",
):
self.assertIn(required_text, instructions)
def test_implementation_planning_agent_instructions_define_tdd_msvc_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"C++17",
"MSVC",
"CMake",
"CTest",
"TDD",
"failing unit tests first",
"reference comparison tests",
):
self.assertIn(required_text, instructions)
def test_implementation_planning_agent_instructions_define_output_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Readiness Check",
"Work Breakdown",
"TDD Test Plan",
"CMake/CTest Plan",
"Acceptance Traceability Matrix",
"Validation Commands",
"Downstream Handoff",
):
self.assertIn(required_text, instructions)
def test_implementation_planning_document_guide_defines_output_contract(self):
guide = IMPLEMENTATION_PLANS_README.read_text(encoding="utf-8")
for required_text in (
"docs/implementation-plans/<feature-id>-implementation-plan.md",
"Readiness Check",
"Work Breakdown",
"TDD Test Plan",
"CMake/CTest Plan",
"Acceptance Traceability Matrix",
"Validation Commands",
"Downstream Handoff",
"python scripts/validate_workspace.py",
"ctest -C Debug",
):
self.assertIn(required_text, guide)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,98 @@
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" / "io-definition-agent.toml"
IO_DEFINITIONS_README = ROOT / "docs" / "io-definitions" / "README.md"
class IoDefinitionAgentConfigTests(unittest.TestCase):
def test_io_definition_agent_toml_has_required_codex_fields(self):
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
self.assertEqual(data["name"], "io-definition-agent")
self.assertIn("Abaqus input-file subsets", data["description"])
self.assertEqual(data["sandbox_mode"], "read-only")
self.assertEqual(data["model_reasoning_effort"], "high")
self.assertIn("developer_instructions", data)
def test_io_definition_agent_instructions_enforce_boundaries(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Do not implement parsers.",
"Do not design C++ APIs",
"Do not run Abaqus, Nastran, or any reference solver.",
"Do not generate reference CSVs.",
"Do not approve release readiness.",
"Do not claim full Abaqus compatibility",
):
self.assertIn(required_text, instructions)
def test_io_definition_agent_instructions_define_abaqus_input_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"FESA solver input files are Abaqus input files.",
"Abaqus input files use keyword lines, data lines, and comment lines.",
"Model data and history data",
"supported Abaqus keyword subset",
"comparison CSV schemas",
):
self.assertIn(required_text, instructions)
def test_io_definition_agent_instructions_define_output_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Abaqus Input Scope",
"Syntax Policy",
"Model Data Mapping",
"History Data Mapping",
"Internal Model Contract",
"Output and CSV Schemas",
"Validation Rules",
"Downstream Handoff",
):
self.assertIn(required_text, instructions)
def test_io_definition_agent_instructions_define_keyword_policy(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"*NODE",
"*ELEMENT",
"*MATERIAL",
"*BOUNDARY",
"*STEP",
"*OUTPUT",
"*NODE OUTPUT",
"*ELEMENT OUTPUT",
):
self.assertIn(required_text, instructions)
def test_io_definition_document_guide_defines_output_contract(self):
guide = IO_DEFINITIONS_README.read_text(encoding="utf-8")
for required_text in (
"Abaqus Input Scope",
"Syntax Policy",
"Model Data Mapping",
"History Data Mapping",
"Internal Model Contract",
"Output and CSV Schemas",
"Validation Rules",
"Downstream Handoff",
"FESA 솔버의 입력 파일은 Abaqus input file이다.",
):
self.assertIn(required_text, guide)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,86 @@
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"], "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 CSVs.",
"Do not approve release readiness.",
"docs/SOLVER_AGENT_DESIGN.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()
@@ -0,0 +1,87 @@
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"], "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 reference CSVs.",
"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 (
"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()
@@ -0,0 +1,87 @@
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" / "reference-model-agent.toml"
REFERENCE_MODELS_README = ROOT / "docs" / "reference-models" / "README.md"
class ReferenceModelAgentConfigTests(unittest.TestCase):
def test_reference_model_agent_toml_has_required_codex_fields(self):
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
self.assertEqual(data["name"], "reference-model-agent")
self.assertIn("reference model packages", data["description"])
self.assertEqual(data["sandbox_mode"], "read-only")
self.assertEqual(data["model_reasoning_effort"], "high")
self.assertIn("developer_instructions", data)
def test_reference_model_agent_instructions_enforce_boundaries(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Do not implement code.",
"Do not implement parsers.",
"Do not design C++ APIs",
"Do not run Abaqus, Nastran, or any reference solver.",
"Do not generate reference CSVs.",
"Do not compare solver results.",
"Do not approve release readiness.",
):
self.assertIn(required_text, instructions)
def test_reference_model_agent_instructions_define_reference_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"FESA reference models use Abaqus input files.",
"references/<feature-id>/<model-id>/",
"model.inp",
"metadata.json",
"displacements.csv",
"reactions.csv",
"element_forces.csv",
"stresses.csv",
):
self.assertIn(required_text, instructions)
def test_reference_model_agent_instructions_define_output_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Reference Strategy",
"Model Inventory",
"Abaqus Input Requirements",
"Artifact Bundle Contract",
"Metadata JSON Contract",
"Reference CSV Requirements",
"Coverage Matrix",
"Downstream Handoff",
):
self.assertIn(required_text, instructions)
def test_reference_model_document_guide_defines_output_contract(self):
guide = REFERENCE_MODELS_README.read_text(encoding="utf-8")
for required_text in (
"Reference Strategy",
"Model Inventory",
"Abaqus Input Requirements",
"Artifact Bundle Contract",
"Metadata JSON Contract",
"Reference CSV Requirements",
"Coverage Matrix",
"Downstream Handoff",
"references/<feature-id>/<model-id>/",
):
self.assertIn(required_text, guide)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,85 @@
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" / "reference-verification-agent.toml"
REFERENCE_VERIFICATIONS_README = ROOT / "docs" / "reference-verifications" / "README.md"
class ReferenceVerificationAgentConfigTests(unittest.TestCase):
def test_reference_verification_agent_toml_has_required_codex_fields(self):
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
self.assertEqual(data["name"], "reference-verification-agent")
self.assertIn("stored Abaqus reference CSV artifacts", data["description"])
self.assertEqual(data["sandbox_mode"], "workspace-write")
self.assertEqual(data["model_reasoning_effort"], "high")
self.assertIn("developer_instructions", data)
def test_reference_verification_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 reference CSVs.",
"Do not approve release readiness.",
"Do not change tolerance policies.",
):
self.assertIn(required_text, instructions)
def test_reference_verification_agent_instructions_define_artifact_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"displacements.csv",
"reactions.csv",
"element_forces.csv",
"stresses.csv",
"metadata.json",
"references/<feature-id>/<model-id>/",
):
self.assertIn(required_text, instructions)
def test_reference_verification_agent_instructions_define_output_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Artifact Inventory",
"Comparison Contract",
"Quantity Results",
"Failure Classification",
"Handoff Recommendation",
"No-Change Assertion",
):
self.assertIn(required_text, instructions)
def test_reference_verification_report_guide_defines_template_and_status_values(self):
guide = REFERENCE_VERIFICATIONS_README.read_text(encoding="utf-8")
for required_text in (
"docs/reference-verifications/<feature-id>-reference-verification.md",
"Artifact Inventory",
"Comparison Contract",
"Quantity Results",
"Failure Classification",
"Handoff Recommendation",
"No-Change Assertion",
"pass-for-physics-evaluation",
"needs-correction",
"needs-reference-artifacts",
"needs-upstream-decision",
):
self.assertIn(required_text, guide)
if __name__ == "__main__":
unittest.main()
+92
View File
@@ -0,0 +1,92 @@
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" / "release-agent.toml"
RELEASES_README = ROOT / "docs" / "releases" / "README.md"
class ReleaseAgentConfigTests(unittest.TestCase):
def test_release_agent_toml_has_required_codex_fields(self):
data = tomllib.loads(AGENT_PATH.read_text(encoding="utf-8"))
self.assertEqual(data["name"], "release-agent")
self.assertIn("release readiness", data["description"])
self.assertEqual(data["sandbox_mode"], "workspace-write")
self.assertEqual(data["model_reasoning_effort"], "high")
self.assertIn("developer_instructions", data)
def test_release_agent_instructions_enforce_boundaries(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Do not implement code.",
"Do not edit source code.",
"Do not edit tests.",
"Do not edit CMake.",
"Do not change requirements",
"Do not change formulations",
"Do not change I/O contracts",
"Do not change reference artifacts",
"Do not change tolerance policies",
"Do not run Abaqus, Nastran, or any reference solver.",
"Do not generate reference CSVs.",
"Do not override failed or missing upstream gates.",
):
self.assertIn(required_text, instructions)
def test_release_agent_instructions_define_gate_and_status_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"GATE AUDIT -> TRACEABILITY CHECK -> RELEASE DOCUMENTATION -> RELEASE VERDICT",
"pass-for-release-agent",
"pass-for-physics-evaluation",
"pass-for-reference-verification",
"ready-for-release",
"known limitations",
):
self.assertIn(required_text, instructions)
def test_release_agent_instructions_define_output_contract(self):
instructions = AGENT_PATH.read_text(encoding="utf-8")
for required_text in (
"Gate Evidence Inventory",
"Acceptance Traceability",
"Validation Evidence",
"Known Limitations",
"Release Notes Draft",
"Release Verdict",
"No-Change Assertion",
):
self.assertIn(required_text, instructions)
def test_release_report_guide_defines_template_and_status_values(self):
guide = RELEASES_README.read_text(encoding="utf-8")
for required_text in (
"docs/releases/<feature-id>-release.md",
"Gate Evidence Inventory",
"Acceptance Traceability",
"Validation Evidence",
"Known Limitations",
"Release Notes Draft",
"Release Verdict",
"No-Change Assertion",
"ready-for-release",
"needs-documentation",
"needs-upstream-decision",
"python scripts/validate_workspace.py",
):
self.assertIn(required_text, guide)
if __name__ == "__main__":
unittest.main()