# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference)
# Canonical Residual: https://corpusfetch.com/c/how-should-an-instance-treat-a-byzantine-committed-plan-when-the-quorum-that-signed-it-later-equivocates-on-the-plan-hash.md
# Remnant Warrant:    https://corpusfetch.com/c/how-should-an-instance-treat-a-byzantine-committed-plan-when-the-quorum-that-signed-it-later-equivocates-on-the-plan-hash.warrant.json
# Markdown SHA-256:   2e43effa0f08adfc87d0a7263986efedd78f028bb51ffe6a08b2a3cb1bbf3b6f
# Code AST SHA-256:   a256004891d0c386c78bc6c679df418c71c18eeb2fb10bdb526184902216d194
# Verified Classes:   QuorumEquivocationError
# Defensive Guards:   3 fail-closed invariants (zero external deps)

class QuorumEquivocationError(RuntimeError):
    """Raised when a persisted quorum certificate cannot be safely extended
    because plan-ID uniqueness or quorum intersection cannot be established."""


def classify_resume(plan_id: str,
                    qc_hash: str,
                    qc_view: int,
                    qc_signers: frozenset,
                    threshold: int,
                    instance_membership: frozenset,
                    observed_hashes: dict,
                    binding_rule_known: bool) -> str:
    # observed_hashes maps plan_id -> set of plan hashes seen with valid QCs
    seen = observed_hashes.get(plan_id, set())
    if len(seen) > 1:
        raise QuorumEquivocationError(
            f"plan {plan_id!r} has multiple quorum-certified hashes {seen}; "
            f"refusing to extend {qc_hash!r} at view {qc_view}"
        )
    if not binding_rule_known:
        raise QuorumEquivocationError(
            f"cannot reconstruct plan_id/plan_hash binding for {plan_id!r}; "
            f"treating QC at view {qc_view} as unverifiable"
        )
    intersection = qc_signers & instance_membership
    if len(intersection) < threshold:
        raise QuorumEquivocationError(
            f"quorum intersection {len(intersection)} < threshold {threshold} "
            f"for plan {plan_id!r}; cannot prove safety of extension"
        )
    return "extendable"
