Skip to content

Fix sendspin-jvm adapter for ServerState.metadata type change - #107

Merged
OnFreund merged 2 commits into
mainfrom
claude/fix-sendspin-jvm-adapter-server-state
Sep 17, 2026
Merged

OnFreund merged 2 commits into
mainfrom
claude/fix-sendspin-jvm-adapter-server-state

Conversation

@OnFreund

@OnFreund OnFreund commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This kept peeling back a layer at a time, all from the same root cause: Sendspin/sendspin-jvm#33 adopted several spec renames that aiosendspin hadn't caught up to yet.

  1. Build break (fixed): sendspin-jvm#33 wrapped ServerState.metadata/controller/color in JsonOptional<T> (fixing a real bug — distinguishing "role omitted" from "role explicitly null" per spec PR #175). Broke this repo's sendspin-jvm adapter, which read state.metadata as a plain TrackMetadataMsg?. Fixed with the JsonOptional.orNull() idiom this file already uses elsewhere.

  2. Artwork field rename (fixed, merged): once the build was fixed, the full aiosendspin -> sendspin-jvm matrix failed all 9 scenarios — sendspin-jvm's PR [Spec coverage] External source handling (state: 'external_source') #33 batch also adopted spec PR #168 (media_width/media_height → width/height, BMP dropped), which aiosendspin didn't support yet, so it rejected every client/hello as malformed. Fixed in Sendspin/aiosendspin#343 (merged) plus this repo's own aiosendspin_client.py/aiosendspin_server.py adapters, which also used the old field names.

  3. Player delay field rename (fix opened, includes backward-compat like #343): with #343 merged, client/hello now parses, but client/state fails one layer deeper — sendspin-jvm sends output_delay_ms and declares set_output_delay in supported_commands (also from the PR [Spec coverage] External source handling (state: 'external_source') #33 batch, spec PR #164), which aiosendspin still calls static_delay_ms/set_static_delay. Fix opened: Sendspin/aiosendspin#351, which also tolerates clients still on the old spelling (mirroring #343's pattern).

This PR depends on #351 merging for the full matrix to go green, since the harness resolves aiosendspin as a sibling git checkout, not a pinned/published version.

Test plan

  • python -m conformance.build (build_selected_adapters({"sendspin-jvm-client"})) succeeds
  • import conformance.adapters.aiosendspin_server smoke-test import passes
  • Full conformance matrix (conformance run --from aiosendspin --to sendspin-jvm) — needs Sendspin/aiosendspin#351 merged first; re-run this PR's CI once that lands (there may be further layers — each fix so far has surfaced the next one deeper in the handshake)

🤖 Generated with Claude Code

OnFreund and others added 2 commits August 30, 2026 18:26
sendspin-jvm's Sendspin/sendspin-jvm#33 wrapped ServerState.metadata/
controller/color in JsonOptional<T> to fix a bug where the client
couldn't distinguish "role omitted" (leave unchanged) from "role
explicitly null" (clear), per spec PR #175. This adapter read
state.metadata as a plain TrackMetadataMsg?, breaking the build.

Fixed using the same JsonOptional.orNull() idiom this file already
uses elsewhere (e.g. meta.title.orNull() in addMetadataFields).
Functionally equivalent to the old code for the non-null-clearing
case this adapter cares about (tracking the last received metadata
value).

Verified: `python -m conformance.build` succeeds for sendspin-jvm-client
and the aiosendspin_server smoke-test import passes locally. Could not
exercise the full conformance matrix in this sandbox (client/server
socket timeouts even against the previous, already-passing commit —
a local networking limitation, not a regression from this change).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…dth/height rename

aiosendspin's own ArtworkChannel model (fixed in a companion PR to
Sendspin/aiosendspin) is being updated for spec PR #168 ("Letterbox art
and remove BMP support"): media_width/media_height -> width/height,
and BMP dropped from PictureFormat entirely. This adapter constructed
ArtworkChannel directly with the old kwarg names and referenced
PictureFormat.BMP, which would break once that aiosendspin fix lands.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Sep 8, 2026
…t, drop BMP (#343)

## Summary

Implements [spec PR #168](Sendspin/spec#168)
("Letterbox art and remove BMP support"), which aiosendspin hadn't
caught up to yet:

- `ArtworkChannel` (the `artwork@v1_support` object in `client/hello`)
and `StreamRequestFormatArtwork` (`stream/request-format`):
`media_width`/`media_height` → `width`/`height`.
- `PictureFormat`: `'bmp'` is out of the spec's format set (servers must
support `'jpeg'` and `'png'`), but stays parseable and encodable for
clients that still declare it.
- Letterboxing (scale to fit + pad the remaining area with black, never
crop) was **already implemented** in `ArtworkGroupRole._letterbox_image`
— no behavior change needed there, it already matches the new "deliver
at exactly `width` x `height`" requirement.
- Both superseded spellings stay accepted: `media_width`/`media_height`
are rewritten to `width`/`height` on parse, and a `'bmp'` declaration is
still served as BMP. Each routes through `flag_noncompliance`, so a
lenient server logs once and keeps working while
`allow_noncompliant_clients=False` rejects the client.

## Why now

This was surfaced by
[Sendspin/sendspin-jvm#33](Sendspin/sendspin-jvm#33)
adopting the new field names ahead of aiosendspin. Once that merged,
`Sendspin/conformance`'s cross-SDK matrix started failing every
`aiosendspin -> sendspin-jvm` scenario (9 of them) — not just the
artwork one — because aiosendspin was rejecting `client/hello` outright
as malformed (`media_width`/`media_height` are required fields, and
sendspin-jvm no longer sends them). See
[Sendspin/conformance#107](Sendspin/conformance#107)
for the client-side half of this (the conformance harness's own
artwork-scenario code also constructed `ArtworkChannel` with the old
kwarg names).

## Test plan

- [x] `pytest tests/server/roles/artwork/
tests/test_client_protocol_callbacks.py
tests/server/test_multi_server.py` — 114 passed
- [x] Full repo suite otherwise unaffected — 9 pre-existing failures
elsewhere in this sandbox are native `av`/PyAV extension loading
timeouts (confirmed unrelated: none touch `artwork`/`PictureFormat`)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Maxim Raznatovski <nda.mr43@gmail.com>
chrisuthe added a commit to Sendspin/aiosendspin that referenced this pull request Sep 15, 2026
## Summary

Implements [spec PR #164](Sendspin/spec#164)
("rename static_delay_ms to output_delay_ms"), which aiosendspin hadn't
caught up to yet:

- `PlayerStatePayload.static_delay_ms` → `output_delay_ms`
- `PlayerCommandPayload.static_delay_ms` → `output_delay_ms`
- `PlayerCommand.SET_STATIC_DELAY` (`"set_static_delay"`) →
`SET_OUTPUT_DELAY` (`"set_output_delay"`)
- `StaticDelayChangedEvent` → `OutputDelayChangedEvent` (a public event
type this repo exposes, not wire-facing, but part of the same rename —
missed in the first commit, fixed in the second)

Applied consistently across the server-side player role, client-side
model usage, and docstrings.

**Backward compatibility** (mirroring
[#343](#343 "keep serving
clients on the pre-rename artwork wire"): a client still using
`static_delay_ms`/`set_static_delay` is tolerated, not disconnected.

- `PlayerCommand.SET_STATIC_DELAY` stays a valid enum value.
- `PlayerStatePayload.__pre_deserialize__` rewrites incoming
`static_delay_ms` onto `output_delay_ms`, recording `legacy_delay_key`
so `PlayerV1Role.client_state_deviations()` flags it — tolerated when
the server allows noncompliant clients, rejected in strict mode via the
existing `flag_noncompliance` machinery (no new enforcement path
needed).
- `set_output_delay()` now addresses the client using whichever spelling
it declared in `state_supported_commands` — a client that only ever
declared `set_static_delay` wouldn't recognize a `set_output_delay`
command in `server/command`.
- `PlayerCommandPayload.__post_serialize__` serializes `output_delay_ms`
under the wire key matching `command`, so constructing the payload with
`command=SET_STATIC_DELAY` produces the pre-rename wire shape from the
same Python-side field.

## Why now

Same root cause as #343:
[Sendspin/sendspin-jvm#33](Sendspin/sendspin-jvm#33)
adopted the new field names ahead of aiosendspin. Once #343 merged and
got a sendspin-jvm client's `client/hello` past the artwork-parsing
failure, `client/state` then failed for the same reason one layer deeper
— a sendspin-jvm client sends `output_delay_ms` and declares
`set_output_delay` in `supported_commands`, and aiosendspin rejected it:
`"'set_output_delay' is not a valid PlayerCommand"`. See
[Sendspin/conformance#107](Sendspin/conformance#107)
for where this surfaced (re-running the matrix after #343 merged).

## Test plan

- [x] Full test suite: `pytest -n0` (xdist disabled — its worker-spawn
native `av`/PyAV extension loading is flaky in this sandbox, independent
of this change) — 1606 passed, 8 skipped, 0 failed
- [x] `ruff check` and `ruff format --check` both clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Chris Uthe <chris.uthe@openhomefoundation.org>
@OnFreund

Copy link
Copy Markdown
Contributor Author

The failures are unrelated to sendspin-jvm and exist on master.

@OnFreund
OnFreund merged commit e081e3f into main Sep 17, 2026
4 of 8 checks passed
@OnFreund
OnFreund deleted the claude/fix-sendspin-jvm-adapter-server-state branch September 17, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant