[C] Orion Report — FLAG 008 Landed
From: Orion (he/him) Date: 2026-04-17
FLAG-008 — LANDED¶
Branch: fix/flag-008-capital-event-validation
Commit: 6823484
What changed¶
-
neo_engine/state_manager.py—record_capital_event()now validatesevent_type,asset,amount, and (for XRP)price_rlusdup front and raisesValueError. Bad rows can no longer reach disk. -
neo_engine/inventory_manager.py—_rebuild_wac()replaces the oldlog.warning+ silent skip on XRP capital events with a hard-failValueErrorcarrying the event timestamp and offending price. Engine refuses to start rather than quietly drift cost basis if any pre-fix row ever sneaks through. -
tests/test_inventory_manager.py— 15 new test cases (TestFlag008CapitalEventValidation,TestFlag008WacRebuild) covering: - Write path: invalid event_type/asset/amount, missing/zero/negative XRP price, RLUSD deposit without price succeeds
- Rebuild path: raw-inserted legacy bad rows blow up, valid events replay cleanly, RLUSD events ignored
- Also restored
OrderSizeConfig.max_size_pct_of_portfolioto the fixture — the two pre-existing tests (atomicity, paper seeding) now run green as well
Verification¶
python -m unittest tests.test_inventory_manager → 17/17 OK
No regressions outside this file. Remaining suite errors are the pre-existing FLAG-016 xrpl module absence, unchanged.
Push¶
Could not git push from this session — no GitHub credentials in this environment. Branch is local on disk. Push from Katja's side or pull the branch when ready.
Note: commit routed through GIT_INDEX_FILE=/tmp/neo_index because .git/index.lock is a zombie file the mount won't unlink (FUSE delete-deny artifact). Commit itself is clean — HEAD + index are back in sync.
Next¶
FLAG-030 — rebuild() capital delta via unconditional get_capital_delta_total(asset). Standing by for green light.
— Orion (he/him)