fix: Handle unknown LifeSpan types gracefully in GetLifeSpan command - #1645
Open
L-pin wants to merge 5 commits into
Open
fix: Handle unknown LifeSpan types gracefully in GetLifeSpan command#1645L-pin wants to merge 5 commits into
L-pin wants to merge 5 commits into
Conversation
edenhaus
requested changes
Aug 1, 2026
| try: | ||
| component_type = LifeSpan(component["type"]) | ||
| except ValueError: | ||
| _LOGGER.debug( |
Member
There was a problem hiding this comment.
Suggested change
| _LOGGER.debug( | |
| _LOGGER.warning( |
Maybe we should just log it once and not for each one
| STATION_FILTER = "spHeap", "SpHeap" | ||
| WATER_SINK = "waterSink", "WaterSink" | ||
| MOP_WASHING_TRAY = "mopWashingTray", "mopWashingTray" | ||
| DUST_BUCKET = "dustBucket", "DustBucket" |
edenhaus
marked this pull request as draft
August 1, 2026 14:15
- Log all unknown LifeSpan types once per response instead of per item - Sort LifeSpan enum members alphabetically
Contributor
Author
|
@edenhaus I've addressed both points: life_span.py: Refactored to collect all unknown types during the loop and emit a single debug log at the end, rather than logging once per unknown component. |
Keep alphabetically-sorted enum order from PR branch, add TRIMMER_BRUSH and WEED_ROPE (from dev) at their correct alphabetical positions.
L-pin
marked this pull request as ready for review
August 1, 2026 16:19
added 2 commits
August 2, 2026 00:21
- Wrap HEAVY_DUTY_CLEANING_SOLUTION tuple to multi-line (line too long) - Remove extra blank line at end of LifeSpan enum - Wrap long get_success_body call in test_life_span.py
ruff check requires all imports at module top-level, not inside functions.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1645 +/- ##
=======================================
Coverage 96.30% 96.31%
=======================================
Files 161 161
Lines 6393 6402 +9
Branches 366 367 +1
=======================================
+ Hits 6157 6166 +9
Misses 170 170
Partials 66 66 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a device returns a
getLifeSpanresponse containing atypevalue not presentin the
LifeSpanenum (e.g. after a firmware upgrade), the current implementationraises a
ValueErrorand aborts processing of the entire list. This means alllife span components silently lose their data, not just the unknown one.
This was observed on the T80s Pro (9jc32i) after a firmware upgrade, which started
returning three new types:
dustBucket,dustContainerFilter, andheavyDutyCleaningSolution.Solution
LifeSpanenum members observed in the wild.LifeSpan(component["type"])call in atry/except ValueErrorso thatunknown types are logged at DEBUG level and skipped, while all known components
continue to be parsed correctly.
Testing
test_GetLifeSpan_unknown_type_skippedto verify that an unknown type doesnot prevent known components from being processed.