Skip to content

fix(happy-app): debounce encryption-race message recovery (companion to #701)#4

Closed
cjb0001 wants to merge 1 commit intofix/sync-wedgefrom
fix/ios-encryption-race-on-701
Closed

fix(happy-app): debounce encryption-race message recovery (companion to #701)#4
cjb0001 wants to merge 1 commit intofix/sync-wedgefrom
fix/ios-encryption-race-on-701

Conversation

@cjb0001
Copy link
Owner

@cjb0001 cjb0001 commented Feb 27, 2026

Summary

Companion follow-up to slopus#701: add debounced recovery scheduling for session-encryption race paths so message sync does not repeatedly thrash retries when encryption is temporarily unavailable.

Why this follow-up

slopus#701 already addresses wedge behavior broadly (bounded retries, timeouts, cursor monotonicity, reverse pagination). One remaining edge case is transient session-encryption unavailability during fetch/update handling, which can still trigger repeated immediate invalidations.

This PR adds a tiny, focused recovery debounce to smooth that path.

Changes (on top of slopus#701)

  • Add per-session messageRecoveryTimers map.
  • Add scheduleMessageRecovery(sessionId, delayMs=500) helper.
  • In fetchMessages, when session encryption is missing:
    • schedule a delayed recovery instead of throwing/retrying immediately.
  • In new-message path, when encryption is still missing after session refresh:
    • schedule delayed recovery instead of immediate reinvalidate.
  • Clear recovery timer on delete-session cleanup.

File changed

  • packages/happy-app/sources/sync/sync.ts

Validation

  • corepack yarn --cwd packages/happy-app typecheck

Relationship to slopus#701

@cjb0001
Copy link
Owner Author

cjb0001 commented Feb 27, 2026

Superseded by #1 after retargeting #1 to base fix/sync-wedge and force-updating branch to the same companion commit.

@cjb0001 cjb0001 closed this Feb 27, 2026
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