fix: fail closed on unknown reconcile warnings
This commit is contained in:
@@ -287,6 +287,11 @@ class IntentService:
|
||||
case_codes = {case_code} if case_code else set()
|
||||
if not case_codes:
|
||||
return True
|
||||
# The warning row is authoritative. Unknown cases are not evidence
|
||||
# that trading is safe: they may come from corrupt data or a newer
|
||||
# producer that this core version cannot interpret.
|
||||
if not case_codes.issubset(BLOCKING_RECONCILE_CASES):
|
||||
return True
|
||||
return bool(case_codes & BLOCKING_RECONCILE_CASES)
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
@@ -280,6 +280,8 @@ def make_slots_rpc_handler(
|
||||
codes = {case_code} if case_code else set()
|
||||
if not codes:
|
||||
raise RuntimeError(f"empty warning cases for slot_id={sid}")
|
||||
if not codes.issubset(BLOCKING_RECONCILE_CASES):
|
||||
raise RuntimeError(f"unsupported warning cases for slot_id={sid}")
|
||||
warning_cases_by_slot[str(sid)] = codes
|
||||
except Exception: # noqa: BLE001
|
||||
_log.exception("warn_store warning query failed — fail-closed")
|
||||
|
||||
@@ -660,7 +660,9 @@ def slot_to_dict(
|
||||
reconcile_warned = bool(warning_cases)
|
||||
d["reconcile_warned"] = reconcile_warned
|
||||
d["reconcile_warning_cases"] = sorted(warning_cases)
|
||||
d["trade_eligible"] = not bool(warning_cases & BLOCKING_RECONCILE_CASES)
|
||||
known_blocking = bool(warning_cases & BLOCKING_RECONCILE_CASES)
|
||||
unknown_cases = bool(warning_cases - BLOCKING_RECONCILE_CASES)
|
||||
d["trade_eligible"] = not (known_blocking or unknown_cases)
|
||||
|
||||
return d
|
||||
|
||||
|
||||
Reference in New Issue
Block a user