fix(broker): restore main wiring and add production retry cadence + status surface
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
2b5d9043b9
commit
1f728f4d7d
@@ -272,6 +272,37 @@ def test_pending_sell_balance_failure_is_fail_closed_with_backoff_and_recovery()
|
||||
assert health["consecutive_failures"] == 0
|
||||
|
||||
|
||||
def test_pending_sell_health_preserves_non_transient_snapshot_failure_code():
|
||||
broker = PaperBroker(fill_after_polls=0)
|
||||
repo, svc, intents, _ = _wire(broker)
|
||||
sid = _buy(intents, qty=3).slot_id
|
||||
ExecutionService(
|
||||
svc,
|
||||
repo,
|
||||
broker,
|
||||
instance_key=INST,
|
||||
).run_once()
|
||||
svc.sell(sid, actor="t", reason="full")
|
||||
|
||||
execution = ExecutionService(
|
||||
svc,
|
||||
repo,
|
||||
broker,
|
||||
instance_key=INST,
|
||||
balance_reader=lambda: (_ for _ in ()).throw(
|
||||
AccountSnapshotUnavailable(
|
||||
"live_read_failed",
|
||||
detail_code="authentication_failed",
|
||||
)
|
||||
),
|
||||
)
|
||||
result = execution.run_once()
|
||||
assert result.sell_skipped_no_balance == 1
|
||||
health = execution.balance_worker_health(stale_after_sec=600)
|
||||
assert health["state"] == "unavailable"
|
||||
assert health["failure_code"] == "authentication_failed"
|
||||
|
||||
|
||||
def test_partial_sell_qty_is_min_intent_broker():
|
||||
"""dcy-021/REQ-062 (D4): partial sell dispatches min(intent qty, broker);
|
||||
remainder stays holding (broker-authoritative qty), cost basis preserved."""
|
||||
|
||||
Reference in New Issue
Block a user