Skip to content

fix(web): say when the cold-load verifier download is offline or stalled - #755

Merged
PastaPastaPasta merged 5 commits into
masterfrom
ux/cold-load-offline
Nov 26, 2026
Merged

PastaPastaPasta merged 5 commits into
masterfrom
ux/cold-load-offline

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Problem

The mainnet QA pass (docs/launch/mainnet-qa-2026-11-24.md, rows "Cold load, Fast/Slow 3G" and "Offline mid-session") found that a first visit on a bad link gave no useful message. That visit has to download the 26.5 MB Platform verifier (9.0 MB gzipped) before anything can be read. Measured on the live testnet site before this change:

  • Offline when the page loads: for the first seconds the repo list was bare skeletons with no text. Then "Can't reach Dash Platform right now", with a countdown that kept retrying into the dead network. Back online, nothing happened until the countdown ran out: in the test that took 37 s.
  • Connection lost during the download: the bar was replaced by "Can't reach the quorum key service right now". That blamed a third-party service. After about 2.5 minutes it said "It stopped retrying on its own … pick another quorum service in Settings", which is the wrong fix.
  • A download that receives nothing: the bar froze silently for 60 s, until the stall timer gave up. If it kept failing, the result was "Can't reach Dash Platform".
  • Slow 3G: the bar moves honestly, and 26.5 MB takes about 200 s. No change was needed here.

Fix

  • Download view (DownloadProgressBar): one plain line in place of "Once per browser: it is cached after this.":
    • Offline: "You're offline. The download starts again when you're back."
    • No new bytes for 15 s: "The download has stalled. Check your connection. It starts again by itself."
  • Download (wasm-fetch.ts): still fails fast (two quick retries), so sign-in and the other callers that share it behave as before. Zero bytes are now reported when the request starts, so a server that never answers still shows the view. Before, that report arrived before the service recorded its connect and was dropped (showsProgress now looks only at the phase).
  • Connect banner: offline, it says "You're offline / This page loads as soon as your connection is back.", with no countdown and one "Try again". If the verifier itself failed to download, the banner says "The Platform verifier didn't download" instead of "Can't reach Dash Platform".
  • Service: coming back online reconnects at once, even with a countdown pending. While offline, no retry timer is scheduled and a failure spends no automatic retry, and views still re-read once after the outage.
  • A 4xx for the hashed verifier (a deploy since the page loaded): "The Platform verifier didn't download / This site was updated since the page loaded. Reload the page."

What a user sees now (390 px screenshots, light theme)

  • Offline at cold load: for the first seconds the download view says "You're offline. The download starts again when you're back.", then the banner says "You're offline / This page will load as soon as your connection is back." with no countdown and one Try again. Back online, the download starts within a second and the page connects without a reload.
  • Connection cut at 20%: the same offline lines. Back online, the download starts again from 0% (GitHub Pages offers no resumable gzip ranges) and the page connects.
  • Link frozen at 20%: after 15 s the line reads "The download has stalled. Check your connection. It starts again by itself." At 60 s it starts again by itself and the page connects.
  • Slow 3G (50 KB/s, 2 s latency): unchanged. The bar advances and the page connects at 212 s. In about 200 one-second samples the stall or offline note never appeared.

Compatibility and data

This changes UI and retry timing only. It touches no stored data, browser storage, contract, write path, verifier binary, or verify-app manifest, so there is no data-loss risk. With the browser online, the only differences are the new copy branches and the connect retrying the moment an online event fires. Sign-in and the other callers of the shared download behave as before: offline, they fail in about 4 s with their existing "check your connection" copy.

Verifier size (no change made)

  • npm @dashevo/[email protected] wasm_sdk_bg.wasm: 26,513,399 B raw, 8,938,745 B with gzip -9. Code is 22.4 MB, data 3.86 MB, and there are no name or debug sections.
  • wasm-opt -Oz (binaryen 129): 26,490,999 B raw (−0.08%) and 8,907,359 B gzipped (−0.35%, 31 KB). The published file is already optimized, so a re-opt is not worth changing a trusted binary.
  • The remaining levers need a product call: Brotli would need a host other than GitHub Pages (or the IPFS gateway path), and splitting the SDK is upstream work in wasm-sdk.

