-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Forbid to choose state in Ukraine Alarm integration #156183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forbid to choose state in Ukraine Alarm integration #156183
Conversation
There was a problem hiding this 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 implements a migration from version 1 to version 2 of the Ukraine Alarm integration's config flow. The main change prevents users from monitoring state-level regions that contain districts, requiring them to select specific districts or communities instead. States without districts remain supported.
Key Changes
- Added migration logic that validates v1 entries and creates repair issues for unsupported state-level regions
- Updated config flow to version 2 with modified district selection behavior
- Refactored test data structure to share common region fixtures across test files
- Updated user-facing descriptions in config flow steps
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/ukraine_alarm/__init__.py |
Adds async_migrate_entry function to handle v1→v2 migration with API calls, validation logic, and repair issue creation for deprecated state-level regions |
homeassistant/components/ukraine_alarm/config_flow.py |
Bumps VERSION to 2 and modifies district step logic to prevent selecting parent state as an option |
homeassistant/components/ukraine_alarm/strings.json |
Updates config flow step descriptions and adds repair issue translation for deprecated state regions |
tests/components/ukraine_alarm/__init__.py |
Extracts _region helper function and REGIONS fixture to shared test module for reuse |
tests/components/ukraine_alarm/test_config_flow.py |
Removes tests for deprecated state-level selection behavior and imports shared test fixtures |
tests/components/ukraine_alarm/test_init.py |
Adds new migration tests covering successful migration and failure cases with repair issue creation |
|
I quite don't understand whether I must increase test coverage... |
|
I had been monitoring 5 regions and would be monitoring more than 5 if quota would allow me to do that. What maximum number of Districts would I be able to monitor with this change? |
|
@myroslav limit is the same, 5 entries. So 5 districts. Can you explain me your use case? |
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Breaking change
On Nov, 7 the API provider behind Ukraine Alarm integration sent an email that state (область) alarms won't trigger anymore and suggested to use district (район) and community-level (громада) alarms instead.
This change won't allow you to choose states anymore. It will also fail to load the entries which had state selected. You will need to remove them manually.
I still see that at least for "Автономна Республіка Крим" alarm is still triggered, so decided to allow to choose states which has no districts. That's the only exception.
Proposed change
As was written in "Breaking change" section, entries where state chosen won't be marked as triggered from API provider side anymore.
This change creates a migration for existing entries and forbids to choose states w/ districts. Tests and strings are also updated.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: