Skip to content

Clear unset metadata and color fields on older clients - #453

Merged
maximmaxim345 merged 1 commit into
mainfrom
fix/legacy-state-null-fields
Oct 1, 2026
Merged

maximmaxim345 merged 1 commit into
mainfrom
fix/legacy-state-null-fields

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

What does this implement/fix?

Since #408, server/state sends full metadata and color objects with unset fields left out. Clients from before spec #175, like the aiosendspin client up to 9.1.1, still merge each object into the previous one, so a field that becomes unset (album, artwork, a color, progress) never clears, and a cleared progress keeps extrapolating.

Legacy connections now get every unset metadata and color field as an explicit null, which these clients read as a clear. Current clients still get the fields omitted.

Related issue or spec PR (if applicable):

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
  • Breaking change (changes the public API or the protocol in a way that is not backwards compatible): breaking-change
  • Refactor (no behavior change): refactor
  • Documentation only: documentation
  • Maintenance / chore: maintenance
  • CI / workflow change: ci
  • Dependencies bump: dependencies

@maximmaxim345
maximmaxim345 requested a balanced review from Copilot October 1, 2026 08:39
@github-actions github-actions Bot added the bugfix Fixes a bug label Oct 1, 2026

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.

Copilot review overview

🟢 Approval recommended

The compatibility behavior is narrowly scoped, matches the linked specification history, and has focused regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Adds legacy-client serialization so omitted metadata and color fields are sent as null, while current clients retain spec-compliant omission behavior.

Changes:

  • Introduces a legacy server/state serializer.
  • Selectively applies it to legacy connections.
  • Adds coverage for legacy and current clients.
File Description
aiosendspin/​models/​core.py Defines legacy state serialization.
aiosendspin/​server/​connection.py Applies legacy serialization when required.
tests/​server/​test_connection_writer.py Tests legacy nulls and current omission.

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

@maximmaxim345
maximmaxim345 merged commit 67dc5be into main Oct 1, 2026
4 checks passed
@maximmaxim345
maximmaxim345 deleted the fix/legacy-state-null-fields branch October 1, 2026 08:43
maximmaxim345 added a commit that referenced this pull request Oct 2, 2026
# What does this implement/fix?

<!-- Quick description and explanation of changes. -->

Since #434, clearing metadata or color sends `{"metadata": null}` or
`{"color": null}` to unencrypted clients. sendspin-cpp ignores a role
value that isn't an object, so ESPHome devices kept the old title,
artist, progress and colors after a clear.

These clients now get the timestamp-only object, which #453 already
expands into explicit null fields, the same shape 9.1.1 sent.
Deactivation is unchanged.

**Related issue or spec PR (if applicable):**

- #453

## Types of changes

<!--
Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the
matching label, and the release notes use it to sort this change.
-->

- [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`
- [ ] Breaking change (changes the public API or the protocol in a way
that is not backwards compatible): `breaking-change`
- [ ] Refactor (no behavior change): `refactor`
- [ ] Documentation only: `documentation`
- [ ] Maintenance / chore: `maintenance`
- [ ] CI / workflow change: `ci`
- [ ] Dependencies bump: `dependencies`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants