Skip to content

Conversation

@KangYiYao19
Copy link
Collaborator

1. The addressed issue

The issue is in the Home Assistant’s YAML configuration system:

  • Invalid list items inside packages (eg. strings in a list of dicts) were silently merged.
  • Validation errors were unclear, where missing context about the value, location or reason are missing.
  • Deprecated configuration options were not highlighted, causing users to receive no guidance on migration.

2. What I have reengineered

  • Enhanced merge_packages_config() with strict type-checking for list-based domain configurations to prevent invalid items from being merged.
  • Refactored stringify_invalid() and humanize_error() to produce structured diagnostics, including error categories, config paths, offending values, hints and optional documentation links.
  • Added _log_deprecated_config() and updated async_hass_config_yaml() to detect deprecated configuration options and warn users during YAML loading.

3. Reengineering Strategy / Approach Used

Partial approach is used.

Only targeted components of the configuration subsystem were reengineered, rather than modifying the entire YAML loading pipeline.

  • merge_packages_config() was updated to introduce strict validation for list-based configurations, while other merge logic are untouched.
  • stringify_invalid() and humanize_error() were enhanced to improve error formatting without altering how other validation routines operate.
  • async_hass_config_yaml() was extended with deprecated configuration detection, but its core YAML loading behavior remained unchanged.

4. Impact of Changes

  • Malformed inputs can no longer silently corrupt merged configurations.
  • Troubleshooting is improved as users now receive actionable feedback when validation issues occur.
  • Migration support is clearer as deprecated configuration options now trigger explicit warnings with guidance for replacement.

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.

4 participants