Skip to content

Conversation

@emontnemery
Copy link
Contributor

Proposed change

Bump area registry to version 1.9 and sort areas

Sort order is:

  • By area name, ignoring case (using simple casefold, nothing fancy)

Sorting existing areas was forgotten when allowing users to sort their areas manually in PR #156802; frontend now respects the sort order in the area registry which in most cases is not as expected. This PR does a minimal effort attempt of sorting existing areas.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@emontnemery emontnemery added this to the 2025.12.0 milestone Dec 1, 2025
@emontnemery emontnemery requested a review from a team as a code owner December 1, 2025 14:54
Copilot AI review requested due to automatic review settings December 1, 2025 14:54
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 bumps the area registry storage version to 1.9 and implements case-insensitive alphabetical sorting of areas during migration. This fixes an issue where areas weren't properly sorted after manual sorting functionality was introduced in PR #156802, ensuring the frontend displays areas in the expected order.

Key changes:

  • Bumps STORAGE_VERSION_MINOR from 8 to 9 in the area registry
  • Adds migration logic to sort existing areas alphabetically by name using case-insensitive comparison
  • Adds comprehensive test coverage for the migration, verifying both runtime behavior and persisted storage

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
homeassistant/helpers/area_registry.py Bumps storage version to 1.9 and adds migration to sort areas by name using case-insensitive comparison
tests/helpers/test_area_registry.py Enhances migration test with multiple areas to verify correct case-insensitive alphabetical sorting ("AAA", "bbb", "CCC")

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Member

@piitaya piitaya left a comment

Choose a reason for hiding this comment

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

The logic seems to be good according to previous front-end logic : alphabetic order

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @emontnemery 👍

../Frenck

                       

Blogging my personal ramblings at frenck.dev

@frenck frenck merged commit 8b04ce1 into dev Dec 1, 2025
71 of 72 checks passed
@frenck frenck deleted the sort_areas branch December 1, 2025 18:26
@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants