# Plan: Phase 4 — Verification + Deploy

**Requirements:** Validation of Phases 1-3

## Tasks

### Task 1: Run full test suite

```bash
mise run check-full
```

All existing tests must pass. No new tests required for Phase 1 (2-line change). Phase 2 adds a new function that's non-fatal by design — test via production observation.

### Task 2: Release

```bash
mise run release:full
```

Creates version tag, publishes to PyPI and crates.io.

### Task 3: Deploy to bigblack

```bash
mise run deploy:bigblack
```

Uses the hardened deploy script from Phase 3. Verify:

- Build time >30s ✓
- StreamManager started ✓
- Kintsugi started after sidecar ✓

### Task 4: Verify overlap guard (24h)

```sql
-- Check for overlaps across all 18 symbols
SELECT symbol, threshold_decimal_bps,
       countIf(tid_delta < 0) AS overlaps
FROM (
    SELECT first_agg_trade_id
             - lagInFrame(last_agg_trade_id, 1) OVER w - 1
             AS tid_delta,
           row_number() OVER w AS rn,
           symbol, threshold_decimal_bps
    FROM opendeviationbar_cache.open_deviation_bars FINAL
    WHERE first_agg_trade_id > 0 AND last_agg_trade_id > 0
      AND close_time_ms >= toUInt64(toUnixTimestamp(now() - INTERVAL 24 HOUR)) * 1000
    WINDOW w AS (PARTITION BY symbol, threshold_decimal_bps, ouroboros_mode
                 ORDER BY first_agg_trade_id, close_time_ms)
)
WHERE rn > 1
GROUP BY symbol, threshold_decimal_bps
HAVING overlaps > 0
```

Expected: 0 rows (no overlaps).

### Task 5: Verify self-heal is operational

Check journal logs for overlap_heal entries:

```bash
ssh bigblack 'journalctl --user -u opendeviationbar-sidecar --since "24h ago" --no-pager | grep overlap_heal'
```

Expected: periodic check entries every 300s. If no overlaps exist, the check runs but finds nothing — that's correct.

### Task 6: Verify heartbeat reports HEALTHY

```bash
ssh bigblack 'journalctl --user -u opendeviationbar-heartbeat --since "1h ago" --no-pager | tail -20'
```

## Success Criteria

1. ✅ 0 overlaps across all 18 symbols for 24h+
2. ✅ Self-heal check entries in journal every 300s
3. ✅ Heartbeat reports HEALTHY
4. ✅ Git SHA visible in sidecar startup log
5. ✅ Build used hardened deploy script (all 3 gates passed)

## Commit

```
docs: v1.1 milestone complete — overlap prevention deployed and verified
```