Tests

  • New e2e e2e/cold-load-offline.spec.ts, testnet build on a boat.dev large sandbox, 4/4 (--repeat-each 2) after the review follow-ups:
    • cl-1: context.setOffline plus an aborted .wasm request gives "You're offline" with no "Can't reach" and no countdown. Back online, the page connects (sdkGeneration > 0) with no reload.
    • cl-2: a .wasm route that never answers shows the bar, then the stalled note, then the automatic retry connects.
  • Manual probes on the same build, through a throttled proxy that resets or freezes the .wasm at 20%, plus a Slow 3G run. Results are in "What a user sees now".
  • Unit tests:
    • wasm-fetch.test.ts: offline still fails fast, and zero bytes before headers.
    • service.test.ts: no timer while offline, no retry spent while offline, the immediate retry on online, one re-read after an offline outage, and progress shown while the connect is starting.
    • platform-failure.test.ts and failure-states.test.tsx: the copy, the offline banner, and the stall timer.
  • tsc --noEmit, eslint and pnpm lint:copy are clean. The full vitest run passes except the 2 lib/merge/xdiff.parity.test.ts cases, which fail locally on git 2.53 and are untouched by this PR.

New behaviour to note: while the browser reports itself offline, the connect runs no countdown timer (master kept one). It retries on the browser's online event, or on Try again.

Two independent reviews approved it with suggestions, and every suggestion is applied (04b68e0, 300480b). The first review's fixes, in 04b68e0: the medium finding (offline callers hanging up to 5 minutes), the false stall line after reconnecting, the 4xx copy, offline failures spending retries, and the e2e assertion.

🤖 Generated with Claude Code

PastaPastaPasta and others added 2 commits November 26, 2026 15:30
On a first visit the app downloads the 26.5 MB Platform verifier (9 MB
gzipped) before it can read anything. Offline, the page showed bare
skeletons, then blamed Dash Platform or the quorum key service and counted
down retries into a dead network; back online it still waited out the
countdown, and after a few tries it stopped and pointed at Settings.

- The download view says "You're offline. The download starts again when
  you're back." or, after 15 s with no bytes, that the download stalled.
- An offline download failure waits for the browser to come back online
  and starts again, without spending a retry.
- The connect banner says "You're offline" with no countdown, and a failed
  verifier download is named as such instead of "Can't reach Dash Platform".
- Back online reconnects at once instead of at the end of the countdown.

UI and retry timing only: no stored data, contracts or verifier bytes change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…follow-ups

- The download reported zero bytes before the service recorded its
  connect, so a server that never answered left bare skeletons for 60 s and
  the stall note never showed. The phase alone now decides.
- The offline wait also retries after 30 s, in case a browser wrongly
  reports itself offline.
- A body that is not wasm keeps its CompileError instead of reading as a
  failed download.
- Copy: no semicolon in the stall note, a shorter failed-download body.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f40de455-280f-40e6-986c-677723cff12e
Commits

Reviewing files that changed from the base of the PR and between 50b6015 and a12f679.

Files selected for processing: 10

  • forge-web/components/ui/failure-states.test.tsx
  • forge-web/components/ui/platform-status.tsx
  • forge-web/e2e/cold-load-offline.spec.ts
  • forge-web/lib/sdk/service.test.ts
  • forge-web/lib/sdk/service.ts
  • forge-web/lib/sdk/unreachable.ts
  • forge-web/lib/sdk/wasm-fetch.test.ts
  • forge-web/lib/sdk/wasm-fetch.ts
  • forge-web/lib/view/platform-failure.test.ts
  • forge-web/lib/view/platform-failure.ts

No actionable comments were generated in the recent review.

Walkthrough

The verifier download now reports initial progress, waits for connectivity after eligible offline failures, and resumes retries. SDK connection retries respond to online events. The UI distinguishes offline, stalled-download, and connection-failure states. Tests cover these states and recovery without reloading the page.

Changes: Offline verifier download recovery

Layer / File(s) Summary
Verifier download and retry
forge-web/lib/sdk/wasm-fetch.ts, forge-web/lib/sdk/unreachable.ts, forge-web/lib/sdk/wasm-fetch.test.ts
The fetch options support an online callback. Downloads report initial and retained progress, wait for connectivity after eligible offline failures, and classify download failures. Tests cover offline recovery, configured retries, and stalled requests.
SDK retry and progress state
forge-web/lib/sdk/service.ts, forge-web/lib/sdk/service.test.ts
The SDK leaves retries unscheduled while offline and reconnects when an online event occurs, including during a retry countdown. Progress is visible during connection startup. Tests cover these states.
Failure messaging and recovery validation
forge-web/lib/view/platform-failure.ts, forge-web/lib/view/platform-failure.test.ts, forge-web/components/ui/platform-status.tsx, forge-web/components/ui/failure-states.test.tsx, forge-web/e2e/cold-load-offline.spec.ts
The UI distinguishes offline and stalled downloads from connection failures. Component tests cover the messages and progress states. Browser tests cover recovery after offline and stalled cold loads.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant EvoSdkService
  participant FetchWasm
  Browser->>EvoSdkService: Emit online event
  EvoSdkService->>FetchWasm: Resume verifier download
  FetchWasm-->>EvoSdkService: Return download progress and result
  EvoSdkService-->>Browser: Update connection state
