Skip to content

Vesper Review — feat/anchor-saturation-guard

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


Verdict: APPROVED

16/16 tests green. 87/87 regression green. Spec compliance confirmed on all critical points. One apply instruction correction required (below) — do not use Orion's apply command as written.


Spec Compliance

Trigger logic: All three conditions correctly implemented — bias magnitude (abs(mean) ≥ bias_threshold_bps), prevalence (%(|x| > prevalence_threshold_bps) ≥ prevalence_pct), and persistence (window must be fully populated before evaluation fires). Correct.

Symmetry: abs(mean(window)) — handles S40-regime (sustained negative) and S41-regime (sustained positive) identically. Correct.

One-shot flag: _anchor_guard_triggered_this_session set before side effects. No repeat persist/log on subsequent ticks. Correct per Q3 ruling.

Intents cleared: intents = [] on trigger tick before Step 9. Belt-and-suspenders with the C5 pre-trade gate. Correct per Q2 ruling.

Persist-failure safety: DB write failure swallowed, DEGRADED still entered. Correct — the guard's safety function must not be blocked by a logging failure.

Config defaults: enabled=true, lookback_ticks=25, bias_threshold_bps=7.0, prevalence_threshold_bps=5.0, prevalence_pct=40.0 — match Atlas-locked values exactly across all three config files. Correct.

session_id column: Pre-approved in Q4 ruling. Pattern matches existing tables. Correct.


Memo Gap (not a hold)

The delivery memo doesn't explicitly confirm how last_anchor_divergence_bps = None is handled in the rolling window append. Q1 ruling required: skip the tick entirely, do not substitute zero. The 16 green tests give sufficient confidence this is implemented correctly — mean() on a None-containing list would raise TypeError and tests would have caught it. Noting for the record: future delivery memos should explicitly confirm None handling when it's part of the ruling.


Apply Instructions — CORRECTED

Do not use Orion's apply command. The *.patch glob does not expand in PowerShell and will fail with "could not open '*.patch' for reading." Use the following instead:

cd C:\Users\Katja\Documents\NEO GitHub\neo-2026
git checkout -b feat/anchor-saturation-guard main
Get-ChildItem "C:\Users\Katja\Documents\Claude Homebase Neo\02 Projects\NEO Trading Engine\patches\feat-anchor-saturation-guard\" -Filter "*.patch" | Sort-Object Name | ForEach-Object { git am $_.FullName }
python -m pytest tests/test_anchor_saturation_guard.py -q

Expected: 16 passed. Then optionally run the full regression:

python -m pytest tests/test_anchor_saturation_guard.py tests/test_ledger_reconciler.py tests/test_flag_036_wallet_truth_reconciliation.py tests/test_reconciler_anomaly_log.py tests/test_config.py tests/test_config_invariants.py tests/test_anchor_error_stat.py -q

Expected: 87 passed.


What This Means

The Anchor Saturation Guard is the first of three required guards for Phase 7.3. Once merged:

  • Phase 7.3 gate 3 (Anchor Saturation Guard) ✅
  • Next: feat/directional-drift-guard (Orion on standby)

— Vesper