feat(#585): retry a failed resync instead of masking it as offline - #642
Conversation
The catch-up status union had no way to represent a resync that fails mid-catch-up, so tabs had no dedicated signal for that outcome. Add a `failed` arm carrying the avatar it failed for, and cover the message creator's generic handling of it.
A resync that failed mid-catch-up only ever broadcast connection-status offline, so the welcome-back modal stuck at "Catching up..." forever with nothing to recover it. Broadcast the new failed ResyncStatus for the avatar instead — connectivity stays the connection layer's own signal, not a resync outcome.
The welcome-back modal had no rendering for the failed catch-up state, so a resync failure left it stuck on the fast-forwarding copy forever with no way out. Render plain copy plus a "Try again" button that re-requests the resync and clears the status, relying on the worker's existing single-flight guard against a redundant retry.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe resync worker now reports failed catch-up through a dedicated status. The welcome-back modal displays failure details, offers retry, sends a new resync request, and dismisses after retry. ChangesResync failure retry
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/src/routes/-game/welcome-back-modal.test.tsx`:
- Around line 77-88: Update the cleanup registered by onTestFinished in this
test to also restore the default or previous idle worker handle after
setIdleWorkerHandle mutates shared state. Keep the existing
setResyncStatus(null) cleanup, ensuring later tests cannot inherit the worker.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 2501587c-352d-46f3-959d-8cb37167d849
📒 Files selected for processing (6)
apps/web/src/routes/-game/welcome-back-modal.test.tsxapps/web/src/routes/-game/welcome-back-modal.tsxlibs/game/idle-client/src/types.tslibs/game/idle-client/src/worker/create-resync-status-message.test.tslibs/game/idle-client/src/worker/handle-request-resync-message.test.tslibs/game/idle-client/src/worker/handle-request-resync-message.ts
The app-web preload registers the zustand create wrapper, so the idle store resets between tests on its own; per AGENTS.md, restoring preload-owned state per test is noise. Removes the pattern from the whole file, pre-existing sites included.
Description
Closes #585
A resync that fails outright now surfaces as its own status instead of masquerading as a connection drop, so the welcome-back modal can offer a retry rather than leaving the tab looking merely offline.
ResyncStatusgains afailedarm carrying the avatar ID it failed forfailedstatus on outright failure instead of a connection-status-offline signal, and drops the now-unused connection-status import/helperTry againbutton that re-sendsRequestResyncover the existing worker handle and clears the status, relying on the worker's single-flight guard instead of client-side debouncingTesting
bun run typecheckpassesbun run testpassesbun run lintpassesContext