Skip to content

fix(core-sync): an approval wait stays inside the server's rate limit, and a 429 reads as a wait - #4857

Merged
datlechin merged 4 commits into
mainfrom
fix/sync-rate-limit-wait
Dec 3, 2026
Merged

datlechin merged 4 commits into
mainfrom
fix/sync-rate-limit-wait

Conversation

@datlechin

@datlechin datlechin commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The approval sheets on the Mac and Windows call approval_session every 1.5 s. Each call asked for a full sync pass: GET /sync/scopes plus one pull per scope, every team included. With one team that is 120 calls a minute, the server's per sign-in limit (0051, Rate limits), so a device waiting for approval met 429 rate_limited after about two minutes. Seen on the E2E rig in Check 10 and its retests.
  • A running session's poll now asks for PassReason::ApprovalPoll. That pass reads the scopes body and the personal scope only, where the session's steps and the approval arrive. An idle poll costs 2 calls (80 a minute) whatever the teams.
  • The approval poll resumes no other key flow and sends no team stop report. It leaves the journal, the teams' last pull and the queued counts to the next full pass, and never puts the poll timer off. A wider reason asked at the same time wins in Wake::take.
  • After a 429 the HTTP transport holds every call of the sign-in until Retry-After passes, with the scheduler's 1 h cap. A call inside the hold answers sync.rate_limited with the wait left and sends nothing. Before, only scheduler passes waited, so Sync Now, the upload sheet and the key flows sent into the limit again.
  • Mac: sync.rate_limited and sync.restore_check_unavailable no longer read "TablePro Sync cannot be reached ... once you are online". They now say TablePro Sync asked this Mac to wait. sync.server takes the general "could not finish" wording. Windows already words each code on its own.
  • The server's limits were read, not changed: 120 a minute per sign-in and 600 per account, an httprate sliding window, 429 with Retry-After.

Test plan

  • engine wake::an_approval_poll_runs_only_when_nothing_wider_asked, wake::approval_polls_that_never_stop_do_not_hold_off_the_poll.
  • device_flows approval::a_running_session_s_poll_asks_only_for_the_personal_scope (main records a full PassSoon), approval::an_ended_session_s_poll_asks_for_no_pull.
  • core_engine approval::an_approval_poll_reads_the_scopes_body_and_the_personal_scope_alone, approval::an_approval_poll_sends_no_team_s_stop_report.
  • http::tests::a_429_holds_every_call_of_the_sign_in_until_its_retry_after_passes.
  • ProviderMovesTests serverWaitIsNotOffline, serverErrorIsNotOffline.
  • verify.sh --platform windows --jobs 4 core tablepro-sync: PASS, 1336 cases.
  • cargo clippy --locked -p tablepro-sync -p tablepro-sync-testing -p tablepro-sync-host -p tablepro-ffi --all-targets -- -D warnings: clean.
  • verify.sh --jobs 4 test ProviderMovesTests: PASS, 58 cases.
  • verify.sh lint on both Swift files: 0 violations.

@datlechin
datlechin merged commit 53f84a7 into main Dec 3, 2026
2 of 3 checks passed
@datlechin
datlechin deleted the fix/sync-rate-limit-wait branch December 3, 2026 15:56
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