INNER CODE UNIT · Python

resolve_policy_impact

apache/shardingsphere · .codex/harness/agents/run.py:737

def resolve_policy_impact(
        cases: list[dict[str, Any]], bundle: dict[str, Any], policy_bindings: list[dict[str, Any]],
        source_ids: list[str]) -> dict[str, list[str]]:
    """Resolve the semantic cases and routing profiles affected by policy sources."""
    requested_source_ids = set(source_ids)
    sources_by_id = {each["id"]: each for each in bundle["sources"]}
    unknown_source_ids = requested_source_ids.difference(sources_by_id)
    if unknown_source_ids:
        raise ValueError(f"Unknown impact source IDs: {', '.join(sorted(unknown_source_ids))}")
    non_semantic_source_ids = {
        each for each in requested_source_ids if not sources_by_id[each]["semantic"]
    }
    if non_semantic_source_ids:
        raise ValueError(
            "Impact sources must be semantic policy sources: "
            f"{', '.join(sorted(non_semantic_source_ids))}"
        )
    ordered_source_ids = [each["id"] for each in bundle["sources"] if each["id"] in requested_source_ids]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…