Statically ensure that UserTopicVisibilityPolicy.unknown
is not possible in our data models
#1074
Labels
Milestone
This was brought up here: #1041 (comment).
UserTopicVisibilityPolicy.unknown
allows us to deserialize unknown enum values gracefully at the edge.zulip-flutter/lib/model/channel.dart
Lines 216 to 222 in 9e42f26
zulip-flutter/lib/model/channel.dart
Lines 348 to 350 in 9e42f26
However, while we manually declare that it wouldn't be possible that we encounter
UserTopicVisibilityPolicy.unknown
when accessing our internal data store (i.e.:ChannelStore
), our type doesn't agree with that, and require theUserTopicVisibilityPolicy.unknown
case to be handled for an exhaustive switch. We useassert
in such cases, but it is not supposed to be reachable (unless we have a bug).We should make sure that such an assertion is not needed. This might require removing
unknown
fromUserTopicVisibilityPolicy
.We specifically exclude
UserTopicVisibilityPolicy.unknown
at the edge. This may or may not apply to otherunknown
enum values. It would be good to do a sweep of those and decide if we need to follow-up on them as well.The text was updated successfully, but these errors were encountered: