---
phase: 19-fleet-recompute-telemetry
plan: 02
subsystem: infra
tags: [clickhouse, aion, migration, drop-partition, stathera, kintsugi]

requires:
  - phase: 19-fleet-recompute-telemetry-01
    provides: Aion-aware diagnostic scripts, deploy config, schema comments
provides:
  - Fleet recompute script with preflight/execute/verify phases
  - Coordinated stop-drop-wipe-recompute sequence for bigblack
affects: []

tech-stack:
  added: []
  patterns:
    [system.parts partition discovery for dynamic DROP PARTITION targeting]

key-files:
  created:
    - scripts/fleet_recompute_aion.py
  modified: []

key-decisions:
  - "Query system.parts for actual partition discovery rather than hardcoding 72 partitions (handles any threshold config)"
  - "Script displays systemctl commands as instructions rather than executing them (remote execution model)"

patterns-established:
  - "Partition discovery via system.parts WHERE active = 1 for safe DROP operations"

requirements-completed: [RECOMP-01, RECOMP-02, RECOMP-03, VAL-04]

duration: 2min
completed: 2026-03-27
---

# Phase 19 Plan 02: Fleet Recompute Aion Migration Script Summary

**Coordinated stop-drop-wipe-recompute script with 3-phase CLI (preflight/execute/verify), dynamic partition discovery, and Stathera audit for bigblack Aion migration**

## Performance

- **Duration:** 2 min
- **Started:** 2026-03-27T16:31:33Z
- **Completed:** 2026-03-27T16:33:33Z
- **Tasks:** 1/2 (Task 2 is checkpoint: human execution on bigblack)
- **Files created:** 1

## Accomplishments

- Fleet recompute script with --preflight (discover partitions), --execute (DROP + wipe), --verify (Stathera audit)
- Dynamic crypto symbol enumeration via get_registered_symbols(asset_class="crypto")
- Actual partition discovery from system.parts (not hardcoded -- handles any threshold config)
- Safety: YES confirmation prompt, --dry-run flag, mutations_sync=1 on all DELETEs
- Stathera verification query with per-symbol gap/overlap counts and ouroboros mode distribution

## Task Commits

Each task was committed atomically:

1. **Task 1: Create fleet recompute script** - `584dbf0` (feat)
2. **Task 2: Execute fleet recompute on bigblack** - CHECKPOINT (human execution required)

## Files Created/Modified

- `scripts/fleet_recompute_aion.py` - Coordinated Aion migration script with 3 phases, SSH tunnel support, colored output

## Decisions Made

- Used system.parts query for partition discovery rather than hardcoding (symbol, threshold) pairs -- handles any threshold configuration on bigblack
- Script displays systemctl commands as instructions for the user to run on bigblack rather than attempting remote execution
- Reused SSHTunnel and connect() patterns from detect_gaps.py for consistent CH connectivity

## Deviations from Plan

None - plan executed exactly as written.

## Issues Encountered

None.

## User Setup Required

**Human execution required on bigblack.** The fleet recompute must be run manually:

1. Deploy code: `mise run deploy:bigblack`
2. SSH to bigblack: `ssh bigblack`
3. Stop services: `systemctl --user stop opendeviationbar-sidecar opendeviationbar-kintsugi opendeviationbar-kintsugi-catchup`
4. Run preflight: `uv run --python 3.13 python scripts/fleet_recompute_aion.py --preflight`
5. Run execute: `uv run --python 3.13 python scripts/fleet_recompute_aion.py --execute`
6. Start kintsugi: `systemctl --user start opendeviationbar-kintsugi-catchup`
7. Wait for recompute (~1-3h)
8. Verify: `uv run --python 3.13 python scripts/fleet_recompute_aion.py --verify`
9. Restart sidecar: `systemctl --user start opendeviationbar-sidecar`

## Next Phase Readiness

- Script is ready for deployment and execution on bigblack
- After successful verification (0-gap 0-overlap Stathera), Phase 19 and v7.0 milestone are complete

---

_Phase: 19-fleet-recompute-telemetry_
_Completed: 2026-03-27 (script creation; bigblack execution pending)_
