-
Notifications
You must be signed in to change notification settings - Fork 755
Check frontend availability after Home Assistant Core updates #6311
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
base: main
Are you sure you want to change the base?
Conversation
|
When trying to update to todays nightly build with a bad frontend manually like so: The Supervisor rolls back the Core to the previous version |
|
What I did notice is that we delete the old image before rollback. This means we clean the image, then redownload it again. This always used to be the case, and maybe we could even make the case that this makes sure the previous image is properly downloaded again. On the other hand, this redownload might fail. If Core worked before, the image on disk is most likely in a good state, so this only adds the risk that rollback fails 🤔 I'll create a separate PR for this. |
Add verification that the frontend is actually accessible at "/" after core updates to ensure the web interface is serving properly, not just that the API endpoints respond. Previously, the update verification only checked API endpoints and whether the frontend component was loaded. This could miss cases where the API is responsive but the frontend fails to serve the UI. Changes: - Add check_frontend_available() method to HomeAssistantAPI that fetches the root path and verifies it returns HTML content - Integrate frontend check into core update verification flow after confirming the frontend component is loaded - Trigger automatic rollback if frontend is inaccessible after update - Fix blocking I/O calls in rollback log file handling to use async executor 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
40d2f18 to
96e6c0b
Compare
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 enhances Home Assistant Core update verification by adding a frontend accessibility check after updates. Currently, the update process only verifies that API endpoints respond and the frontend component is loaded, which could miss cases where the API is responsive but the web UI fails to serve. The new check_frontend_available() method fetches the root path and verifies it returns HTML content with a 200 status code, automatically triggering a rollback if the frontend is inaccessible.
Key Changes:
- New
check_frontend_available()method in the HomeAssistantAPI class that validates frontend HTML responses - Integration of frontend check into the update verification flow after confirming the frontend component is loaded
- Conversion of blocking I/O operations (file existence check and copy) to async using the executor pattern
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| supervisor/homeassistant/api.py | Adds new check_frontend_available() method to verify frontend accessibility by checking for HTML response from root path |
| supervisor/homeassistant/core.py | Integrates frontend check into update verification logic and fixes blocking I/O for log file operations using async executor |
| tests/homeassistant/test_api.py | Comprehensive unit tests for the new frontend availability check covering success, failure, and edge cases |
| tests/api/test_homeassistant.py | Integration tests verifying the full update flow with frontend checks and rollback behavior |
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
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Proposed change
This PR enhances the Home Assistant Core update verification process to ensure the frontend is actually accessible and serving properly after updates, not just that the API endpoints respond.
Currently, after a core update, Supervisor only checks if the API endpoints (
/api/core/stateor/api/config) respond and whether thefrontendcomponent is loaded. This could miss cases where the API is responsive but the frontend fails to serve the web UI, leaving users with a seemingly successful update but an inaccessible interface.This PR adds a
check_frontend_available()method that fetches the root path (/) and verifies it returns HTML content with a 200 status code. This check runs after confirming the frontend component is loaded. If the frontend is inaccessible, the update automatically triggers a rollback to the previous version.Additionally, this PR fixes blocking I/O operations in the rollback log file handling by using the async executor pattern.
Type of change
Additional information
Checklist
ruff format supervisor tests)If API endpoints or add-on configuration are added/changed: