Repository navigation
Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
|
|
||
| PATH_ARGS_BLOCK_TYPE = 57 | ||
|
|
||
| PAGE_LIMITS: dict[int, int] = { |
There was a problem hiding this comment.
key is the consts above
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
Clean, pure state-transition planner for V1 dynamic map element updates.
- Layer 1 (Architecture & Boundaries):
roborock/map/dynamic_state.pyis purely functional/immutable (frozen=Truedataclasses) with zero RPC or transport coupling. - Layer 2 (Data Models & Wire Mapping): Block header validation (
_PATH_HEADER_LEN = 20,_STANDARD_NUM_HEADER_LEN = 12), path/mop flag count agreement, 32-bit signed/unsigned nonce comparison, and overlap trimming on element3match the dynamic map wire format. See inline notes onPAGE_LIMITSand an empty-page edge case duringreplacement_pending. - Layer 3 & 4 (Style & Error Handling): Structural block problems raise
RoborockExceptionin low-level helpers and are converted intoPageOutcome.SKIPreasons byvalidate_page_contentso malformed pages never advance a cursor. - Layer 5 (Testing Standards): Thorough parameterized table tests in
tests/map/test_dynamic_state.py; see inline note for the 3 uncovered lines reported by Codecov.
| if element_id not in MERGEABLE_ELEMENTS: | ||
| return 0 | ||
| return PAGE_LIMITS.get(element_id, 0) | ||
|
|
There was a problem hiding this comment.
Layer 2 & 5 (PAGE_LIMITS & Coverage):
PAGE_LIMITSincludes32: 32,37: 50,38: 50, and58: 50, which are not inMERGEABLE_ELEMENTS(sopage_limit()always returns0for them), while other dynamic element IDs that have default request limits (1: 1,5: 500,17: 4096,26: 1,63: 50,64: 50) are omitted. Either scopingPAGE_LIMITSstrictly toMERGEABLE_ELEMENTSor including the full default table (1, 3, 5, 6, 11, 15, 16, 17, 21, 24, 25, 26, 27, 29, 30, 31, 32, 36, 37, 38, 42, 44, 45, 46, 50, 51, 52, 53, 58, 60, 63, 64) would make the table's role clearer.page_limit()is currently only called in tests with unsupported element IDs, leaving line 77 (return PAGE_LIMITS.get(element_id, 0)),ElementState.is_complete(line 110), andelement_record_countwhen a_STANDARD_NUM_ELEMENTSblock is absent (line 237) uncovered.
| element_id=page.element_id, | ||
| outcome=PageOutcome.NO_RECORDS, | ||
| state=replace(state, known_total=accepted_total, reset_streak=0), | ||
| reason="page carries no records", |
There was a problem hiding this comment.
If state.replacement_pending is True (at offset == 0) and an accepted page at start == 0 reports length == 0 and max_len == 0 (accepted_total == 0), this returns PageOutcome.NO_RECORDS with known_total=0, replacement_pending=True, and replace_content=False. Because offset == known_total == 0, no further page will be requested and the previous generation's cached content is never cleared. When accepted_total == 0 and state.replacement_pending (or state.known_total > 0), should this clear replacement_pending=False and set replace_content=True to match reconcile_announcement?
Add pure cursor and page planners for V1 dynamic map elements, following #1001 and #1005. Track the accepted generation and logical offset, then return explicit decisions for appends, replacements, empty generations, stale or gapped pages, and bounded generation-reset retries. An overlapping path page contributes only its unseen suffix; other element overlaps are rejected.
Port the element-level portion of the existing local planner, with signed/unsigned 32-bit nonce comparisons, the merged
result == 0 or count == 0acceptance rule, and checks that malformed pages cannot advance a cursor. Whole-map orchestration, byte merging, and device polling follow separately.Also address Allen's #1005 review: explain how incremental updates keep the displayed path and robot position current, and rename the model/test modules to
dynamic_map.pyandtest_dynamic_map.pyunder their existing V1 directories.Validation: