Skip to content

Surface newer server disconnect reasons as distinct DisconnectReason values - #1157

Closed
hiroshihorie wants to merge 1 commit into
hiroshi/degradation-preference-disabled-crashfrom
hiroshi/disconnect-reason-members
Closed

Surface newer server disconnect reasons as distinct DisconnectReason values#1157
hiroshihorie wants to merge 1 commit into
hiroshi/degradation-preference-disabled-crashfrom
hiroshi/disconnect-reason-members

Conversation

@hiroshihorie

Copy link
Copy Markdown
Member

Stacked on #1156, review that first. Only the last commit (87a9753) is new here.

The protocol defines 17 disconnect reasons but the public DisconnectReason enum only had members for 8 of them, so newer reasons arriving in a leave request (for example when the server closes a room or a SIP trunk fails) were all collapsed to unknown. This adds members for the nine missing reasons and maps them in toSDKType:

migration, signalClose, roomClosed, userUnavailable, userRejected, sipTrunkFailure, connectionTimeout, mediaFailure, agentError

Unrecognized values from servers newer than the SDK still fall back to unknown via the wildcard arm introduced in #1156.

Note for apps: adding enum members means an exhaustive switch over DisconnectReason in app code will need new cases, which is why the changeset is minor.

Tests

New test/types/disconnect_reason_test.dart asserts every proto value maps to a distinct SDK value and pins the nine new mappings. Full suite passes (380 tests), analyze, format, and import sorter clean.

🤖 Generated with Claude Code

…values

The protocol defines nine disconnect reasons the public enum had no
members for, so they were all reported as unknown. Add members for them
and map them in toSDKType.
@hiroshihorie
hiroshihorie deleted the branch hiroshi/degradation-preference-disabled-crash August 7, 2026 11:26
hiroshihorie added a commit that referenced this pull request Aug 8, 2026
…values (#1158)

Follow-up to #1156 (replaces #1157, which GitHub auto-closed when the
stack base merged).

The protocol defines 17 disconnect reasons but the public
`DisconnectReason` enum only had members for 8 of them, so newer reasons
arriving in a leave request (for example when the server closes a room
or a SIP trunk fails) were all collapsed to `unknown`. This adds members
for the nine missing reasons and maps them in `toSDKType`:

`migration`, `signalClose`, `roomClosed`, `userUnavailable`,
`userRejected`, `sipTrunkFailure`, `connectionTimeout`, `mediaFailure`,
`agentError`

Unrecognized values from servers newer than the SDK still fall back to
`unknown` via the wildcard arm introduced in #1156.

Note for apps: adding enum members means an exhaustive `switch` over
`DisconnectReason` in app code will need new cases, which is why the
changeset is `minor`.

## Tests

New `test/types/disconnect_reason_test.dart` asserts every proto value
maps to a distinct SDK value and pins the nine new mappings. Full suite
passes (380 tests), analyze, format, and import sorter clean.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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