fix: close broker uncertainty audit gaps
This commit is contained in:
@@ -579,6 +579,7 @@ class ExecutionService:
|
||||
slot.slot_id,
|
||||
str(slot.broker_order_id),
|
||||
CancelState.UNKNOWN.value,
|
||||
only_if_unset=True,
|
||||
):
|
||||
_log.error(
|
||||
"cancel attempt reservation conflict: slot=%s broker_order_id=%s",
|
||||
@@ -719,6 +720,8 @@ class ExecutionService:
|
||||
if not slot.broker_order_id:
|
||||
# Claimed but not yet dispatched — execution loop will pick up or rollback.
|
||||
return "not_dispatched"
|
||||
if slot.cancel_state is not None:
|
||||
return "cancel_already_recorded"
|
||||
side = "buy" if slot.status is SlotState.PENDING_BUY else "sell"
|
||||
qty = int(slot.qty or 0)
|
||||
try:
|
||||
@@ -735,8 +738,9 @@ class ExecutionService:
|
||||
slot.slot_id,
|
||||
str(slot.broker_order_id),
|
||||
CancelState.UNKNOWN.value,
|
||||
only_if_unset=True,
|
||||
):
|
||||
return "cancel_state_conflict"
|
||||
return "cancel_already_recorded"
|
||||
outcome = self._broker.cancel_order(slot.broker_order_id, **cancel_kwargs)
|
||||
except Exception: # noqa: BLE001 - adapter failure becomes durable unknown
|
||||
outcome = CancelOutcome(CancelState.UNKNOWN, "adapter_exception")
|
||||
|
||||
Reference in New Issue
Block a user