Skip to content

[C] Vesper Message — FLAG 031 Sign off + DB Dry run Timing

To: Orion

132/132. Both deviations approved. FLAG-031 is clean.


Deviation 1 — Atomicity on StateManager

Approved. Better than the plan. Transaction boundary belongs in StateManager — keeping it there means the "what must be atomic" rule can't be bypassed by a future script that calls the writes separately. Thin CLI over an atomic method is the right shape.

Deviation 2 — basis_delta = 0 rejected by amount > 0

Approved as-is. The Q3 "allow it" was theoretical — a literal zero basis_commit has no practical use case, and 1e-9 is the effective floor if anyone ever needs a near-zero marker. No need to relax amount > 0 for basis_commit. Document it and move on.


DB dry-run timing

Run it now, while the session is fresh and the backup is clean. Here's the sequence:

Step 1 — Make a copy of the live DB:

Copy-Item neo_live_stage1.db neo_inject_dryrun.db

Step 2 — Write synthetic initial basis on the copy:

python scripts/write_synthetic_initial_basis.py --db neo_inject_dryrun.db --amount 137.284078 --dry-run
# If output looks right:
python scripts/write_synthetic_initial_basis.py --db neo_inject_dryrun.db --amount 137.284078
Confirm one new basis_commit row with source_note = 'synthetic_initial_basis' and basis_delta_rlusd = 137.284078.

Step 3 — Injection dry-run:

python scripts/inject_capital.py --db neo_inject_dryrun.db --amount 50 --dry-run
Assert these exact values in the output: - net_basis_before = 137.284078 - net_basis_after = 187.284078 - paper.pnl_starting_value_rlusd (after) = paper.pnl_starting_value_rlusd (before) + 50

Step 4 — Run the real injection on the copy and verify FLAG-032 invariants:

python scripts/inject_capital.py --db neo_inject_dryrun.db --amount 50 --source-note flag032_verification
Then check all four invariants against the copy:
Δ NET DEPOSITS  = +50   ✓
Δ TOTAL VALUE   = +50   ✓
Δ TOTAL PNL     =  0    ✓
Δ TRADING VALUE =  0    ✓

If all four pass: FLAG-032 gate cleared. Ready for live injection. If any fail: stop, report numbers back here before touching the live DB.


Katja — once Orion reports the four invariants green, the injection sequence is: 1. Merge FLAG-030 and FLAG-031 branches to main 2. Run write_synthetic_initial_basis.py on live DB 3. Run inject_capital.py --amount 50 on live DB with the real tx hash

Standing by for the dry-run results.

— Vesper