Skip to content

fix(cli): catch up on the missed reload when a skipped client responds again - #1003

Open
lewinpauli wants to merge 3 commits into
schultek:mainfrom
lewinpauli:fix/catch-up-unresponsive-client
Open

lewinpauli wants to merge 3 commits into
schultek:mainfrom
lewinpauli:fix/catch-up-unresponsive-client

Conversation

@lewinpauli

@lewinpauli lewinpauli commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #980.

Description

Since #980, jaspr serve skips a browser that doesn't answer a reload within 10 seconds. When the browser answers again, only changed stylesheets are delivered. The rest of the reload is not, and the log says "it may show outdated content until the next reload".

For a tab in the background this means it never gets up to date: the browser throttles it, so the next reload times out as well. I ran into this with Chrome covered by the editor. Every save logged "did not respond", and the tab kept showing the old state after I switched to it.

This PR

  • A client that is skipped or times out remembers the update it missed (reload, restart or refresh; the most extensive one wins).
  • When it responds again, that update is applied to this client right away, followed by the missed stylesheets.
  • The catch-up runs without the call timeout. A slow client would otherwise time out again and never finish. Updates that arrive in the meantime skip the client and are applied afterwards, so nothing waits for it.
  • A refresh that timed out is not repeated, because the page reloads once the call gets through.
  • If the catch-up fails, the update stays missed and is included in the next regular update. It is not retried in a loop.
  • The per-client steps moved from DevWorkflow into ClientConnection.update, so the regular update and the catch-up share them.

Tests (dev_workflow_test.dart)

  • reload/restart/refresh skips a browser that stops responding now also expects the catch-up. Fails without the fix.
  • reload/restart is repeated for a browser that responds again after it timed out. Fails without the fix.
  • refresh is not repeated for a browser that responds again after it timed out. Fails if a timed out refresh is marked as missed.
  • catches up with the most extensive update a browser missed. Fails if the last missed update wins.
  • includes an update the catch-up could not apply in the next update. Fails if a failed catch-up drops the update.
  • catches up a browser that responds slower than the timeout. Fails if the catch-up uses the call timeout.
  • updates skip a browser that is catching up and are applied afterwards. Fails if updates don't skip a client that is catching up.

Not tested in a real browser, only with the fakes of the test suite.

The red Test CLI jobs with Flutter (cnen, cspn, smpn, snpn, vnen) are not caused by this PR. They fail on main since the CI picked up Flutter 3.50 (#999), the fix is in #1000.

Type of Change

  • 🛠️ Bug fix

Ready Checklist

  • I've read the Contribution Guide.
  • In case this PR changes one of the core packages, I've modified the respective CHANGELOG.md file using
    the semantic_changelog format.
  • I updated/added relevant documentation (doc comments with ///).
  • I added myself to the AUTHORS file (optional, if you want to).

@lewinpauli
lewinpauli requested a review from schultek as a code owner November 17, 2026 13:31
Copilot AI balanced review requested due to automatic review settings November 17, 2026 13:31
@github-actions

Copy link
Copy Markdown

Package Version Report

The following packages have been updated:
jaspr_test : 0.24.0-beta.1 -> 0.24.0-beta.2
jaspr : 0.24.0-beta.1 -> 0.24.0-beta.2
jaspr_builder : 0.24.0-beta.1 -> 0.24.0-beta.2
jaspr_cli : 0.24.0-beta.1 -> 0.24.0-beta.2

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The catch-up path clears the missed action before successful application, so a failed restart can be lost and followed by only a reload instead of being preserved for retry.

1 open issue
What changed in this PR

This follow-up to #980 adds catch-up updates for browsers skipped by jaspr serve, so recovering clients receive missed changes without blocking other clients.

Changes:

  • Tracks the most extensive missed update and applies it without a timeout, followed by pending stylesheets.
  • Centralizes per-client update steps in ClientConnection.update.
  • Adds regression tests for recovery, slow clients, update priority, and updates queued during catch-up.
File Description
packages/​jaspr/​CHANGELOG.md Documents automatic catch-up for skipped browsers.
packages/​jaspr_cli/​test/​src/​dev/​dev_workflow_test.dart Adds and extends catch-up regression tests.
packages/​jaspr_cli/​lib/​src/​dev/​dev_workflow.dart Delegates per-client updates to ClientConnection.update.
packages/​jaspr_cli/​lib/​src/​dev/​client_manager.dart Tracks missed updates and implements per-client catch-up.

Review effort: Balanced

Comment on lines +296 to +297
_missedUpdate = null;
await _apply(update, _unguarded);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in "keep an update the catch-up could not apply for the next update". If the catch-up fails or throws, the update stays missed and the next regular update includes it, so a missed restart is no longer replaced by a reload. There is no retry loop: the next attempt only happens with the next update, or when the client becomes responsive again.

Added a regression test (includes an update the catch-up could not apply in the next update). It fails without keeping the update and without merging it into the next update.

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.

2 participants