2.6 KiB
2.6 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 01-connection-issue-timing | Connection issue timing | done | 1 | plan.md | ../../specs/ui/requirements/ws-connectivity-warning.md |
Task 01: Connection issue timing
Acceptance
- One transient
ConnectionIssueSeverityin the canonical frontend store remainsnonebefore 3,000 ms offline, becomesunstableat 3,000 ms, and becomeslostat 10,000 ms. - Switching among non-
connectedraw statuses preserves the original interval;connectedclears severity immediately and starts the next outage from a fresh grace period. - The single
useWebSocketlifecycle owns and disposes the timers without changing retry, subscription, queue, or raw status/error behavior.
Verification
cd apps && pnpm --filter @kandev/web test -- lib/ws/connection-issue-monitor.test.ts lib/ws/use-websocket.test.tsx lib/state/store.test.ts
cd apps/web && pnpm run typecheck
Completion report
- Timing/state behavior: the monitor preserves one outage clock, reports
unstableat 3,000 ms andlostat 10,000 ms, clears a visible warning on reconnect or lifecycle disposal, and cancels pre-threshold timers without emitting a redundant state change. - Focused tests: passed — 3 test files and 11 tests.
- Typecheck: passed —
tsc --noEmitcompleted with no errors. - Blockers: none.
- Remaining risk: browser timer throttling can delay a warning, but cannot shorten either grace period or leave a surfaced warning behind after monitor replacement.
Files likely touched
apps/web/lib/types/connection.tsapps/web/lib/state/slices/ui/types.tsapps/web/lib/state/slices/ui/ui-slice.tsapps/web/lib/state/store.tsapps/web/lib/ws/connection-issue-monitor.tsapps/web/lib/ws/connection-issue-monitor.test.tsapps/web/lib/ws/use-websocket.tsxapps/web/lib/ws/use-websocket.test.tsxif direct lifecycle wiring needs a focused boundary testapps/web/lib/state/store.test.ts
Dependencies
None.
Parallelism
Sequential. Every later surface consumes this shared state contract.
Inputs
- Spec:
What,State machine,Failure modes, and the first five scenarios. - Plan:
Frontend > Canonical issue timing. - Existing patterns:
apps/web/lib/ws/use-websocket.tsx,apps/web/lib/state/slices/ui/ui-slice.ts.
Risks
- React remounts or retry status churn must not create multiple clocks.
- Cleanup order must prevent an intentional unmount disconnect from starting a new timer.
Output contract
Report the timing/state behavior, files changed, exact commands and results, blockers/risks, then
mark this task done and update its checkbox in plan.md.