Context
DESIGN_REQUIREMENTS §FR-1.2.4 mandates exponential backoff (1s/2s/4s/8s/16s/30s capped) and user notification. ARCHITECTURE §3.1 describes a HealthChecker background task emitting connection_lost events.
Problem
ConnectionTabs.tsx:41-77 calls connect() once per open profile on mount and the error path is catch {} (no surface). Tabs are left in profileId-only state — execute_query later fails with CoreError::NotFound instead of "reconnect attempt failed at startup". ARCHITECTURE's HealthChecker and connection_lost event are never emitted from anywhere.
Files
- src/components/layout/ConnectionTabs.tsx:41-77 (esp. 65-67 catch)
- src-tauri/src/commands/mod.rs (no health-check command)
- docs/design/ARCHITECTURE.md:226-229, §5.7 (planned but unimplemented)
Repro
- Open SQLPilot with a query tab active against MySQL on 13306.
docker stop mysql-test-container for >30s.
- The query tab stays in normal-looking state; any query yields "Connection not found" only when run.
Expected
Within 5s of MySQL going down, the tab turns yellow with "Reconnecting…". Within 30s of MySQL returning, the tab is green and a follow-up query runs cleanly. A toast/info banner explains if reconnect ultimately fails.
Proposed fix
Scope L. Backend: tokio interval task per active connection running SELECT 1, tracking consecutive failure count, emitting a Tauri connection_lost event past a threshold. Frontend: subscribe via listen(), surface "Reconnecting…" per tab badge, run exponential-backoff reconnect loop until success or user abort.
Acceptance
Kill DB-side connection mid-session; within 5s UI shows reconnecting state; DB-up recovery happens within 30s without user action; the named integration test test_auto_reconnect from TESTING_STRATEGY §4 lands.
Needs human verify
Yes.
Context
DESIGN_REQUIREMENTS §FR-1.2.4 mandates exponential backoff (1s/2s/4s/8s/16s/30s capped) and user notification. ARCHITECTURE §3.1 describes a
HealthCheckerbackground task emittingconnection_lostevents.Problem
ConnectionTabs.tsx:41-77callsconnect()once per open profile on mount and the error path iscatch {}(no surface). Tabs are left inprofileId-only state —execute_querylater fails withCoreError::NotFoundinstead of "reconnect attempt failed at startup". ARCHITECTURE'sHealthCheckerandconnection_lostevent are never emitted from anywhere.Files
Repro
docker stop mysql-test-containerfor >30s.Expected
Within 5s of MySQL going down, the tab turns yellow with "Reconnecting…". Within 30s of MySQL returning, the tab is green and a follow-up query runs cleanly. A toast/info banner explains if reconnect ultimately fails.
Proposed fix
Scope L. Backend: tokio interval task per active connection running
SELECT 1, tracking consecutive failure count, emitting a Tauriconnection_lostevent past a threshold. Frontend: subscribe vialisten(), surface "Reconnecting…" per tab badge, run exponential-backoff reconnect loop until success or user abort.Acceptance
Kill DB-side connection mid-session; within 5s UI shows reconnecting state; DB-up recovery happens within 30s without user action; the named integration test
test_auto_reconnectfrom TESTING_STRATEGY §4 lands.Needs human verify
Yes.