---
phase: 02-legacy-pruning
plan: 02
type: execute
wave: 1
depends_on: []
files_modified:
  - python/opendeviationbar/config/sidecar.py
  - python/opendeviationbar/sidecar.pyi
  - scripts/streaming_sidecar.py
  - tests/test_sidecar.py
  - tests/test_sidecar_watchdog.py
autonomous: true
requirements:
  - PRUNE-04

must_haves:
  truths:
    - "gap_fill_on_startup field does not exist in SidecarConfig"
    - "SidecarConfig can be instantiated without gap_fill_on_startup"
    - "All test SidecarConfig constructions work without gap_fill_on_startup"
    - "streaming_sidecar.py CLI no longer has --no-gap-fill flag"
  artifacts:
    - path: "python/opendeviationbar/config/sidecar.py"
      provides: "SidecarConfig without gap_fill_on_startup field"
    - path: "python/opendeviationbar/sidecar.pyi"
      provides: "Type stubs without gap_fill_on_startup"
    - path: "scripts/streaming_sidecar.py"
      provides: "CLI script without --no-gap-fill argument"
  key_links:
    - from: "tests/test_sidecar_watchdog.py"
      to: "python/opendeviationbar/config/sidecar.py"
      via: "SidecarConfig() construction without gap_fill_on_startup"
      pattern: "SidecarConfig\\("
---

<objective>
Remove the dead `gap_fill_on_startup` config field from SidecarConfig and all its consumers: type stubs, CLI script, and test files.

Purpose: Complete the legacy pruning by removing the config knob that controlled the now-deleted startup gap-fill behavior.
Output: Clean SidecarConfig with no dead fields; all tests pass without referencing the removed field.
</objective>

<execution_context>
@~/.claude/get-shit-done/workflows/execute-plan.md
@~/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/02-legacy-pruning/02-CONTEXT.md
</context>

<tasks>

<task type="auto">
  <name>Task 1: Remove gap_fill_on_startup from config, stubs, and CLI</name>
  <files>python/opendeviationbar/config/sidecar.py, python/opendeviationbar/sidecar.pyi, scripts/streaming_sidecar.py</files>
  <read_first>python/opendeviationbar/config/sidecar.py (lines 110-117 for the field), python/opendeviationbar/sidecar.pyi (lines 8-15 for the stub), scripts/streaming_sidecar.py (lines 60-95 for CLI args and config construction)</read_first>
  <action>
Three files to edit:

1. **python/opendeviationbar/config/sidecar.py** (~lines 110-117): Delete the `gap_fill_on_startup` field definition and its comment. The block to remove:

   ```python
   # Alias: existing env var is OPENDEVIATIONBAR_STREAMING_GAP_FILL (no ON_STARTUP)
   gap_fill_on_startup: bool = Field(
       True,
       validation_alias=AliasChoices(
           "OPENDEVIATIONBAR_STREAMING_GAP_FILL",
           "OPENDEVIATIONBAR_STREAMING_GAP_FILL_ON_STARTUP",
       ),
   )
   ```

2. **python/opendeviationbar/sidecar.pyi** (~line 11): Delete the `gap_fill_on_startup: bool` line from the SidecarConfig class stub.

3. **scripts/streaming_sidecar.py**: Remove the `--no-gap-fill` argument definition (~lines 63-67) and the `gap_fill_on_startup=not args.no_gap_fill` line from SidecarConfig construction (~line 92). Also remove the docstring example "Skip gap-fill on startup" (~lines 21-22).
   </action>

  <verify>
    <automated>cd /Users/terryli/eon/opendeviationbar-py && grep -rn "gap_fill_on_startup" python/opendeviationbar/config/sidecar.py python/opendeviationbar/sidecar.pyi scripts/streaming_sidecar.py ; echo "EXIT:$?"</automated>
  </verify>
  <acceptance_criteria>
- `grep -c "gap_fill_on_startup" python/opendeviationbar/config/sidecar.py` returns 0
- `grep -c "gap_fill_on_startup" python/opendeviationbar/sidecar.pyi` returns 0
- `grep -c "gap_fill_on_startup\|no.gap.fill" scripts/streaming_sidecar.py` returns 0
- `uv run --python 3.13 python -c "from opendeviationbar.config.sidecar import SidecarConfig; c = SidecarConfig(symbols=['BTC'], thresholds=[250]); print('OK')"` prints OK
  </acceptance_criteria>
  <done>gap_fill_on_startup removed from config definition, type stubs, and CLI script.</done>
</task>

<task type="auto">
  <name>Task 2: Remove gap_fill_on_startup from all test files</name>
  <files>tests/test_sidecar.py, tests/test_sidecar_watchdog.py</files>
  <read_first>tests/test_sidecar.py (line 122 for the gap_fill_on_startup reference), tests/test_sidecar_watchdog.py (lines 190-200, 260-270, 318-325, 383-390, 435-442, 480-487, 537-544, 614-621, 667-674 for all SidecarConfig constructions)</read_first>
  <action>
Two test files to update:

1. **tests/test_sidecar.py** (~line 122): Update the docstring that references `gap_fill_on_startup=False`. The test itself likely constructs SidecarConfig -- remove `gap_fill_on_startup=False` from that construction. If the test's purpose was specifically about gap_fill_on_startup behavior, update the docstring to reflect the new behavior (gap_fill_results=None is now the only path).

2. **tests/test_sidecar_watchdog.py**: Remove `gap_fill_on_startup=False` from ALL 9 SidecarConfig constructions (lines ~195, ~265, ~322, ~387, ~439, ~484, ~541, ~618, ~671). Each is a keyword argument in a SidecarConfig() call -- simply delete the line.

After editing, run the full test suite to verify nothing breaks.
</action>
<verify>
<automated>cd /Users/terryli/eon/opendeviationbar-py && uv run --python 3.13 pytest tests/test_sidecar.py tests/test_sidecar_watchdog.py -x -q 2>&1 | tail -5</automated>
</verify>
<acceptance_criteria>

- `grep -c "gap_fill_on_startup" tests/test_sidecar.py tests/test_sidecar_watchdog.py` returns 0 for both files
- `uv run --python 3.13 pytest tests/test_sidecar.py tests/test_sidecar_watchdog.py -x -q` passes all tests
- No test references the deleted config field
  </acceptance_criteria>
  <done>All test files updated. gap_fill_on_startup references removed from 9 SidecarConfig constructions in watchdog tests and 1 reference in sidecar tests. Full test suite passes.</done>
  </task>

</tasks>

<verification>
```bash
# Verify no references remain anywhere in the codebase
grep -rn "gap_fill_on_startup" python/ scripts/ tests/ --include="*.py" --include="*.pyi"

# Verify SidecarConfig works without the field

uv run --python 3.13 python -c "from opendeviationbar.config.sidecar import SidecarConfig; print(SidecarConfig(symbols=['BTC'], thresholds=[250]))"

# Run full test suite

uv run --python 3.13 pytest tests/test_sidecar.py tests/test_sidecar_watchdog.py -x -q

```
</verification>

<success_criteria>
- gap_fill_on_startup field does not exist in SidecarConfig or config/sidecar.py (PRUNE-04)
- Type stubs updated
- CLI --no-gap-fill flag removed
- All 9 test SidecarConfig constructions updated
- All tests pass
</success_criteria>

<output>
After completion, create `.planning/phases/02-legacy-pruning/02-02-SUMMARY.md`
</output>
```
