Skip to content

feat(connection): recover sooner after a failed wake fetch - #3736

Open
setchy wants to merge 1 commit into
mainfrom
feat/smooth-connection-recovery
Open

setchy wants to merge 1 commit into
mainfrom
feat/smooth-connection-recovery

Conversation

@setchy

@setchy setchy commented Nov 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a bounded, session-local recovery window that starts on system wake or an offline-to-online transition — including a wake where navigator.onLine never changed, so TanStack never sees a reconnect.
  • While recovering and the latest notification fetch is a retryable all-account connection failure, retries every 5s for up to 30s instead of waiting for the normal poll.
  • Keeps the merged fix(notifications): treat offline as a connection state, not an error #3706 status model: recovery presents as loading, so the tray never shows the red error icon while a retry is pending. Recovery ends on a clean or partial success, a definitive failure, or window expiry; normal polling and a settled error presentation then resume.

Why

Resume/unlock can refetch before Wi-Fi/DNS has reconverged. If navigator.onLine is already true, no reconnect event fires and the existing one-shot in-flight reconnect retry never runs. The failed wake fetch was presented as error, leaving the tray red until the next 60s poll.

What changed

  • useConnectionStore + useConnectionRecovery: session-local recovery window, wake/online entry, bounded settle.
  • useNotificationsQuery: combines the store with the merged reconnectedAt hold; refetchInterval uses the short recovery cadence for retryable all-account failures.
  • recovery.ts + pollInterval.ts: forge-neutral retryable classification and interval computation.
  • Exposes isPaused, isError, and dataUpdatedAt through the notification state.
  • Updates ARCHITECTURE.md and adds store/hook/classification/cadence/integration tests.

Verification

  • pnpm check
  • pnpm lint:check
  • pnpm test — 2,300 tests passed (222 files)
  • New tests cover wake failure → loading + 5s retry → success, and window expiry → error.

Manual verification (pending)

  • Suspend offline, then reconnect: no red error icon.
  • Wake with the first fetch failing: loading until a retry succeeds or the 30s window expires.
  • Open the notifications window during recovery: loading, no error screen.

OpenSpec change: smooth-connection-recovery (store gitify-specs). Baseline: #3706.

Add a bounded, session-local recovery window that starts on system wake or
an offline-to-online transition, including a wake where navigator.onLine
never changed. While the window is open and the latest notification fetch
is a retryable all-account connection failure, retry on a short cadence
instead of waiting for the normal poll.

Recovery keeps the merged paused/loading status model: stale failures are
presented as loading, so the tray does not flash the error icon while a
retry is pending. Recovery ends on a clean or partial success, a
definitive failure, or window expiry, then normal polling and any settled
failure presentation resume.

Tests cover the store, recovery hook, retry classification, poll cadence,
the wake-failure retry path, and bounded expiry.
@github-actions github-actions Bot added the enhancement New feature or enhancement to existing functionality label Nov 27, 2026
@sonarqubecloud

Copy link
Copy Markdown

@setchy
setchy marked this pull request as ready for review November 27, 2026 16:36
@setchy
setchy requested a review from afonsojramos as a code owner November 27, 2026 16:36

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or enhancement to existing functionality

Development

Successfully merging this pull request may close these issues.

1 participant