Skip to content

fix(web): pause data polls while the tab is hidden or offline - #1605

Merged
Makisuo merged 2 commits into
mainfrom
fix/web-visible-polling
Oct 20, 2026
Merged

Makisuo merged 2 commits into
mainfrom
fix/web-visible-polling

fix(web): defer the GitHub force poll's last read until the tab is back

7c61dc7
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Oct 20, 2026 in 1m 50s

Confidence 9/10 · No issues found

🟢 Confidence 9/10 · safe to merge
pollTicks cadence and catch-up are pinned by poll.test.ts; only the githubForcePoll presence wiring is untested.
1 note · tests partial −1 · risk medium

pollTicks replaces every setInterval data poll in the web app with a presence-aware tick, and the GitHub force-poll window now waits for the tab to be back before its last status read. The helper reads sound and is well tested; safe to merge.

  • pollTicks skips ticks while hidden/offline and ticks once on return
  • every in the integrations page now maps pollTicks instead of setInterval
  • githubForcePoll defers its final read and end to whenPresent

Findings

🔵 Note · F1 · githubForcePoll's deferral has no test and cannot be driven

tests · apps/web/src/page/integrations/subscription.ts:279-281

The new window end emits a status read before EndedGithubForcePoll and waits for the tab to be back, but nothing exercises it: the integrations page has scene tests only, no subscription test. whenPresent() here takes the module's browserPresence, so a test cannot make the entry start hidden and assert the read still lands. Give the entry a Presence (as pollTicks accepts) and drive dependenciesToStream with a fake, asserting TickedGithubPoll precedes ended and that nothing is emitted while absent.

Thread a `Presence` into the entry (or test `dependenciesToStream` with a fake presence) and add a subscription test for the hidden-then-visible window end.
What was checked
  • Poll mode joins a read in flight (update-status.ts:55), so the catch-up and force-poll ticks cannot double-fetch
  • whenPresent resolves immediately when present; Stream.succeed + lazily subscribed changes loses no event
  • Drop rule verified by hand for catches 1 s and 8 s before the next tick (poll.test.ts:68, :86)

7c61dc7 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

Annotations

Check notice on line 281 in apps/web/src/page/integrations/subscription.ts

See this annotation in the file changed.

@maple-review-bot maple-review-bot / Maple / review

tests: `githubForcePoll`'s deferral has no test and cannot be driven

The new window end emits a status read before `EndedGithubForcePoll` and waits for the tab to be back, but nothing exercises it: the integrations page has scene tests only, no subscription test. `whenPresent()` here takes the module's `browserPresence`, so a test cannot make the entry start hidden and assert the read still lands. Give the entry a `Presence` (as `pollTicks` accepts) and drive `dependenciesToStream` with a fake, asserting `TickedGithubPoll` precedes `ended` and that nothing is emitted while absent.