Repository navigation
Follow the spec rules for player state and commands - #196
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The ciphertext-mutation test needs a guaranteed outbound frame to avoid timing-dependent failures introduced by state deduplication.
1 open issue
What changed in this PR
This PR aligns the SDK’s player state and command handling with the current Sendspin protocol.
Changes:
- Send complete player state only after activation and when state changes; stop sending state on
stream/end. - Replace legacy delay fields and commands with
output_delay_msandset_output_delay, and advertise volume and mute support. - Update protocol tests, resolved compliance gaps, and output-delay terminology.
| File | Description |
|---|---|
| tests/unit/protocol-handler.test.ts | Update state, activation, and command assertions. |
| tests/unit/core.test.ts | Verify output-delay reporting and persistence. |
| tests/helpers/known-violations.ts | Remove resolved player-state compliance gaps. |
| tests/e2e/sendspin-security.e2e.test.ts | Enable the exact player-state integration assertion. |
| src/types.ts | Update protocol types and delay documentation. |
| src/index.ts | Rename delay terminology in a comment. |
| src/core/static-delay-store.ts | Update the persistence description. |
| src/core/protocol-handler.ts | Implement full-state deduplication and current commands. |
| public/app.js | Update a storage-key comment without changing the key. |
| index.html | Update the delay control’s help text. |
| CLAUDE.md | Update configuration terminology. |
Review effort: Balanced
33 tasks done
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?
The player's
client/statestill used the oldstatic_delay_mskey and only listedset_static_delay, so servers following the current spec couldn't read the player's output delay or change it.It also sent partial updates, and could send player state before
server/activate.Each
client/statenow carries the full player object withoutput_delay_ms, listsvolume,muteandset_output_delayas supported commands, and is only sent after the firstserver/activateand when something changed.The player handles
set_output_delayand ignores commands it doesn't list, andstream/endno longer sends aclient/state.Breaking changes:
ClientStateplayerstatic_delay_msis renamed tooutput_delay_ms, andrequired_lead_time_ms,min_buffer_msandsupported_commandsare now requiredServerCommandset_static_delayandstatic_delay_msare renamed toset_output_delayandoutput_delay_msset_static_delaycan no longer change the output delayRelated issue or spec PR (if applicable):
Types of changes
bugfixnew-featureenhancementbreaking-changerefactordocumentationmaintenancecidependencies