Loading
Merge Risk: Minimal · previous review 50b60

This change adds clearer offline and stalled-download messaging and automatic recovery for the verifier download. No merge-blocking risk was identified in the supplied material.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description is thorough and follows the spirit of the template, but it does not use the required headings. It has no '## What and why' or '## How it was tested' heading, and the existing content i… Restructure the description under the template headings '## What and why' and '## How it was tested'. In 'How it was tested', state whether make check-web passed and whether make check-rust was run, since the change is web-only. Mark or…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: cold-load verifier download messaging for offline and stalled states. It matches the raw summary, which covers the offline and stall copy, retry behavior, and connect …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: cold-load verifier download messaging for offline and stalled states. It matches the raw summary, which covers the offline and stall copy, retry behavior, and connect banner. The title uses the conventional fix(web) prefix, is one sentence, and is specific enough for a reviewer scanning history.

Full details: Description check

Explanation

The description is thorough and follows the spirit of the template, but it does not use the required headings. It has no '## What and why' or '## How it was tested' heading, and the existing content is in a different structure. The checklist items from the template are not addressed. Specifically: make check-rust and make check-web are not mentioned (the author reports tsc, eslint, pnpm lint:copy and vitest, but not the make targets). The rule-vector checkbox is not addressed, though this PR changes no rules, so it is arguably not applicable but should be stated. The docs/guides checkbox is not addressed; the PR changes user-visible copy, so it is unclear whether docs/guides need updates. The screenshots section has text descriptions of 390 px light-theme results, but no actual before/after images and nothing for the dark theme. The description covers the problem, fix, tests, and compatibility well, so the gaps are in template conformance rather than content.

Resolution

Restructure the description under the template headings '## What and why' and '## How it was tested'. In 'How it was tested', state whether make check-web passed and whether make check-rust was run, since the change is web-only. Mark or explain the rule-vector item as not applicable. Confirm whether docs/guides needs updates for the user-visible copy changes, or state why not. Under '## Screenshots', attach before and after images at 390 px in both light and dark themes, or remove the section with a note if it is not required. Link the issue if one exists.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f3a21f7e-6315-4e39-adb7-ff6a25a5e435
Commits

Reviewing files that changed from the base of the PR and between cc5c7fa and 50b6015.

Files selected for processing: 10

  • forge-web/components/ui/failure-states.test.tsx
  • forge-web/components/ui/platform-status.tsx
  • forge-web/e2e/cold-load-offline.spec.ts
  • forge-web/lib/sdk/service.test.ts
  • forge-web/lib/sdk/service.ts
  • forge-web/lib/sdk/unreachable.ts
  • forge-web/lib/sdk/wasm-fetch.test.ts
  • forge-web/lib/sdk/wasm-fetch.ts
  • forge-web/lib/view/platform-failure.test.ts
  • forge-web/lib/view/platform-failure.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

PastaPastaPasta and others added 3 commits November 26, 2026 16:30
Review follow-ups. The verifier download waited inside its own fetch
while the browser was offline, so every caller of the shared download
(sign-in, phrase derivation, top-up) hung until its own 5 minute limit
with copy that blamed a slow link, where it used to fail in about 4 s
with "check your connection". The download fails fast again; the
connect already holds no countdown while offline and reconnects on
`online`, and offline failures now spend no automatic retry. Views
still re-read once after such an outage.

Also: the stall line no longer shows the moment the browser is back
online, a 4xx for the verifier says to reload the page, the two
offline lines read the same, and the e2e asserts the download view or
the banner rather than any "You're offline" text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nner

Review follow-ups: the retry and the failure copy share one predicate
for a client-error download, so 408 and 429 keep the connection advice;
cl-1 waits for the banner's offline state, not only the download note,
before checking that nothing is blamed and no countdown runs; the
first online failure after offline ones waits the first backoff step.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@PastaPastaPasta
PastaPastaPasta merged commit 961104d into master Nov 26, 2026
21 checks passed
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