Vesper Review — Branch #5 audit/config-wiring-pass¶
To: Katja CC: Orion, Atlas From: Vesper Date: 2026-04-18
Verdict: APPROVED ✅¶
Three commits reviewed. All rulings from the Q1–Q3 memo are honored. No blocking issues. One non-blocking nit.
Commit 1 — feat(strategy): promote clob_switch_threshold_bps to config¶
Clean promotion, four surfaces all at 3.0 per Q2 ruling:
StrategyConfig.clob_switch_threshold_bps: float = 3.0— field added with appropriate inline comment citing Atlas §2C.- Loader:
float(strat_raw.get("clob_switch_threshold_bps", 3.0))in the correct position alongsideanchor_max_divergence_bps. - Both YAML files updated with the value and a clear comment.
strategy_engine.py: hardcoded3.0replaced; Orion used a local alias_clob_switch_threshold_bpsto avoid a long attribute chain inside the condition. Readable and correct.
The stale max_inventory_usd=10000.0 kwarg removed from test_phase_7_2_clob_switch.py is the right call — pre-existing FLAG-034 orphan confirmed, removing it restores 5 tests to green. Not a scope violation.
Six new tests in test_clob_switch_threshold_config.py cover the critical cases: fires above threshold, holds at exact threshold (strict >), knob moves the switch in both directions at an override of 5.0, loader default is 3.0, loader reads YAML override. Behavior contract is fully verified.
Commit 2 — feat(startup): config invariant check emits config_mismatch on failure¶
Implementation matches the Q1 ruling exactly — four invariants, not three.
Structure is correct: _check_config_invariants() collects all failures before raising (no bail-on-first), persists both halt.reason and halt.detail, then raises RuntimeError. The outer run() wrapper marks the engine HALTED. HALT_REASON_CONFIG_MISMATCH is now live, not dead-letter.
Call site position in _startup() is correct: after initialize_database() (so the state write has a DB to land in) and before engine_status = RUNNING (so a bad config never enters the main loop).
The test_halt_reason_lifecycle.py fixture update is necessary and correct. With concrete config values (tick=4, requote=4, threshold=3.0, max_xrp=150, max_rlusd=150), the fixture no longer depends on MagicMock truthiness for numeric comparisons — which would have been unreliable (MagicMock <= 0 returns a truthy MagicMock, making the invariant check fire spuriously without the fix).
Five tests in test_config_invariants.py: one happy-path asserting no halt state written, four failure paths each asserting RuntimeError message, halt.reason, and halt.detail content. Spec compliant.
One non-blocking nit: The try/except Exception: pass around the state persistence in _check_config_invariants is very broad. It's there to prevent a DB-not-ready failure from masking the config error, which is the right intent — and the RuntimeError propagates regardless, so the engine still halts. A narrower except (e.g. AttributeError) would be more precise. Acceptable as-is. Flag for future cleanup only.
Commit 3 — docs(config): add wiring-reference pointer comment to config.py¶
Five-line docstring addition at the top of neo_engine/config.py pointing to the workspace artifact. Exactly what Q3 ruling specified. No behavior change.
The workspace artifact [C] NEO Config Wiring Reference.md is present and complete — 45+ rows, every section from xrpl_node through alerts, with the four Branch #5 invariant entries correctly marked ✓ (Branch #5 Commit 2). Out-of-scope parameters.* section noted appropriately at the bottom.
Apply commands for your Windows VS Code terminal¶
git fetch origin
git checkout -b audit/config-wiring-pass 83452fe
git am "02 Projects\NEO Trading Engine\patches\branch-5-config-wiring-pass\0001-feat-strategy-promote-clob_switch_threshold_bps-to-c.patch"
git am "02 Projects\NEO Trading Engine\patches\branch-5-config-wiring-pass\0002-feat-startup-config-invariant-check-emits-config_mis.patch"
git am "02 Projects\NEO Trading Engine\patches\branch-5-config-wiring-pass\0003-docs-config-add-wiring-reference-pointer-comment-to-.patch"
git log --oneline -4
python -m pytest tests/test_clob_switch_threshold_config.py tests/test_config_invariants.py tests/test_phase_7_2_clob_switch.py tests/test_halt_reason_lifecycle.py tests/test_config.py -q
Expected: 39 passed, 0 failed in those five files. If clean, merge and push:
git checkout main
git merge --no-ff audit/config-wiring-pass -m "Merge branch 'audit/config-wiring-pass' into main"
git push
Then ping Orion for Branch #6 (feat/distance-to-touch-diagnostic).
Branch status after this merge¶
| Branch | Status |
|---|---|
| #1 fix/halt-reason-lifecycle | ✅ Merged |
| #2 fix/summarize-paper-run-capital-overlay | ✅ Merged |
| #3 chore/archive-cleanup | ✅ Merged |
| #4 fix/flag-029-async-pin-and-orphan | ✅ Merged |
| #5 audit/config-wiring-pass | ✅ Approved — apply and merge |
| #6 feat/distance-to-touch-diagnostic | ⏳ Next |
| #7 fix/wal-checkpoint-hardening | ⏳ Queued |
S40 required after #6 and #7 before Phase 7.3.
— Vesper