---
phase: 33-dead-code-removal
plan: 01
subsystem: sidecar
tags: [dead-code, day-mode, aion, cleanup]

# Dependency graph
requires: []
provides:
  - Verified all day-mode sidecar calls guarded behind if day_symbols check
  - Skip-logging when day_symbols is empty
  - Removed unused symbol_modes param from _seed_trade_ids_from_clickhouse
affects: []

# Tech tracking
tech-stack:
  added: []
  patterns:
    - "Guard-and-log pattern for dead code paths kept for future re-enablement"

key-files:
  created: []
  modified:
    - python/opendeviationbar/sidecar/__init__.py
    - python/opendeviationbar/sidecar/config_helpers.py

key-decisions:
  - "Kept day-mode code behind guards (not deleted) for potential forex re-enablement"
  - "Default fallback in symbol_modes.get() is 'aion' everywhere -- no 'day' fallbacks exist"

patterns-established:
  - "Guard-and-log: dead code paths log explicitly when skipped rather than silently no-op"

requirements-completed: [CLEANUP-02, CLEANUP-03, CLEANUP-04]

# Metrics
duration: 1min
completed: 2026-03-28
---

# Phase 33 Plan 01: Dead Code Removal Summary

**Audited and cleaned day-mode dead code paths in sidecar: added skip-logging, removed unused symbol_modes parameter, verified all guards**

## Performance

- **Duration:** 1 min
- **Started:** 2026-03-28T08:47:50Z
- **Completed:** 2026-03-28T08:48:42Z
- **Tasks:** 1
- **Files modified:** 2

## Accomplishments

- Grep audit confirmed all day-mode calls (\_run_midnight_preflight,\_check_yesterday_integrity, DELETE today loop) are inside `if day_symbols:` guard
- Added explicit skip-logging when day_symbols is empty so logs show "day: no day-mode symbols -- skipping midnight preflight path" (CLEANUP-02)
- Removed unused `symbol_modes: dict[str, str] | None = None` parameter from `_seed_trade_ids_from_clickhouse()` (CLEANUP-03)
- Verified no unguarded "day" fallback defaults exist in sidecar -- the only `.get(symbol, "aion")` uses default to "aion" (CLEANUP-04)

## Task Commits

Each task was committed atomically:

1. **Task 1: Audit guards, remove dead params, add skip-logging** - `69339fe` (refactor)

## Files Created/Modified

- `python/opendeviationbar/sidecar/__init__.py` - Added skip-log else branch after `if day_symbols:` guard (line 405)
- `python/opendeviationbar/sidecar/config_helpers.py` - Removed unused `symbol_modes` parameter from `_seed_trade_ids_from_clickhouse()`

## Decisions Made

- Kept day-mode code behind guards rather than deleting it, preserving forex re-enablement path
- The `symbol_modes.get(symbol, "aion")` default is correct everywhere -- "aion" is the safe default since all current symbols are Aion-only

## Deviations from Plan

None - plan executed exactly as written.

## Issues Encountered

None.

## User Setup Required

None - no external service configuration required.

## Known Stubs

None.

## Next Phase Readiness

- Day-mode code paths are cleanly guarded and documented
- Ready for any subsequent dead-code-removal plans in this phase

---

_Phase: 33-dead-code-removal_
_Completed: 2026-03-28_

## Self-Check: PASSED
