Skip to content

Reduce ambiguity about the metadata's state#47

Merged
kahrendt merged 2 commits into
mainfrom
eliminate-metadata-trisate
May 8, 2026
Merged

Reduce ambiguity about the metadata's state#47
kahrendt merged 2 commits into
mainfrom
eliminate-metadata-trisate

Conversation

@kahrendt
Copy link
Copy Markdown
Contributor

@kahrendt kahrendt commented May 8, 2026

Replace the metadata role's empty-string approach to clearing old metadata with the new ServerMetadataStateDelta struct to reduce ambiguity for metadata's tri-state absent, null, or value.

This is a behavioral breaking change. The server clears old metadata states with a nullopt instead of an empty string. Updating the state where progress: null now properly clears the current progress info that before was never actually possible to clear.

…adata with the new ` ServerMetadataStateDelta` struct to reduce ambiguity for metadata's tri-state absent, null, or value.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR changes how server-sent metadata updates represent “clear” operations by introducing a dedicated wire-level delta type (ServerMetadataStateDelta) with tri-state fields (absent vs explicit null vs value), removing the previous empty-string clearing behavior to reduce ambiguity in merged metadata state.

Changes:

  • Introduced ServerMetadataStateDelta (tri-state per field) and updated server/state parsing to populate it.
  • Updated metadata delta application logic so explicit JSON null clears merged fields (including progress).
  • Updated docs and the TUI example to encourage overwriting mirrored display state each on_metadata() so clears propagate.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/protocol.cpp Adds tri-state parsing helpers, parses metadata into ServerMetadataStateDelta, and applies deltas to merged ServerMetadataStateObject with explicit-null clears.
src/protocol_messages.h Introduces ServerMetadataStateDelta, updates ServerStateMessage to carry metadata deltas, and updates delta-merge API signature/docs.
src/metadata_role.cpp Updates metadata role to accept/merge wire deltas in the shadow slot and apply them to the merged metadata state when due.
src/metadata_role_impl.h Updates shadow slot type and method signature to use ServerMetadataStateDelta (and adds needed include).
examples/tui_client/main.cpp Updates metadata listener to always overwrite title/artist/album (so server clears propagate).
docs/internals.md Updates internal shadow-slot documentation to reflect metadata delta type and clear behavior.
docs/integration-guide.md Adds guidance about nullopt representing both “never provided” and “explicitly cleared”, advising overwrite-on-update for UI mirroring.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/integration-guide.md
@kahrendt kahrendt merged commit 573669f into main May 8, 2026
4 checks passed
@kahrendt kahrendt deleted the eliminate-metadata-trisate branch May 8, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants