fix: Improve debug logs redaction#698
Merged
allenporter merged 3 commits intoPython-roborock:mainfrom Dec 22, 2025
Merged
Conversation
Put all redaction logic in one place. Redact identifiers from topic names and duids.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates redaction logic into a centralized location in the diagnostics module and improves how device identifiers are redacted in debug logs. The main changes include moving redaction functions to roborock/diagnostics.py, updating RoborockLoggerAdapter to automatically redact device UIDs when logging, and adding comprehensive test coverage for the redaction functions.
Key Changes:
- Centralized all redaction logic in
roborock/diagnostics.pywith three new functions:redact_device_data,redact_topic_name, andredact_device_uid - Updated
RoborockLoggerAdapterto accept either a device UID (which gets automatically redacted) or a name parameter, improving security by default - Updated all instantiations of
RoborockLoggerAdapteracross the codebase to use keyword arguments
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
roborock/diagnostics.py |
Adds centralized redaction functions for device data, topic names, and device UIDs |
roborock/util.py |
Updates RoborockLoggerAdapter to automatically redact device UIDs and support flexible initialization |
roborock/devices/device.py |
Migrates from local _redact_data function to centralized redact_device_data and updates logger instantiation |
roborock/devices/v1_channel.py |
Updates logger instantiation to use keyword arguments with automatic UID redaction |
roborock/devices/mqtt_channel.py |
Updates logger instantiation to use keyword arguments with automatic UID redaction |
roborock/devices/local_channel.py |
Updates logger instantiation to use keyword arguments with automatic UID redaction |
roborock/version_1_apis/roborock_mqtt_client_v1.py |
Updates logger instantiation to use keyword arguments |
roborock/version_1_apis/roborock_local_client_v1.py |
Updates logger instantiation to use keyword arguments |
roborock/version_a01_apis/roborock_mqtt_client_a01.py |
Updates logger instantiation to use keyword arguments |
tests/test_diagnostics.py |
Adds comprehensive test coverage for all three redaction functions |
tests/devices/__snapshots__/test_v1_device.ambr |
Updates snapshot expectations to reflect partial UID redaction instead of complete masking |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Lash-L
reviewed
Dec 22, 2025
Lash-L
approved these changes
Dec 22, 2025
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.
Put all redaction logic in one place. Redact identifiers from topic names and duids.