Skip to content

fix: don't reject leaveProject when post-leave sync propagation stalls#1276

Open
gmaclennan wants to merge 3 commits into
mainfrom
fix/leave-project-timeout
Open

fix: don't reject leaveProject when post-leave sync propagation stalls#1276
gmaclennan wants to merge 3 commits into
mainfrom
fix/leave-project-timeout

Conversation

@gmaclennan

Copy link
Copy Markdown
Member

leaveProject performs the local leave (assign LEFT + clear data) and then awaits a trailing waitForSync('initial', { timeoutMs: 45s }) to propagate the LEFT role to connected peers. That wait was awaited unconditionally, so when a peer is connected but presync can't complete within 45s — a slow/flaky link, or the user moving out of range right as they leave — leaveProject rejected with Error('Sync timeout') even though the device had already left locally. This is the intermittent "Sync timeout" error users have hit leaving projects.

Make the propagation best-effort: the local leave has already succeeded and the LEFT role (persisted to the auth namespace) also propagates on the next connection, so a stalled propagation must not fail the operation.

Adds a regression test (test-e2e/sync-leave-regression.js) plus a controllable transport test helper (test-e2e/controllable-wire.js) that drives two real projects over a pause-able wire to deterministically reproduce a connected-but- stalled peer.

leaveProject performs the local leave (assign LEFT + clear data) and then
awaits a trailing waitForSync('initial', { timeoutMs: 45s }) to propagate the
LEFT role to connected peers. That wait was awaited unconditionally, so when a
peer is connected but presync can't complete within 45s — a slow/flaky link, or
the user moving out of range right as they leave — leaveProject rejected with
Error('Sync timeout') even though the device had already left locally. This is
the intermittent "Sync timeout" error users have hit leaving projects.

Make the propagation best-effort: the local leave has already succeeded and the
LEFT role (persisted to the auth namespace) also propagates on the next
connection, so a stalled propagation must not fail the operation.

Adds a regression test (test-e2e/sync-leave-regression.js) plus a controllable
transport test helper (test-e2e/controllable-wire.js) that drives two real
projects over a pause-able wire to deterministically reproduce a connected-but-
stalled peer.
@gmaclennan gmaclennan self-assigned this Jun 6, 2026
@gmaclennan gmaclennan enabled auto-merge (squash) June 11, 2026 15:41
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