from __future__ import annotations from pathlib import Path from src.configurations.registry import CONFIGURATIONS, load_configuration_template from src.placement.registry import PLACEMENT_SOLVERS from src.relation_validators import VALIDATOR_REGISTRY ROOT = Path(__file__).resolve().parents[1] def test_configuration_development_standard_docs_exist() -> None: assert (ROOT / "docs" / "configuration-development-standard.md").exists() assert (ROOT / "docs" / "topology-json-authoring-guide.md").exists() assert (ROOT / "skill" / "references" / "configuration-development-standard.md").exists() assert (ROOT / "skill" / "references" / "topology-json-authoring-guide.md").exists() skill_text = (ROOT / "skill" / "SKILL.md").read_text(encoding="utf-8") assert "references/configuration-development-standard.md" in skill_text assert "references/topology-json-authoring-guide.md" in skill_text def test_registered_configurations_have_standard_files() -> None: for family, spec in CONFIGURATIONS.items(): assert spec.package_dir.exists() assert (spec.package_dir / "family.py").exists() assert (spec.package_dir / "topology.template.json").exists() assert (spec.package_dir / "placement_rules.py").exists() assert load_configuration_template(family).family == family def test_registered_configurations_have_requirements_and_placement_solvers() -> None: for family in CONFIGURATIONS: requirement_dir = ROOT / "input" / "requirements" / "reducers" / family assert requirement_dir.exists() assert list(requirement_dir.glob("*.json")) assert family in PLACEMENT_SOLVERS def test_all_topology_relation_types_have_validators() -> None: for family in CONFIGURATIONS: template = load_configuration_template(family) for relation in template.relations: assert relation.relation_type in VALIDATOR_REGISTRY def test_configuration_standard_uses_flat_src_layout() -> None: docs = [ ROOT / "docs" / "configuration-development-standard.md", ROOT / "docs" / "topology-json-authoring-guide.md", ROOT / "skill" / "references" / "configuration-development-standard.md", ROOT / "skill" / "references" / "topology-json-authoring-guide.md", ] for path in docs: text = path.read_text(encoding="utf-8") assert "src/configurations/" in text if "configuration-development-standard" in path.name: assert "src/placement/" in text assert "src/planetary_reducer" not in text def test_topology_json_authoring_guide_covers_schema_fields() -> None: text = (ROOT / "docs" / "topology-json-authoring-guide.md").read_text(encoding="utf-8") for field in [ "template_id", "family", "description", "nodes", "relations", "id", "kind", "role", "gear_type", "repeat", "formula_ref", "stage_id", "local_role", "source", "target", "relation_type", "carrier_ref", "mesh_id", ]: assert field in text for relation_type in VALIDATOR_REGISTRY: assert relation_type in text