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

supabase / supabase-swift / 35162080492
96%

Build:
DEFAULT BRANCH: main
Ran 16 Sep 2026 11:26PM UTC
Jobs 1
Files 133
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

16 Sep 2026 11:23PM UTC coverage: 89.084% (+0.6%) from 88.493%
35162080492

push

github

web-flow
refactor(realtime): split onMessage into per-event handlers (#1359)

`RealtimeChannelV2.onMessage(_:)` was the highest-CRAP function in the
SDK: 29 branches with 44.4% coverage, scoring 173.9. It is the single
entry point for every server frame a channel receives, so a regression
there silently breaks postgres changes, presence, or broadcast
delivery — and restructuring 29 untested branches is how that ships.

So the tests come first. RealtimeChannelOnMessageTests covers one case
per branch, including the paths that swallow a decoding error and the
ones that deliberately do nothing. All 27 passed against the
unmodified function, so they pin the behaviour that exists rather than
the behaviour we'd like. Two of them are worth knowing: `system.ok`
alone does not subscribe a channel (didReceiveSubscribedOK only
promotes one already in `.subscribing`), and `phx_error` closes the
channel without removing it from the socket, which only `phx_close`
does.

The refactor then splits the 130-line switch into a thin dispatcher
plus eight `handle*` methods, with the AnyAction mapping pulled out as
a pure static function. Every extracted piece is CC <= 9 at 100%
coverage. The single do/catch stays on the dispatcher, so the
swallow-and-log behaviour is unchanged.

onMessage lands at CRAP 11, just above the usual "under 10" target.
The rest is an irreducible 8-way dispatch (base, guard, eight cases,
catch); shaving it further would need a closure lookup table, which
reads worse than the switch.

Fixes SDK-1869

Co-authored-by: Claude <noreply@anthropic.com>

125 of 126 new or added lines in 1 file covered. (99.21%)

10601 of 11900 relevant lines covered (89.08%)

722044.64 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
79.43
10.31% Sources/RealtimeV2/RealtimeChannelV2.swift
Jobs
ID Job ID Ran Files Coverage
1 35162080492.1 16 Sep 2026 11:26PM UTC 133
89.08
GitHub Action Run
Source Files on build 35162080492
  • Tree
  • List 133
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #35162080492
  • a4e95cbd on github
  • Prev Build on main (#35083288060)
  • Next Build on main (#35205236753)
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