Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the wrong index was used to retrieve the last (most recent) clean record. The change corrects the index from self.records[-1] (oldest record) to self.records[0] (newest record), aligning with the implementation in the legacy V1 API at roborock/version_1_apis/roborock_client_v1.py:281.
- Changed clean record retrieval to use the first element (index 0) instead of the last element (index -1) of the records list
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self.last_clean_record = None | ||
| return | ||
| last_record_id = self.records[-1] | ||
| last_record_id = self.records[0] |
There was a problem hiding this comment.
The corresponding test in tests/devices/traits/v1/test_clean_summary.py needs to be updated to match this fix. Line 96 of the test expects the call to be made with params=[1734458038] (the last element in the records list), but with this change it should now expect params=[1756848207] (the first element). Additionally, the test data in CLEAN_RECORD_DATA should be updated to have a begin value that matches the first record ID (1756848207) instead of the current inconsistent value (1738864366).
match what we did in the old api