Skip to content

Conversation

@allenporter
Copy link
Contributor

Add home API data including products devices, rooms, etc and increase the number of redacted fields. Add a device manager snapshot test to verify which fields are redacted.

@allenporter allenporter requested a review from Lash-L December 30, 2025 03:35
@allenporter allenporter changed the title chore: Add additional Home data do diagnostics chore: Add additional Home data to diagnostics Dec 30, 2025
Add home API data including products devices, rooms, etc and
increase the number of redacted fields. Add a device manager
snapshot test to verify which fields are redacted.
@allenporter allenporter marked this pull request as draft December 30, 2025 15:41
@allenporter allenporter marked this pull request as ready for review December 30, 2025 16:08
Copilot AI review requested due to automatic review settings January 7, 2026 03:23
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 adds comprehensive home API data (devices, products, rooms, etc.) to the diagnostics output and enhances data redaction by increasing the number of redacted fields and adding selective field preservation via KEEP_KEYS.

Key changes:

  • Adds home_data to diagnostic output alongside existing device and diagnostics information
  • Implements path-based redaction logic to selectively preserve non-sensitive product and schema information
  • Adds snapshot test to verify correct field redaction behavior

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
roborock/diagnostics.py Adds KEEP_KEYS mechanism for selective field preservation and expands REDACT_KEYS with home data fields (id, name, productId, etc.)
roborock/devices/device_manager.py Stores home_data and restructures diagnostic_data() to return home_data, devices, and diagnostics sections
roborock/devices/device.py Refactors diagnostic_data() to apply redaction to entire structure for correct path tracking
tests/devices/test_device_manager.py Adds snapshot test for diagnostics and updates assertions for new structure
tests/devices/snapshots/test_device_manager.ambr New snapshot file capturing expected diagnostic output with redaction
tests/devices/snapshots/test_v1_device.ambr Updates snapshots to reflect additional redacted fields (name, productId)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 114 to 122
KEEP_KEYS = {
# Product information no unique per user
"product.id",
"product.schema.id",
"product.schema.name",
# Room ids are likely unique per user, but don't seem too sensitive and are
# useful for debugging
"rooms.id",
}
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

The KEEP_KEYS entries use singular form "product" but the actual field name in HomeData is "products" (plural). This causes product information to be incorrectly redacted in home_data.

The KEEP_KEYS should include:

  • products.id (not product.id)
  • products.schema.id (not product.schema.id)
  • products.schema.name (not product.schema.name)

The current entries only work for the devices section where each device has a single product field, but they don't match the path products.id when processing the home_data.products list.

Copilot uses AI. Check for mistakes.
@allenporter allenporter requested a review from Lash-L January 8, 2026 03:49
@allenporter allenporter merged commit c29dfc8 into Python-roborock:main Jan 8, 2026
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