Skip to content

Commit a446fb3

Browse files
authored
Merge branch 'main' into fix/dynamic-agreement-version
2 parents c0c8aef + 16606c9 commit a446fb3

6 files changed

Lines changed: 33 additions & 3 deletions

File tree

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Evaluate every change against the repository's three core layers in strict prior
5454
## Detailed Engineering Conventions
5555

5656
### 1. Typing & Data Models
57-
- **Subclass `RoborockBase`**: Define structured domain and wire data models as `@dataclass` subclassing `RoborockBase` (`from_dict`, `as_dict`). Avoid `TypedDict` or loose dicts. (Binary protocol packets, transport message envelopes, and map layers are exempt).
57+
- **Subclass `RoborockBase`**: Define structured domain and wire data models as `@dataclass` subclassing `RoborockBase` (`from_dict`, `as_dict`). Avoid `TypedDict` or loose dicts. (Binary protocol packets, transport message envelopes, and map layers are exempt). The existing frozen `Q10RoborockPoint` coordinate value is also exempt: it must retain immutability and hashability, and Python disallows frozen dataclass inheritance from the non-frozen `RoborockBase`. This exception does not extend to other domain models.
5858
- **Enum Fallback Resilience**: All enums representing device status, firmware modes, error codes, and wire protocol integer codes MUST inherit from `RoborockEnum` (defining a lowercase `unknown = -1` or `0` member) or `RoborockModeEnum` (using `from_code_optional()`). Internal enums not decoding unknown firmware codes remain standard `Enum`/`StrEnum`.
5959
- **Strongly Type What You Know; Contain `Any` to the Wire**: Public trait APIs, method signatures, properties, and domain models MUST declare concrete types. `Any` is accepted only where the underlying wire protocol is dynamic or polymorphic (Tuya DPS maps, low-level RPC dispatch, serialization helpers, evolving cloud schemas).
6060
- **Avoid Forward References & `TYPE_CHECKING`**: Avoid stringified forward references (`"ClassName"`) and `if typing.TYPE_CHECKING:` guards wherever possible. They typically indicate circular dependencies or coupling that should be refactored by extracting shared models.

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
<!-- version list -->
44

5+
## v7.8.1 (2026-09-17)
6+
7+
### Bug Fixes
8+
9+
- Preserve immutable Q10 points in model conformance checks
10+
([#965](https://github.com/Python-roborock/python-roborock/pull/965),
11+
[`386e4c5`](https://github.com/Python-roborock/python-roborock/commit/386e4c50fe9ca29d7a4caa85a3662c3c104b26f2))
12+
13+
514
## v7.8.0 (2026-09-13)
615

716
### Features

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "python-roborock"
3-
version = "7.8.0"
3+
version = "7.8.1"
44
description = "A package to control Roborock vacuums."
55
authors = [{ name = "humbertogontijo", email = "humbertogontijo@users.noreply.github.com" }, {name="Lash-L"}, {name="allenporter"}]
66
requires-python = ">=3.11, <4"

‎tests/conformance/test_model_conformance.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import pytest
1111

1212
import roborock.data
13+
from roborock.data.b01_q10.b01_q10_containers import Q10RoborockPoint
1314
from roborock.data.containers import RoborockBase
1415
from tests.conformance.discovery import discover_dataclasses, to_pytest_params
1516

@@ -20,6 +21,12 @@
2021
)
2122
def test_data_model_subclasses_roborock_base(model_cls: type) -> None:
2223
"""All domain dataclasses in roborock.data must inherit from RoborockBase."""
24+
# This immutable coordinate value predates the conformance suite. Frozen
25+
# dataclasses cannot inherit from the non-frozen RoborockBase dataclass.
26+
# Keep this exception explicit; other models must satisfy the normal rule.
27+
if model_cls is Q10RoborockPoint:
28+
assert model_cls.__dataclass_params__.frozen # type: ignore[attr-defined]
29+
return
2330
assert issubclass(model_cls, RoborockBase), (
2431
f"{model_cls.__module__}.{model_cls.__name__} is a dataclass but does not inherit from RoborockBase. "
2532
"Per AGENTS.md, domain containers must subclass RoborockBase for serialization."

‎tests/data/b01_q10/test_b01_q10_containers.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Tests for Q10 data containers."""
22

3+
from dataclasses import FrozenInstanceError
4+
35
import pytest
46

57
from roborock.data.b01_q10.b01_q10_containers import Q10RoborockPoint
@@ -47,3 +49,15 @@ def test_q10_roborock_point_rejects_invalid_vector_coordinates(
4749
"""Outbound vector coordinates must fit the signed wire grid exactly."""
4850
with pytest.raises(ValueError):
4951
point.to_vector()
52+
53+
54+
@pytest.mark.parametrize("field", ["x", "y"])
55+
def test_roborock_point_preserves_immutable_value_contract(field: str) -> None:
56+
point = Q10RoborockPoint(25500, 25500)
57+
original_hash = hash(point)
58+
with pytest.raises(FrozenInstanceError):
59+
setattr(point, field, 0)
60+
with pytest.raises(FrozenInstanceError):
61+
delattr(point, field)
62+
assert point == Q10RoborockPoint(25500, 25500)
63+
assert hash(point) == original_hash

‎uv.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)