Done: starting a bet whose estimate exceeds the balance answers 422 on the page, API and MCP with one sentence 'estimate $X, balance $Y', nothing queued and no run created; a bet within the balance still starts; tests for each door. Suggested: scout.
Risks: Race between two bets: check and reserve in one transaction.
Read AGENTS.md and docs/PRINCIPLES.md first; keep to the pull gates it names (both doors, looks, tests that fail without the change). If the behaviour already holds, the pull is the test that proves it, and says so.
Done: starting a bet whose estimate exceeds the balance answers 422 on the page, API and MCP with one sentence 'estimate $X, balance $Y', nothing queued and no run created; a bet within the balance still starts; tests for each door. Suggested: scout.
Risks: Race between two bets: check and reserve in one transaction.
Read AGENTS.md and docs/PRINCIPLES.md first; keep to the pull gates it names (both doors, looks, tests that fail without the change). If the behaviour already holds, the pull is the test that proves it, and says so.
Files: src/actions/bets.ts, src/web/pages/bets.ts, test/bet-over-wallet.test.ts, docs/features/bets.md