Skip to content

feat: use display name to fix duplicate code mappings - #870

Merged
Lash-L merged 2 commits into
mainfrom
duplicate_code_mappings
Jul 30, 2026
Merged

feat: use display name to fix duplicate code mappings#870
Lash-L merged 2 commits into
mainfrom
duplicate_code_mappings

Conversation

@Lash-L

@Lash-L Lash-L commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

This fixes a large portion of our enums that are duplicates. This will be a breaking change on HA, but should likely be okay

@Lash-L
Lash-L requested review from allenporter and Copilot July 8, 2026 02:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
roborock/data/code_mappings.py 87.50% 1 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
roborock/data/dyad/dyad_code_mappings.py 100.00% <100.00%> (ø)
roborock/data/v1/v1_code_mappings.py 100.00% <100.00%> (ø)
roborock/data/v1/v1_containers.py 94.94% <100.00%> (ø)
tests/data/test_code_mappings.py 100.00% <100.00%> (ø)
tests/data/v1/test_v1_containers.py 100.00% <100.00%> (ø)
roborock/data/code_mappings.py 90.36% <87.50%> (-0.43%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

allenporter
allenporter previously approved these changes Jul 10, 2026
@Lash-L

Lash-L commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator Author

Holding off on this one until closer to the beta, don't want to put us in a weird situation where this breaks anything

@Lash-L

Lash-L commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

stale review due to conflicts. Approve when you can @allenporter want to make sure this gets into beta.

@allenporter allenporter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Style issues can be fixed in follow up

def __new__(cls, value: int, display_name: str | None = None) -> Self:
member = int.__new__(cls, value)
member._value_ = value
member._display_name_ = display_name

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Weird syntax with trailing _

for item in cls:
if item.name == "missing":
continue
result.setdefault(item.display_name, item.value)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can just be regular dict value setting? Don't think set default is needed

@Lash-L
Lash-L merged commit d0a99c2 into main Jul 30, 2026
8 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.

3 participants