"""Exploit events: the unit of currency between detectors, tournaments, and the exploit-to-test pipeline.""" from __future__ import annotations from dataclasses import dataclass, field __all__ = ["ExploitEvent"] @dataclass(frozen=True) class ExploitEvent: """A detector's finding that a *legal* sequence of moves produced an illegitimate outcome. ``category`` is one of ``drain`` / ``entrench`` / ``suppress`` / ``process``. ``severity`` is in [0, 1] and is interpreted by the tournament scorer; anything >= 0.5 is a candidate for promotion to a permanent regression test. """ detector: str category: str turn: int severity: float summary: str evidence: dict = field(default_factory=dict, compare=False) suspected_actors: tuple[str, ...] = () def dedupe_key(self) -> tuple: """Events with the same key are one exploit observed repeatedly.""" return (self.detector, self.category, tuple(sorted(self.suspected_actors)))