Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
Lash-L
left a comment
There was a problem hiding this comment.
Automated code review by Gemini 4 Argon in Antigravity using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).
Summary
Well-structured RoborockBase models and MowerEnum mappings for remote_pb command and reply payloads.
- Layer 1 (Architecture & Boundaries): Pure data-layer additions under
roborock/data/mower/with no transport or trait coupling. - Layer 2 (Data Models & Wire Mapping): Field names, types,
WIRE_ALIASESforMowAreasConfig.global, and enum codes match therock.common/rock.common.remote/rock.fsmdefinitions, with two wire-mapping findings noted inline (MowerFsmStatemissing codes25..89andMowerMowContinue.continue_statetyped asintinstead ofMowerFsmState). - Layer 3 & 4 (Style & Conformance): All new dataclasses and enums satisfy model and enum conformance rules (
Nonedefaults,UNKNOWNfallback members, unique codes). - Layer 5 (Testing Standards): Comprehensive round-trip, unknown-enum, and partial-payload tests in
tests/data/mower/test_mower_commands.pyandtests/data/mower/test_mower_code_mappings.py.
| STANDBY = ("standby", 22) | ||
| RUN = ("run", 23) | ||
| EMERGENCY_STOP = ("emergency_stop", 24) | ||
|
|
There was a problem hiding this comment.
rock.fsm.FsmState.Type defines states 25..89 beyond EMERGENCY_STOP (24), including common runtime states reported in RobotTask.working_state and RobotMsg.mow_working_state:
25:SHUTDOWN26:DELETE27:PREPARE_BUILDING_PATH28:MMT_RUN29:NORMAL30:EMC31:MENU_OPTIONS(MenuOptions)32:CALIBRATION33:MMT34:NOISE35:BIT36:SELF_CALIBRATION37:CALIBRATION_RUN38:REMOTE_MOWING39:REMOTE_MAPPING40:MCU_OTA41:COLLECT42:LOOP43:NOT_AVAILABLE44:RECOVERABLE_FAULT45:UNDOCK46:UNDOCK_FINISH47:BUILDING_BOUNDARY_AUTO48:DOCK_TEST49:WAITING50:MOW_UNDOCK51:CRITICAL_FAULT52:STEER_TEST53:ACTIVE54:PREPARE_BUILDING_BOUNDARY55:PREPARE_BUILDING_ISLAND56:INIT57:CLOSED58:TERMINATE59:UNDOCK_FAULT60:TO_DOCK61:SLEEP62:RESTART63:MCU_FAKE_POWEROFF64:AFS_CALIBRATION65:COLD_START66:WARM_START67:AFS_MMT68:MAP69:MOW70:DOCK71:DEBOUNCE72:EDGE_DOCK_TEST73:PREPARE74:NEAR75:REMOTE_UNDOCK76:AFS_LINE_DIFF_CALIBRATION77:LINE_DIFF_CHECK78:WAITING_FOR_CALIBRATION79:MCU_LOW_POWER80:LOG_UPLOAD81:MCU_ENERGY_EFFICIENCY82:RESET_UNDOCK83:BUILDING_NO_AVOID84:PREPARE_BUILDING_NO_AVOID85:RESET_PASSAGE86:PREPARE_RESET_PASSAGE87:REMOTE_INIT88:EDIT_BOUNDARY89:PREPARE_EDIT_BOUNDARY
Without 25..89, runtime states such as MOW (69), DOCK (70), SLEEP (61), WAITING (49), MOW_UNDOCK (50), TO_DOCK (60), and RECOVERABLE_FAULT (44) will resolve to MowerFsmState.UNKNOWN.
| """Retained-task continuation state (``rock.common.MowContinue``).""" | ||
|
|
||
| continue_state: int | None = None | ||
| plan_mow: bool | None = None |
There was a problem hiding this comment.
MowContinue.continue_state is a rock.fsm.FsmState.Type enum on the wire, so this should be typed as MowerFsmState | None = None. When continue_state is serialized as an enum name on the JSON route (e.g. "MOW_GLOBAL" or "UNKNOWN"), RoborockBase.convert_dict attempts int(value), logs a ValueError, and drops the field; using MowerFsmState | None accepts both integer codes and enum names.
Mower support currently has typed scalar status, but no structured request/reply models. Add the command and response enum tables and
RoborockBasepayload models forremote_pb, including preferences, schedules, task/battery state, capabilities and hardware/version information. This follows #1002 and #1009.Keep the merged status models and enum behavior unchanged. New enums use lowercase domain values, accept protobuf names or numeric codes, and fall back on unknown firmware values. Partial payloads preserve omitted fields separately from zero, false and empty lists; absence records payload presence rather than asserting that a setting is unset. Protobuf default interpretation belongs to the following protocol/consumer layer; 64-bit request IDs retain their decimal-string representation. The
globalpreference key parses asglobal_preference.This PR contains data models only.
as_dict()retains the standard library representation; the following protocol PR will handle snake_case keys, protobuf enum names and the reservedglobalkey. Capability decoding, transport and consumer traits follow separately.Validation: