Skip to content

fix(offline): confirm a dropped connection before going offline - #581

Merged
henry40408 merged 2 commits into
mainfrom
fix/offline-detection-flaky
Oct 7, 2026
Merged

henry40408 merged 2 commits into
mainfrom
fix/offline-detection-flaky

Conversation

@henry40408

@henry40408 henry40408 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Problem

Clicking a sidebar link sometimes flipped the connection lamp to Offline. A single failed fetch (e.g. a swap cut off during navigation, via performSwap) or a browser offline event immediately set data-offline.

Fix

  • offline.js: going offline now requires a retrying probe (2 attempts, 300ms apart, 5s timeout) against /api/offline/manifest to fail too. Any HTTP response counts as reachable.
  • sync()'s failure path, the offline event and networkFailed all use the same confirmation.
  • app.js: awaits networkFailed.
  • e2e: the "every control ... disabled" step now waits for data-offline, since detection is no longer instantaneous.

Notes

  • The flake was not reproduced locally, so this is a fix by cause analysis.
  • A real disconnect is reported ~300ms later than before.
  • offline_reading.feature: 13/13 scenarios pass.

🤖 Generated with Claude Code

A single failed fetch (e.g. a swap cut off while navigating the sidebar)
or an `offline` event flipped the lamp immediately. Now a retrying probe
against the manifest must fail too; any HTTP response counts as reachable.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.18%. Comparing base (cda5833) to head (12f41f9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #581   +/-   ##
=======================================
  Coverage   94.18%   94.18%           
=======================================
  Files          94       94           
  Lines       26856    26856           
=======================================
  Hits        25293    25293           
  Misses       1563     1563           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Concurrent confirmations now share one in-flight probe, sync() counts
its own failed manifest fetch as the first attempt, and the per-probe
timeout drops from 5s to 2s.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@henry40408
henry40408 merged commit 670f709 into main Oct 7, 2026
9 checks passed
@henry40408
henry40408 deleted the fix/offline-detection-flaky branch October 7, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant