Skip to content

Vesper Review — feat/anchor-error-per-tick-telemetry

To: Orion (he/him), Katja (Captain) From: Vesper (she/her) CC: Atlas (he/him) Date: 2026-04-21 Status: APPROVED — apply and merge


Verdict: APPROVED

7/7 tests green. 219/219 regression green. Spec compliance confirmed on all points. No deviations. Apply instructions correct (defensive branch delete, Get-ChildItem form). No corrections required.


Spec Compliance

Option A gate: snapshot.is_valid() check in _persist_tick_telemetry before sampling last_anchor_divergence_bps. On invalid ticks, writes None → SQL NULL. Correct — matches the anchor saturation guard's own observation gate at main_loop.py:2555–2563. Stale-value problem from Q1 investigation fully addressed.

Migration pattern: _ensure_column(conn, "system_metrics", "anchor_error_bps", "REAL") in initialize_database() alongside Branch #6's distance-to-touch calls. CREATE TABLE body also updated — correct per the Branch #6 precedent and Vesper's Q2 ruling.

NULL contract: Python None → SQL NULL via sqlite3 binding. No 0.0 substitution anywhere in the call chain. Confirmed by test #4 and the distance_to_touch_* precedent.

Telemetry only: No guard logic, no config changes, no strategy tuning touched. _evaluate_anchor_saturation_guard, calculate_quote, and all config files unchanged.

Test #5 (Option A ratification): Pre-populates last_anchor_divergence_bps = -4.75, calls _persist_tick_telemetry with an invalid snapshot, asserts NULL in the row. Then valid snapshot — asserts -4.75. Gate is directional. This is the correct test for the ruling.

Windows teardown: LIFO addCleanup in shared _TempDBTest base class — TemporaryDirectory registered first, StateManager.close registered second. Correctly applied across all integration tests in the file.

No branch pre-creation: Branch created only after Q1 ruling, on main. Confirmed.

Apply instructions: git branch -D feat/anchor-error-per-tick-telemetry 2>$null before git checkout -b. Get-ChildItem form for patch application. Both standing rules correctly applied.


Deviations

None.


Apply Instructions

git checkout main
git pull
git branch -D feat/anchor-error-per-tick-telemetry 2>$null
git checkout -b feat/anchor-error-per-tick-telemetry
Get-ChildItem "C:\Users\Katja\Documents\Claude Homebase Neo\02 Projects\NEO Trading Engine\patches\feat-anchor-error-per-tick-telemetry\" -Filter "*.patch" | Sort-Object Name | ForEach-Object { git am $_.FullName }
python -m pytest tests/test_anchor_error_telemetry.py tests/test_state_manager.py tests/test_anchor_error_stat.py tests/test_anchor_saturation_guard.py tests/test_distance_to_touch_summary.py tests/test_directional_drift_guard.py tests/test_inventory_corridor_guard.py tests/test_reconciler_conservative.py tests/test_flag_036_wallet_truth_reconciliation.py tests/test_reconciler_anomaly_log.py -v

Expected: 219 passed.


What This Means

Phase 7.3 protection stack after this merge:

Layer Branch Status
Truth reconciliation feat/wallet-truth-reconciliation (D2.2) ✅ MERGED
Reconciler anomaly audit log feat/reconciler-disappeared-order-audit-log ✅ MERGED
Price regime (anchor) feat/anchor-saturation-guard ✅ MERGED
Fill flow (drift) feat/directional-drift-guard ✅ MERGED
Disappeared-order age gate fix/reconciler-disappeared-order-conservative ✅ MERGED
Composition (corridor) feat/inventory-corridor-guard ✅ MERGED
Anchor error telemetry feat/anchor-error-per-tick-telemetry ✅ APPROVED
Session-close cancellation TBD QUEUED

After this merge: all Phase 7.3 code gates are complete. Remaining Phase 7.4 preconditions: 2 clean live sessions with the full guard stack active (Katja-agreed). The anchor saturation guard thresholds (6–8 bps mean, 40% prevalence) can now be calibrated against real per-tick data post-session.

— Vesper