@@ -254,8 +254,6 @@ class Channel(BaseType[ChannelProto, "Channel"]):
254254 bit_field_elements : list [ChannelBitFieldElement ] = Field (default_factory = list )
255255 enum_types : dict [str , int ] = Field (default_factory = dict )
256256 asset_id : str
257- display_description : str
258- display_unit : str
259257 metadata : dict [str , str | float | bool ] = Field (default_factory = dict )
260258 active : bool
261259 created_date : datetime
@@ -284,15 +282,16 @@ def _from_proto(cls, proto: ChannelProto, sift_client: SiftClient | None = None)
284282 id_ = proto .channel_id ,
285283 name = proto .name ,
286284 data_type = ChannelDataType (proto .data_type ),
287- description = proto .description ,
288- unit = proto .unit_id ,
285+ # Prefer the user-set display override, falling back to the canonical
286+ # value set at channel creation. This mirrors how the Sift app resolves
287+ # these (displayDescription || description, displayUnit || unit).
288+ description = proto .display_description or proto .description ,
289+ unit = proto .display_unit_id or proto .unit_id ,
289290 bit_field_elements = [
290291 ChannelBitFieldElement ._from_proto (el ) for el in proto .bit_field_elements
291292 ],
292293 enum_types = cls ._enum_types_from_proto_list (proto .enum_types ), # type: ignore
293294 asset_id = proto .asset_id ,
294- display_description = proto .display_description ,
295- display_unit = proto .display_unit_id ,
296295 metadata = metadata_proto_to_dict (proto .metadata ), # type: ignore
297296 active = proto .active ,
298297 created_date = proto .created_date .ToDatetime (tzinfo = timezone .utc ),
@@ -383,17 +382,27 @@ def runs(self) -> list[Run]:
383382
384383
385384class ChannelUpdate (ModelUpdate [ChannelProto ]):
386- """Model of the Channel fields that can be updated."""
385+ """Model of the Channel fields that can be updated.
387386
388- display_description : str | None = None
389- display_unit : str | None = None
387+ A channel's canonical description and unit are set at creation and are immutable
388+ afterward. Updating ``description`` or ``unit`` writes the channel's display
389+ override (``display_description`` / ``display_unit_id``), which is the value the
390+ Sift app shows in place of the canonical one.
391+ """
392+
393+ description : str | None = None
394+ unit : str | None = None
390395 metadata : dict [str , str | float | bool ] | None = None
391396 active : bool | None = None
392397
393398 _to_proto_helpers : ClassVar [dict [str , MappingHelper ]] = {
394- "display_unit" : MappingHelper (
399+ "description" : MappingHelper (
400+ proto_attr_path = "display_description" ,
401+ update_field = "display_description" ,
402+ ),
403+ "unit" : MappingHelper (
395404 proto_attr_path = "display_unit_id" ,
396- update_field = "display_unit_id " ,
405+ update_field = "display_units " ,
397406 ),
398407 "metadata" : MappingHelper (
399408 proto_attr_path = "metadata" ,
0 commit comments