fix: Reverts the V1 image parser monkey-patch - #949
Open
allenporter wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, matches the stated root cause, and the argument-forwarding approach safely restores compatibility across the affected dependency versions.
Pull request overview
This PR fixes compatibility with multiple vacuum-map-parser-roborock versions by making the internal _AdjacencyAwareRoborockImageParser.parse() override forward unknown/extra arguments to the upstream parser instead of explicitly passing a removed_map positional argument that older versions don’t accept.
Changes:
- Update
_AdjacencyAwareRoborockImageParser.parse()to accept*args, **kwargsinstead of a hard-codedremoved_mapparameter. - Forward the extra arguments to
super().parse(...)to avoidTypeErroronvacuum-map-parser-roborock<=0.1.4while supporting>=0.1.5and future additions.
File summaries
| File | Description |
|---|---|
roborock/map/map_parser.py |
Makes the image parser override argument-forwarding tolerant to upstream signature changes (removed_map and future params). |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Reverts the V1 image parser monkey-patch introduced in Python-roborock#902. Fixes home-assistant/core#181447
allenporter
force-pushed
the
investigate_issue_181447
branch
from
September 7, 2026 22:24
3b17fa2 to
770d407
Compare
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.
Reverts the V1 image parser monkey-patch introduced in #902.
Fixes downstream issue home-assistant/core#181447
Background
In #902,
_AdjacencyAwareRoborockImageParserwas introduced to apply deterministic adjacent room coloring to V1 maps to match the new Q10 map styling. During the initial review of #902, we noted reservations about monkey-patching the upstream library's internal member (RoborockMapDataParser._image_parser) and mutating the read-only palette cache in place, but accepted it to avoid blocking progress on Q10 map support.As anticipated, coupling directly to internal, undocumented implementation details of
vacuum-map-parser-roborockproved brittle. When upstream added support forremoved_maptoRoborockImageParser.parse()in0.1.5, the rigid argument list in our subclass caused environments running0.1.4to crash during coordinator map updates:Changes
Remove monkey-patching entirely: Drop _AdjacencyAwareRoborockImageParser and restore standard, unpatched instantiation of RoborockMapDataParser.
Remove palette mutation: Eliminate in-place dictionary mutations and the associated threading.Lock().
Preserve Q10 support: Q10 map rendering is completely independent and unaffected by this change. It continues to use room_colors.py directly within B01Q10MapParser as designed.
If adjacent room recoloring for V1 maps is desired in the future, it should be proposed upstream in vacuum-map-parser-roborock where it can be supported cleanly via public APIs rather than patched into library internals.
Validation
Verified map tests pass against both vacuum-map-parser-roborock==0.1.4 and 0.1.5.
All Q10 map parser and rendering tests pass (70 passed).
Full pre-commit test and lint suite passes cleanly.