Repository navigation
Add setup flow engine for interactive provider and player setup - #4952
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces the groundwork for interactive, server-driven setup flows for providers and players by adding a flow session model (SetupSession) and a ConfigController flow engine (SetupFlowMixin) with new API commands and events. This enables multi-step setup/reconfigure/pairing with deadlines, progress steps, callbacks, and cancellation semantics while remaining additive to existing configuration paths.
Changes:
- Added a new setup-flow engine in the config controller (
SetupFlowMixin) with API commands for starting/continuing/aborting flows and an idle-flow sweeper. - Added the session/step authoring surface (
SetupSession,SetupFlowContext, flow exceptions) plus provider/player hooks for setup data. - Added test coverage for setup flows and updated provider config saving to preserve unknown stored values and carry
setup_data.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/controllers/config/test_setup_flows.py | New end-to-end tests for provider/player flows (forms, external callback, expiry, abort, sweep, reconfigure). |
| tests/controllers/config/test_provider_config_load.py | Adds regression test ensuring provider config saves preserve unknown stored values and setup_data. |
| music_assistant/models/setup_flow.py | New SetupSession + context/exceptions and step publishing/validation/callback handling. |
| music_assistant/models/provider.py | Adds provider helpers for reading and updating setup_data (with encryption and legacy fallback). |
| music_assistant/models/player.py | Adds overridable run_setup_flow(session) hook for interactive player setup. |
| music_assistant/controllers/config/providers.py | Preserves unknown stored values on save and factors provider instance creation into _create_provider_instance with cancellation cleanup. |
| music_assistant/controllers/config/flows.py | New flow engine + API endpoints for starting/submitting/getting/aborting flows and finish handlers. |
| music_assistant/controllers/config/controller.py | Wires the new SetupFlowMixin into ConfigController. |
5 of 17 tasks
marcelveldt
added a commit
that referenced
this pull request
Jul 24, 2026
# What does this implement/fix? Follow-up on #4952 (flagged in review): the setup-flow external-step callback declares its params as `dict[str, str]`, but a JSON POST body could inject numbers/bools into it. - Coerce JSON body keys/values to strings before merging into the callback params - Ignore non-object JSON bodies (logged) instead of merging garbage - Test covering a JSON callback body with non-string values ## Types of changes - [x] Bugfix (non-breaking change which fixes an issue) — `bugfix` - [ ] New feature (non-breaking change which adds functionality) — `new-feature` - [ ] Enhancement to an existing feature — `enhancement` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [ ] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have raised a PR against the documentation repository targeting the main or beta branch as appropriate.
This was referenced Jul 24, 2026
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.
What does this implement/fix?
Groundwork for the new interactive setup flows: a server-driven flow engine that replaces the action-based config-entry workarounds for provider/player setup (credentials, OAuth, pairing) — with a clear begin and end, multiple steps, progress and proper cancellation. Purely additive: nothing changes yet for existing providers or clients.
SetupSession: a provider authors its setup as one plain coroutine (run_setup(session)inproviders/<domain>/setup_flow.py) using awaitableform()/external()/progress_until()steps, optional step deadlines and clean abort/cleanup semanticsconfig/providers/setup,config/providers/reconfigure(also covers re-authentication) andconfig/players/setup, plusconfig/flows/submit|get|abort; step changes are pushed via the newSETUP_FLOW_UPDATEDeventsetup_dataconfig section: encrypted at rest and never exposed over the APIRelated: music-assistant/models#324 (shipped in models 1.1.169)
Types of changes
bugfixnew-featureenhancementnew-providerbreaking-changerefactordocumentationmaintenancecidependenciesChecklist
pre-commit run --all-filespasses.pytestpasses, and tests have been added/updated undertests/where applicable.music-assistant/modelsis linked.music-assistant/frontendis linked.