Skip to content

Fix Sendspin metadata during group content takeover - #6271

Open
teancom wants to merge 2 commits into
devfrom
fix/sendspin-group-metadata-takeover
Open

teancom wants to merge 2 commits into
devfrom
fix/sendspin-group-metadata-takeover

Conversation

@teancom

@teancom teancom commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What does this implement/fix?

I have a 'screen' device in a static sendspin group alongside a WiiM, and I noticed that I would often see, at the start of playback of the group, a "flash" (or sometimes several seconds) of the metadata and album art of the WiiM's individual player from whatever it had played last. Then the metadata and artwork of the group player would come through and overwrite it, fixing the glitch. I thought it was going to be relatively simple but a few days of testing showed there to be a ton of edge-case and race conditions to account for. Which is how I ended up with this including "generations" and serializing publication so we don't flap the state back and forth.

Types of changes

  • 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

  • The code change is tested and works locally.
  • pre-commit run --all-files passes.
  • 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.
  • I have read and complied with the project's AI Policy for any AI-assisted contributions.
  • I have raised a PR against the documentation repository targeting the main or beta branch as appropriate.

Starting different content through a saved group can replay the protocol group’s cached metadata and artwork to newly joined screens before the new queue publishes. Clear that snapshot before members join, while preserving cached replay for ordinary joins to existing playback.

Carry the actual protocol owner and takeover token through group formation, automatic power-on, and playback. Finish with current metadata on success and abort on failure or cancellation. Generation checks and serialized publication prevent stale asynchronous artwork or metadata work from repopulating the cleared snapshot.

Keep artwork cache updates tied to successful publication and build metadata as a single Metadata result. Include end-to-end fake-power, protocol-owner, cancellation, artwork, and progress regressions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new takeover-token ownership contract needs documentation before approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Fixes stale Sendspin metadata appearing when a sync group takes ownership of playback.

Changes:

  • Adds transactional metadata takeover handling with generation guards.
  • Coordinates group formation, auto-power, playback, and takeover cleanup.
  • Adds regression coverage for success, failure, cancellation, and stale artwork races.
File summaries
File Description
music_assistant/controllers/players/controller.py Coordinates takeover transactions during grouping and playback.
music_assistant/models/player.py Adds generic playback-preparation and takeover hooks.
music_assistant/providers/sendspin/player.py Serializes and generation-guards metadata publication.
music_assistant/providers/sync_group/player.py Carries takeover ownership through group formation and playback.
tests/controllers/players/test_active_protocol_lifecycle.py Tests initial group capture ordering.
tests/controllers/players/test_player_controller.py Tests takeover ownership and failure cleanup.
tests/controllers/players/test_player_grouping.py Updates membership-call expectations.
tests/providers/sendspin/test_content_takeover.py Adds Sendspin takeover race regressions.
tests/providers/sendspin/test_explicit_stop_bridge_notify.py Updates stop test setup.
tests/providers/sendspin/test_resume_progress_extrapolation.py Tests metadata preservation behavior.
tests/providers/sendspin/test_stop_progress_freeze.py Updates stop test setup.
tests/providers/sync_group/test_sync_group.py Tests takeover lifecycle within sync groups.
Review details

Suppressed comments (1)

music_assistant/controllers/players/controller.py:3665

  • [PROBLEM] This helper now accepts new_content and transfers ownership of a takeover token, but its existing parameter documentation omits both parts of that contract; document them to prevent callers from leaving metadata publication suppressed.
        *,
        new_content: bool = False,
    ) -> tuple[Player, object] | None:
  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread music_assistant/controllers/players/controller.py
@teancom

teancom commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Feedback addressed, thank you @OzGav

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants