Skip to content

Handle malformed device registry entries#4693

Draft
bgoncal wants to merge 1 commit into
mainfrom
device-registry
Draft

Handle malformed device registry entries#4693
bgoncal wants to merge 1 commit into
mainfrom
device-registry

Conversation

@bgoncal

@bgoncal bgoncal commented Jun 3, 2026

Copy link
Copy Markdown
Member

Summary

  • Fetch the Home Assistant device registry as raw HAData and decode entries lossily.
  • Skip malformed device entries instead of failing the entire device registry update.
  • Log the skipped entry index, id, name, user name, manufacturer, model, and decode error so support can identify the bad device.

Context

User logs showed device registry updates failing with:

HADataError.incorrectType(key: "identifiers", expected: "Optional<Array<Array<String>>>", actual: "__NSSingleObjectArrayI")

Because the registry response was decoded as a typed array, one malformed device blocked persistence for every valid device. This keeps valid devices flowing while still surfacing the malformed entry clearly.

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.10526% with 33 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@72f0688). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ources/Shared/Environment/AppDatabaseUpdater.swift 0.00% 21 Missing ⚠️
...urces/Shared/Environment/DeviceRegistryEntry.swift 66.66% 12 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4693   +/-   ##
=======================================
  Coverage        ?   44.04%           
=======================================
  Files           ?      282           
  Lines           ?    17149           
  Branches        ?        0           
=======================================
  Hits            ?     7553           
  Misses          ?     9596           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant