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

supabase / supabase-flutter / 31805117378
89%

Build:
DEFAULT BRANCH: main
Ran 14 Aug 2026 01:33PM UTC
Jobs 9
Files 104
Run time 1min
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

14 Aug 2026 01:31PM UTC coverage: 87.979%. Remained the same
31805117378

push

github

web-flow
fix(auth): parse expires_in as num in Session.fromJson (#1716)

## What

Fixes an issue where `Session.fromJson` threw a runtime `TypeError` on
Web when compiled with WebAssembly (`flutter build web --wasm`) during
cross-tab authentication synchronization.

Resolves #1687

---

## Root Cause Analysis

In `packages/supabase_auth/lib/src/types/session.dart`,
`Session.fromJson` previously cast `json['expires_in']` directly to
`int?`:

```dart
expiresIn: json['expires_in'] as int?,
```

While JSON parsed by Dart's native `dart:convert` `jsonDecode`
deserializes integer literals as `int`, `Session.fromJson` is also
invoked directly with map payloads from JavaScript interop in
`AuthClient._mayStartBroadcastChannel` (via `broadcast_web.dart`):

```dart
if (messageEvent['session'] != null) {
  session = Session.fromJson(messageEvent['session']);
}
```

In Dart JS-interop (`dartify()`), all JavaScript numbers cross the
boundary as `double` values (e.g. `3600.0`).

- **Under `dart2js`:** Dart integers and doubles share an underlying
JavaScript `Number` representation at runtime, so `3600.0 as int?`
succeeded without throwing.
- **Under `dart2wasm` & Dart VM:** `int` and `double` are distinct
runtime types. Attempting to cast `3600.0 as int?` results in a runtime
error:
  ```
  TypeError: type 'double' is not a subtype of type 'int?' in type cast
  ```

Because this exception occurred inside the `BroadcastChannel`
`onMessage` event listener (outside the initial channel setup
`try/catch` guard), all remaining operations in the listener were
aborted:
- `_saveSession(session)` / `_removeSession()` was skipped.
- `notifyAllSubscribers(event, session: session, broadcast: false)` was
skipped.

Consequently, receiving browser tabs silently failed to synchronize
session state (login, logout, token refresh), causing unexpected
sign-outs or stale tokens when switching between tabs.

---

## Changes

### 1. `Session.fromJson`
In
[`packages/supabase_auth/lib/src/types/sessi... (continued)

7 of 7 new or added lines in 3 files covered. (100.0%)

5716 of 6497 relevant lines covered (87.98%)

4.09 hits per line

Jobs
ID Job ID Ran Files Coverage
7 supabase_auth - 31805117378.7 14 Aug 2026 01:36PM UTC 27
88.91
GitHub Action Run
8 supabase_flutter - 31805117378.8 14 Aug 2026 01:33PM UTC 10
81.41
GitHub Action Run
9 supabase - 31805117378.9 14 Aug 2026 01:37PM UTC 13
87.19
GitHub Action Run
8 postgrest - 31804163356.8 14 Aug 2026 01:23PM UTC 10
85.46
GitHub Action Run
9 realtime_client - 31804163356.9 14 Aug 2026 01:24PM UTC 11
90.51
GitHub Action Run
6 functions_client - 31804163356.6 14 Aug 2026 01:21PM UTC 3
97.75
GitHub Action Run
4 supabase_common - 31804163356.4 14 Aug 2026 01:21PM UTC 16
99.48
GitHub Action Run
5 storage_client - 31804163356.5 14 Aug 2026 01:23PM UTC 13
85.03
GitHub Action Run
4 yet_another_json_isolate - 31785069647.4 14 Aug 2026 08:44AM UTC 1
94.44
GitHub Action Run
Source Files on build 31805117378
  • Tree
  • List 104
  • Changed 27
  • Source Changed 27
  • Coverage Changed 7
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #31805117378
  • a0be8277 on github
  • Prev Build on main (#31804163356)
  • Next Build on main (#32009240063)
  • 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