fix: map unrecognized enum values to a known "unknown" member - #3
Conversation
Enumerated state fields (speaker_state, stream_quality) previously stored any unrecognized device value verbatim (lowercased), so consumers that declare fixed options up front could receive an out-of-set value. Because _set_state_value skips None, returning None would have left a stale prior value in place, so unrecognized values are now mapped to the in-set "unknown" member instead. A stored enum value is therefore always a member of its set (or None only when the device omitted the field), and consumers no longer need to clamp the value themselves.
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a module-level ChangesUnknown enum value handling
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)Not applicable — the change is a localized normalization/logic refactor within a single module without multi-component interaction flows. Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above. Comment |
Enumerated state fields (speaker_state, stream_quality) previously stored any unrecognized device value verbatim (lowercased), so consumers that declare fixed options up front could receive an out-of-set value. Because _set_state_value skips None, returning None would have left a stale prior value in place, so unrecognized values are now mapped to the in-set "unknown" member instead. A stored enum value is therefore always a member of its set (or None only when the device omitted the field), and consumers no longer need to clamp the value themselves.
Summary by CodeRabbit