• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-flutter / 41832255342 / 5
94%
main: 94%

Build:
DEFAULT BRANCH: main
Ran 04 Nov 2026 12:53PM UTC
Files 4
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Nov 2026 12:46PM UTC coverage: 94.012%. Remained the same
41832255342.5

push

github

web-flow
fix(supabase_auth): keep a refresh that overlaps updateUser (#2122)

## Summary

Every session write bumped the version in `_SessionState`, and
`_doRefresh` discarded its result when the version changed while the
request was in flight. `updateUser` writes the session too, so a refresh
that overlapped it was thrown away after the server had already rotated
the refresh token. The client kept the spent token, and the next refresh
failed or signed the user out.

The version now only changes when a write replaces the stored tokens. A
write that keeps the access and refresh token, such as a user update
(local or broadcast from another tab), leaves it alone. A sign-in, a
sign-out, another session of the same user, or another user still
changes it, so a refresh that overlaps one of those is still discarded.

When a user update lands during a refresh, the refreshed session keeps
the updated user, because the refresh response may have been produced
before the update. It keeps the refreshed user instead when that one has
a later `updated_at`, or belongs to another user. `refreshSession`
returns the session that was stored.

`_refreshForSignOut` carries the updated user the same way. The global
`signOut` now decides whether its session is still the stored one by
comparing tokens instead of object identity, so a user update during the
sign-out no longer leaves this device signed in with a revoked session.

Same fix as supabase/supabase-swift#1640.

## Tests

New `refresh_update_user_race_test.dart`, using `MockSupabaseHttpClient`
to hold the refresh and user update responses:

- A refresh that overlaps `updateUser` stores the rotated tokens with
the updated user and emits `userUpdated` then `tokenRefreshed`, and
`refreshSession` returns that session.
- An `updateUser` that completes after a refresh keeps the rotated
tokens.
- A refresh keeps its own user when it has a later `updated_at`, and
when it belongs to another user.
- A refresh that overlaps a sign-out, a ... (continued)

157 of 167 relevant lines covered (94.01%)

2.54 hits per line

Source Files on job supabase_functions - 41832255342.5
  • Tree
  • List 4
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 41832255342
  • 81cff845 on github
  • Prev Job for on main (#41831877457.12)
  • Next Job for on main (#41836602004.4)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc