from railiance_fabric.canon import ( CANONICAL_EDGE_TYPES, CANONICAL_NODE_CATEGORIES, DISPLAY_ONLY_EDGE_TYPES, edge_canon_mapping, evidence_state_for, node_canon_mapping, ) def test_wp0016_target_taxonomy_is_registered() -> None: assert set(CANONICAL_NODE_CATEGORIES) >= { "source-repository", "software-system", "service", "endpoint", "deployment", "runtime-resource", "datastore", "flow", "policy", "control", "evidence", "task", "consumer-purpose", "telemetry-signal", } assert set(CANONICAL_EDGE_TYPES) >= { "built_from", "implements", "exposes", "depends_on", "deploys", "flows_to", "governed_by", "evidenced_by", "observed_by", "part_of", "reads_or_writes", "creates_task", } assert set(DISPLAY_ONLY_EDGE_TYPES) >= { "collapsed_into", "grouped_with", "highlight_path", "near", "same_color_group", } def test_legacy_fabric_terms_map_without_becoming_display_edges() -> None: assert node_canon_mapping("Repository").category == "source-repository" assert node_canon_mapping("KubernetesDeployment").category == "runtime-resource" assert node_canon_mapping("DependencyDeclaration").fit == "gap" assert edge_canon_mapping("exposes").canonical_type == "exposes" assert edge_canon_mapping("provides").canonical_type == "implements" assert edge_canon_mapping("binds:exact").canonical_type == "depends_on" assert edge_canon_mapping("resolves_to").canonical_type == "flows_to" assert edge_canon_mapping("declares").display_only is True def test_evidence_state_separates_origin_from_review_state() -> None: assert evidence_state_for(origin="repo_declaration", source_kind="declaration") == "declared" assert evidence_state_for(origin="llm", source_kind="llm") == "proposed" assert evidence_state_for(origin="deterministic", source_kind="", confidence=0.4) == "inferred" assert evidence_state_for(origin="deterministic", source_kind="package_registry") == "observed" assert evidence_state_for(review_state="rejected") == "gap"