Skip to content

Conversation

@allenporter
Copy link
Contributor

Put all redaction logic in one place. Redact identifiers from topic names and duids.

Put all redaction logic in one place. Redact identifiers from topic names and duids.
Copilot AI review requested due to automatic review settings December 21, 2025 21:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py with three new functions: redact_device_data, redact_topic_name, and redact_device_uid
  • Updated RoborockLoggerAdapter to accept either a device UID (which gets automatically redacted) or a name parameter, improving security by default
  • Updated all instantiations of RoborockLoggerAdapter across 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.

@allenporter allenporter requested a review from Lash-L December 22, 2025 01:34
@allenporter allenporter merged commit 067794c into Python-roborock:main Dec 22, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants