Skip to content

Move player supported_commands from client/hello to client/state - #400

Merged
chrisuthe merged 5 commits into
Sendspin:mainfrom
chrisuthe:chrisuthe/task/move-player-supported-commands-from-client-hello
Sep 16, 2026
Merged

chrisuthe merged 5 commits into
Sendspin:mainfrom
chrisuthe:chrisuthe/task/move-player-supported-commands-from-client-hello

Conversation

@chrisuthe

@chrisuthe chrisuthe commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Implements spec PR Sendspin/spec#177: player supported_commands moves from the client/hello player@v1_support object into the client/state player object, where it may change mid-session. Audit item B1 of #399 (PL-2, PL-3, PL-4, PL-7, R-4).

Server

  • PlayerStatePayload.supported_commands accepts volume, mute and set_output_delay, with set_static_delay still accepted under the existing spec-pr-164 tolerance. An empty list round-trips as [].
  • ClientHelloPlayerSupport.supported_commands is now optional, so a spec-shaped hello parses. Before this change, a hello without the field failed to parse and the client was disconnected.
  • PlayerV1Role.state_supported_commands is now the only place the role checks which commands a player accepts. set_volume and set_mute follow the latest client/state list, so a mid-session change takes effect without a reconnect. The list is reset on every connect, so no player command is sent before the connection's initial client/state (spec Bump ruff from 0.15.16 to 0.15.17 #270).
  • A volume or muted value reported without the matching command is now applied and carried on VolumeChangedEvent as a read-only value. It is no longer flagged or discarded.
  • initial_state_deviations checks the initial state's own list. An initial player state that omits supported_commands is flagged.

Client SDK

  • The hello never carries supported_commands.
  • The player state always carries the list, sending [] when there are no commands.
  • Commands an embedder sets on player_support.supported_commands are folded into the state list, so existing embedders keep working.
  • A server/command whose command is not in the last reported list is ignored and logged at debug level.
  • Breaking against pre-Fix stale player audio requirements after reconnect #177 servers: those servers require the hello field, so they cannot parse this SDK's hello. This is deliberate: backwards compatibility is a server-side obligation, and the SDK only speaks the current wire.

Tolerances added (all marked DEPRECATED(spec-pr-177), removed by #391)

Tolerance Where Removal
Hello player@v1_support.supported_commands is parsed (volume/mute only) models/player.py Drop the field
Such a hello is admitted and flagged via _flag_noncompliance; a strict server (allow_noncompliant_clients=False) rejects it server/connection.py Drop the check
Its commands join the state list from the first client/state on (with or without a state list) and are merged with later state lists, since a pre-#177 state list only ever held delay commands server/roles/player/v1.py (on_client_state, _legacy_hello_commands) Use the state list alone
Those commands satisfy the initial-state requirement instead of an omitted state list server/roles/player/v1.py (initial_state_deviations) Always require the state list
SDK folds player_support.supported_commands into the state list and strips it from the hello client/client.py, client/connection.py Remove with the model field

Legacy acceptance tests carry the same marker. The marker's <version> is left for the maintainer to fill in.

Known limitation of the merge: a client that declares volume/mute in its hello cannot withdraw them through client/state. That client is already flagged as non-compliant.

Out of scope

Closes #368

Player settability now comes from the supported_commands list in the latest
client/state player object, which accepts volume, mute and set_output_delay
and may change mid-session. Reported volume/muted without the matching
command is applied as read-only rather than discarded and flagged, and an
initial state omitting the list is flagged.

A hello still declaring supported_commands is accepted and flagged; its
commands seed the list on connect and extend any later state list.
The SDK no longer sends supported_commands in the hello. Commands an embedder
declares on player_support are folded into the state list, which is always
sent (as an empty list when there are none), and a server/command absent from
the last reported list is ignored.
@chrisuthe chrisuthe added the breaking-change Changes the public API or the protocol in a way that is not backwards compatible label Sep 16, 2026
@chrisuthe
chrisuthe requested a balanced review from Copilot September 16, 2026 13:36

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

Event callbacks can observe and act on the previous command-capability list.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Moves player command capabilities from handshake metadata to dynamic client state while retaining temporary legacy compatibility.

Changes:

  • Updates server models, validation, and command gating.
  • Updates SDK state reporting and unsupported-command filtering.
  • Adds unit, compatibility, and integration coverage.
File summaries
File Description
aiosendspin/models/player.py Updates player command models.
aiosendspin/server/connection.py Flags legacy hello declarations.
aiosendspin/server/roles/player/v1.py Tracks state-level command capabilities.
aiosendspin/client/client.py Merges legacy commands into state configuration.
aiosendspin/client/connection.py Reports capabilities and filters commands.
tests/models/test_player.py Tests model parsing and serialization.
tests/server/test_multi_server.py Tests strict and legacy hello handling.
tests/server/roles/test_player_v1.py Tests role capability behavior.
tests/test_client_protocol_callbacks.py Tests SDK reporting and filtering.
tests/integration/test_player_supported_commands.py Adds end-to-end coverage.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread aiosendspin/server/roles/player/v1.py Resolved

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.

🟢 Approval recommended

The implementation matches the specified protocol transition and includes comprehensive compatibility and integration coverage.

Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@chrisuthe
chrisuthe marked this pull request as ready for review September 16, 2026 14:12
@chrisuthe
chrisuthe merged commit 59bd6a7 into Sendspin:main Sep 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Changes the public API or the protocol in a way that is not backwards compatible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Player supported_commands lives in client/state, not client/hello

2 participants