uv(pass-a-r1): K-purge — Rev-4-FINAL compliance. A1: reconcile_ok replaced by stateless per-event tripwire (tripwire_ok + tripwire_last_event_id on AccountStateSnapshot). Detection latency = 1 event. A2: ASEXAccountV2.k_capital -> _k_capital_internal. 6 acceptance tests.
This commit is contained in:
@@ -408,3 +408,35 @@ class KernelOutcome:
|
||||
transitions: Tuple[KernelTransition, ...] = ()
|
||||
emitted_events: Tuple[VenueEvent, ...] = ()
|
||||
details: Dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class AccountStateSnapshot:
|
||||
"""Frozen value mirroring exchange account truth (E-block).
|
||||
|
||||
Rev-4-FINAL: E sole authority. No K-derived fields.
|
||||
reconcile_ok kept for backward compat — consumers MUST read tripwire_ok.
|
||||
"""
|
||||
|
||||
wallet_balance: float = 0.0
|
||||
available_margin: float = 0.0
|
||||
used_margin: float = 0.0
|
||||
event_seq: int = 0
|
||||
mono_ns: int = 0
|
||||
e_live: bool = False
|
||||
# Rev-4 compat (deprecated — K-derived, do not read)
|
||||
reconcile_ok: bool = False
|
||||
# Rev-4-FINAL: stateless per-event tripwire
|
||||
tripwire_ok: bool = True
|
||||
tripwire_last_event_id: str = ""
|
||||
|
||||
def as_dict(self) -> dict:
|
||||
return {
|
||||
"wallet_balance": float(self.wallet_balance),
|
||||
"available_margin": float(self.available_margin),
|
||||
"used_margin": float(self.used_margin),
|
||||
"event_seq": int(self.event_seq),
|
||||
"mono_ns": int(self.mono_ns),
|
||||
"e_live": bool(self.e_live),
|
||||
"reconcile_ok": bool(self.reconcile_ok),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user