fix(server): skip one-sided order books + close race and poller recovery tests #12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/clob-midpoint-and-test-gaps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Last items from the repo-wide review:
One-sided order books no longer fabricate a midpoint.
topOfBookdefaultedbestAsk = 1on a bids-only book andbestBid = 0on an asks-only book, producing midpoints that jump violently when one side transiently empties and poisoningdelta15mhistory. It now throws (the caller already catches and skips that market's tick, keeping the last snapshot — same handling as the existing empty-book case). An asks side with only zero/non-positive prices counts as one-sided too, preserving the intent of the pre-existingp > 0filter.Test: concurrent double-close race. New
positions.race.test.ts(separate file to avoid conflicting with the open positions PR): real app + real SQLite, price source gated on a deferred promise so both closes are verifiably in flight past the read-check simultaneously; asserts exactly one 200 and one 409, one closed row. The conditionalUPDATE ... WHERE status='open'backstop works correctly — no production bug found.Test: startPoller error recovery. A throwing discovery run keeps the previous market set and both loops alive; a throwing tick doesn't kill the tick loop. Written against the current self-rescheduling-loop implementation. Recovery behavior confirmed correct — test-only.
Tests: 57 files / 317 passing (+9 over main), typecheck clean.
3d5d7be107tob83d6024db