Add next_flow to Repair Flows#165091
Conversation
…acore into repair-flow-next-flow
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
This PR adds support for next_flow in the async_create_entry method of RepairsFlow. When a repair issue fix requires configuration changes, the flow can now trigger a subsequent reconfigure, options, or config subentry flow. The frontend already supported this feature; this PR adds the required back-end support.
Changes:
FlowTypeenum extended withOPTIONS_FLOWandCONFIG_SUBENTRIES_FLOWvalues (previously onlyCONFIG_FLOWexisted)RepairsFlow.async_create_entrynow accepts an optionalnext_flowparameter, validates it (ensuring the referenced flow exists and is a reconfigure or options flow), and includes it in the result- HTTP views updated to serialize the result for the frontend when
next_flowis present
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
homeassistant/config_entries.py |
Adds OPTIONS_FLOW and CONFIG_SUBENTRIES_FLOW values to FlowType enum; minor whitespace fix |
homeassistant/components/repairs/models.py |
Introduces RepairsFlowResult typed dict; adds next_flow parameter to async_create_entry; validates and sets next_flow and result in the flow result |
homeassistant/components/repairs/websocket_api.py |
Adds _prepare_repairs_flow_result_json helper to serialize the ConfigEntry result for the frontend; overrides _prepare_result_json in both view classes |
tests/components/repairs/test_websocket_api.py |
Adds comprehensive test cases for next_flow functionality including valid and invalid scenarios for all three flow types |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Given that we once changed from |
I agree. A good comparison IMO is the The suggestion from @gjohansson-ST is probably the most workable. You could even start with just a type alias for |
…it, clarify error message
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Proposed change
Add next_flow to async_create_entry of the RepairsFlow. This allows repairs flows requiring configuration changes (for issues other than reauthentication to trigger a reconfigure or options flow for a config entry or a reconfigure flow for a subentry. This functionality was already implemented in the front end but not supported by the back end.
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: