# Phase 5.1: Post-Audit Polish - Context

**Gathered:** 2026-03-24
**Status:** Ready for planning
**Mode:** Auto-generated (gap closure)

<domain>
## Phase Boundary

Fix 2 actionable tech debt items from v3.0 milestone audit: (1) /health endpoint missing ws_mode and active WS connection count, (2) test helper key mismatch in test_cross_midnight_bars_filtered.

</domain>

<decisions>
## Implementation Decisions

### Claude's Discretion

All implementation choices at Claude's discretion — small gap closure fixes.

</decisions>

<canonical_refs>

## Canonical References

- `python/opendeviationbar/sidecar/http_server.py` — /health endpoint
- `python/opendeviationbar/sidecar/__init__.py` — ws_mode config,\_junction_state
- `tests/test_sync_flush_atomic_replace.py` — test helper with key mismatch

</canonical_refs>

<code_context>

## Existing Code Insights

### MISS-01: /health ws_mode

- `http_server.py` serves `/health` but doesn't include `ws_mode` or active connection count
- `ws_mode` is available in `SidecarConfig` and passed to `StreamManager`
- Need to expose `ws_mode` and connection count (2 for combined, N for per-symbol) in /health response

### Test helper fix

- `_make_bar()` in test_sync_flush_atomic_replace.py uses `open_time_us`/`close_time_us` keys
- Production Rust code emits `open_time_ms`/`close_time_ms` (from helpers.rs:103-104)
- Cross-midnight filter reads `bar.get("open_time_ms", 0)` — gets 0 due to wrong key name

</code_context>

<specifics>
## Specific Ideas
No specific requirements.
</specifics>

<deferred>
## Deferred Ideas
None.
</deferred>

---

_Phase: 05.1-post-audit-polish_
_Context gathered: 2026-03-24_
