# Compatibility Layer

**Parent**: [/python/opendeviationbar/CLAUDE.md](/python/opendeviationbar/CLAUDE.md) | **Hub**: [/CLAUDE.md](/CLAUDE.md)

Backward compatibility shims for alpha-forge integration (Issue #95). Provides feature metadata registry, panel format conversion (OHLCV to `price.*`/`feature.*` columns), and cache availability reporting with graceful ClickHouse fallback.

---

## Files

| File              | LOC  | Purpose                                                                                           |
| ----------------- | ---- | ------------------------------------------------------------------------------------------------- |
| `__init__.py`     | ~30  | Re-exports all public symbols from submodules                                                     |
| `availability.py` | ~210 | `get_cache_coverage()` and `get_available_symbols()` -- reports which symbols have cached bars    |
| `manifest.py`     | ~165 | `FeatureRegistry` singleton parsed from Rust-embedded TOML (`feature_manifest.toml` via PyO3)     |
| `panel.py`        | ~160 | `to_panel_format()` and `get_open_deviation_bars_panel()` -- converts OHLCV to alpha-forge layout |

## Compatibility Guarantees

- **Panel format**: Converts opendeviationbar's capitalized OHLCV + DatetimeIndex output to alpha-forge's flat `ts, symbol, price.*, feature.*` column layout. Internal metadata columns (`ouroboros_mode`, `is_orphan`, trade IDs) are always stripped.
- **Feature manifest**: `FeatureRegistry` is a lazy singleton parsed once from Rust-embedded TOML. Feature names, groups, and metadata are stable across versions -- the TOML SSoT lives in `crates/opendeviationbar-core/data/feature_manifest.toml`.
- **Availability API**: `get_cache_coverage()` returns `SymbolAvailability` dataclasses with per-threshold bar counts and date ranges. Returns registry-only data (no exception) when ClickHouse is unreachable.

## Related

- [/python/opendeviationbar/CLAUDE.md](/python/opendeviationbar/CLAUDE.md) -- Parent spoke (Python API layer)
- [/CLAUDE.md](/CLAUDE.md) -- Project hub
- [/crates/CLAUDE.md](/crates/CLAUDE.md) -- Rust crates (feature manifest TOML source)
