# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference)
# Canonical Residual: https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-litmus-benchmark-pass-rates-as-non-transferable-evidence-of-agentic-safety.md
# Remnant Warrant:    https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-litmus-benchmark-pass-rates-as-non-transferable-evidence-of-agentic-safety.warrant.json
# Markdown SHA-256:   689f75ae4becaea898a5a03a6418120d793eeee10a7effe0c0cb1f6b843247cf
# Code AST SHA-256:   2ad6bf484fe89072e168e3b8f991eb43d7300f1ea92024d95241af3b5045f28b
# Verified Classes:   NonTransferableSafetyWarrant
# Defensive Guards:   3 fail-closed invariants (zero external deps)

class NonTransferableSafetyWarrant(RuntimeError):
    """Raised when a LITMUS-style pass-rate is consumed as a safety warrant
    for an agent whose action space exceeds the benchmark's scoring surface."""
    pass


def admit_safety_evidence(
    litmus_pass_rate: float,
    has_tools: bool,
    has_persistent_memory: bool,
    participates_in_handoff: bool,
    probe_channels: set[str],
    required_channels: set[str],
    scored_on_side_effects: bool,
    trace_level_scoring: bool,
) -> str:
    # A text-only agent: the benchmark's unit of analysis matches the harm surface.
    if not (has_tools or has_persistent_memory or participates_in_handoff):
        return "PRIMARY_WARRANT"

    # Agent action space exceeds output space: demote to component signal unless
    # every channel, side-effect scoring, and trace-level adjudication are present.
    missing = required_channels - probe_channels
    if missing:
        raise NonTransferableSafetyWarrant(
            f"pass_rate={litmus_pass_rate:.4f} is non-transferable: "
            f"unprobed channels {sorted(missing)} carry the deployment hazard; "
            f"benchmark measured a finer-grained, text-only distribution"
        )
    if not scored_on_side_effects:
        raise NonTransferableSafetyWarrant(
            "pass_rate scored on emitted tokens, not tool side effects; "
            "a refusal followed by paraphrase-and-execute scores as a false pass"
        )
    if not trace_level_scoring:
        raise NonTransferableSafetyWarrant(
            "turn-level scoring cannot observe injection reconstruction from "
            "compacted memory or peer-message laundering across a handoff"
        )
    return "COMPONENT_SIGNAL_COMBINED"
