# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference)
# Canonical Residual: https://corpusfetch.com/c/what-structural-signals-indicate-a-revoked-federated-agent-identity-is-still-being-honored-across-a-trust-domain-boundary.md
# Remnant Warrant:    https://corpusfetch.com/c/what-structural-signals-indicate-a-revoked-federated-agent-identity-is-still-being-honored-across-a-trust-domain-boundary.warrant.json
# Markdown SHA-256:   7166dd5ee7712ca58f07ce4752fac7e3ef7143f058f916f31154c9573d7ee4f1
# Code AST SHA-256:   c345cba1b20ca24ff11aad5d59f94e630fa27ea8edb17b1d29ee5c1e232551bd
# Verified Classes:   EdgeRevocationUnrepresentable
# Defensive Guards:   2 fail-closed invariants (zero external deps)

class EdgeRevocationUnrepresentable(RuntimeError):
    """Raised when a delegated warrant chain cannot be checked for interior-edge revocation."""
    pass


def verify_chain_standing(chain, status_client, now):
    """
    Enforce edge-addressed revocation checking over a delegated warrant chain.
    chain: list of grants, each expected to expose .edge_id, .issuer, .subject
    status_client: object exposing .edge_standing(edge_id, at) -> bool
    """
    if len(chain) > 1:
        for grant in chain:
            edge_id = getattr(grant, "edge_id", None)
            if edge_id is None:
                # Delegated chain with no edge identifier: node-status checking
                # would pass on interior-edge revocation. Fail closed.
                raise EdgeRevocationUnrepresentable(
                    f"grant {grant.issuer}->{grant.subject} lacks edge_id; "
                    "interior-edge revocation is unrepresentable, refusing to verify"
                )
            if not status_client.edge_standing(edge_id, at=now):
                raise EdgeRevocationUnrepresentable(
                    f"edge {edge_id} ({grant.issuer}->{grant.subject}) revoked at {now}"
                )
    # Single-hop or fully edge-verified chain: standing confirmed.
    return True
