fix(helpers): align helper params, check success, and enable redeploy#63
Open
fix(helpers): align helper params, check success, and enable redeploy#63
Conversation
eb78c84 to
d401ed0
Compare
d401ed0 to
4467b40
Compare
4467b40 to
d1fc3c9
Compare
88d32a1 to
334e8eb
Compare
…ures
HA's REST config storage endpoints (/api/config/{domain}/config/{id})
return 404 for helper creation — the correct transport is the WebSocket
API ({domain}/create, {domain}/delete). The base HTTP client silently
swallowed 404 responses, causing create_* methods to falsely report
success.
Additionally, passing id=input_id in WS params overwrote the protocol
message sequence ID (must be an integer), causing HA to reject with
"Message incorrectly formatted". HA auto-generates the entity slug
from the name field.
Changes:
- Rewrite all 8 create_* methods in HelperMixin to use ws_command
- Rewrite delete_helper to WS list-then-delete using storage IDs
- Add _ws() convenience wrapper matching DashboardMixin pattern
- Strip WS protocol keys (id, type) from params in _execute safety net
- Use HA-returned slug from create response for entity_id
- Fix _deploy_helper to check result.success before marking deployed
- Allow DEPLOYED->DEPLOYED state transition for forced redeployment
- Add force flag to deploy API client and useDeployProposal hook
- Add Redeploy button with improved footer layout on proposal detail
- Rename min_value/max_value to min/max matching HA field names
- Update all unit tests to mock ws_command instead of _request
Made-with: Cursor
334e8eb to
fc05b70
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/config/{domain}/config/{id}) return 404 for helper creation. The base HTTP client silently swallowed 404 responses, causingcreate_*methods to falsely report success.create_*methods anddelete_helperinHelperMixinnow use the HA WebSocket API ({domain}/create,{domain}/delete,{domain}/list), matching the same transport HA's own frontend uses.id=input_id(a string slug) in WS params overwrote the integer message sequenceid, causing HA to reject with "Message incorrectly formatted". Now stripped as a safety net in_execute, andcreate_*methods no longer passid— HA auto-generates the slug from thenamefield._deploy_helpernow checksresult.get("success")before marking proposals as deployed.forceflag to deploy endpoint,DEPLOYED→DEPLOYEDstate transition, and Redeploy button in the proposal detail UI.Test plan
ws_commandinstead of_requestinput_idid,type) are not overwritten by paramsmake ci-localpasses (3322 tests, lint, mypy, bandit)