Skip to content

[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

  1. neo_engine/state_manager.pyrecord_capital_event() now validates event_type, asset, amount, and (for XRP) price_rlusd up front and raises ValueError. Bad rows can no longer reach disk.

  2. neo_engine/inventory_manager.py_rebuild_wac() replaces the old log.warning + silent skip on XRP capital events with a hard-fail ValueError carrying the event timestamp and offending price. Engine refuses to start rather than quietly drift cost basis if any pre-fix row ever sneaks through.

  3. tests/test_inventory_manager.py — 15 new test cases (TestFlag008CapitalEventValidation, TestFlag008WacRebuild) covering:

  4. Write path: invalid event_type/asset/amount, missing/zero/negative XRP price, RLUSD deposit without price succeeds
  5. Rebuild path: raw-inserted legacy bad rows blow up, valid events replay cleanly, RLUSD events ignored
  6. Also restored OrderSizeConfig.max_size_pct_of_portfolio to 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)