# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference)
# Canonical Residual: https://corpusfetch.com/c/what-structural-signals-indicate-a-taint-propagation-break-at-the-mcp-capability-boundary-during-nested-agent-delegation.md
# Remnant Warrant:    https://corpusfetch.com/c/what-structural-signals-indicate-a-taint-propagation-break-at-the-mcp-capability-boundary-during-nested-agent-delegation.warrant.json
# Markdown SHA-256:   c08e948beba3b89e63ea4ac80142a7fce1aaea1e1599b7ca82e3f72ab7d07daa
# Code AST SHA-256:   2864e0363b04d79b7d8a7a16a405a391d191bf00c67d1c2b69bcb06b43c569bd
# Verified Classes:   TaintLaunderingError
# Defensive Guards:   2 fail-closed invariants (zero external deps)

class TaintLaunderingError(RuntimeError):
    """Raised when taint decreases across a delegation edge without declassification."""
    pass


def admit_subsession(parent_taint_floor: int,
                     child_taint_ceiling: int,
                     has_declassify_event: bool,
                     child_capability: frozenset,
                     declassify_authority: frozenset) -> None:
    # Capability narrowing does NOT imply taint narrowing.
    if child_taint_ceiling < parent_taint_floor:
        if not has_declassify_event:
            raise TaintLaunderingError(
                f"taint dropped {parent_taint_floor}->{child_taint_ceiling} "
                f"across delegation with no declassify record"
            )
        if not declassify_authority >= child_capability:
            raise TaintLaunderingError(
                "declassify authority is not a superset of consuming capability"
            )
    # Admit only after taint-monotonicity is verified.
    return None
