from pathlib import Path import yaml EXPECTED_STATE_HUB_TABLES = { "agent_messages", "capability_catalog", "capability_requests", "contributions", "decisions", "doi_cache", "domain_goals", "domains", "extension_points", "fabric_graph_edges", "fabric_graph_imports", "fabric_graph_nodes", "intake_notes", "intakes", "interface_changes", "legacy_interface_usage_buckets", "legacy_interfaces", "managed_repos", "progress_events", "repo_goals", "sbom_entries", "sbom_snapshots", "service_catalog", "service_cloud", "service_first_party", "service_self_hosted", "service_third_party", "suggestion_notes", "suggestion_relevance_bumps", "suggestions", "tasks", "td_notes", "technical_debt", "token_events", "topics", "tpsc_catalog", "tpsc_entries", "tpsc_snapshots", "workplan_dependencies", "workplan_launch_requests", "workplans", "write_idempotency_keys", } def test_every_state_hub_table_has_one_authority_class() -> None: path = Path(__file__).parents[1] / "config" / "hub-record-authority.yaml" document = yaml.safe_load(path.read_text(encoding="utf-8")) classes = set(document["classes"]) records = document["records"] assert set(records) == EXPECTED_STATE_HUB_TABLES assert {record["class"] for record in records.values()} <= classes assert all(record.get("owner") for record in records.values())