Skip to content

Re-pin sendspin-cpp to 78b13d5e, move off its deprecated APIs and read pairing from is_paired() - #115

Merged
chrisuthe merged 6 commits into
mainfrom
chore/repin-sendspin-cpp-3a3722a8
Nov 19, 2026
Merged

chrisuthe merged 6 commits into
mainfrom
chore/repin-sendspin-cpp-3a3722a8

Conversation

@chrisuthe

@chrisuthe chrisuthe commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Why

sendspin-cpp#218 adds SendspinClientConfig::application_roles, which #110 needs for local pairing. Moving the pin past it also brings sendspin-cpp#234, which removes ConnectionTrust and on_trust_changed() in favour of SendspinClient::is_paired(), so the pin cannot move without this migration.

What

  • Pin 78b13d5e, sendspin-cpp main with #263 merged, 45 commits past b0fcf5bb. An intermediate pin, 3c28f669, broke the linux-armv6 build: CONNECTION_BLOCK_BYTES left 32 bytes for the shared_ptr control block, and Raspbian's libstdc++ uses the mutex lock policy, which needs 48. #263 fixes that.
  • Off the library's deprecated APIs. sendspin-cpp #258, #260 and #261 deprecate the callbacks and accessors this CLI used, and -Werror turns each use into an error. The CLI now overrides on_pairing_attempt, on_paired, on_pairing_aborted, on_pairing_code and on_track_metadata, and reads server_information() and client_pairing_token(). Their text arrives as std::string_view, valid only for the callback or until the next loop(), so whatever status, the hooks or the state store keep is copied first. status keeps only the artist, title and progress it reports.
  • PairingListener polls is_paired() once per main-loop tick instead of the removed callback, reading it before is_connected() as the library asks. It still logs Connected server is paired / not paired when a session is new or has been re-keyed.
  • A pairing attempt is forgotten when its connection drops, not when a new one comes up. A new session's first server/activate can start pairing, and client.loop() delivers its start before is_connected() first reads true, so clearing on the rising edge wiped the live attempt and status reported pairing: none during the exchange. PairingListener moves to its own file so that ordering can be tested.
  • A pairing attempt the server cancels with a server/activate is forgotten. At this pin that ends the attempt with no callback: on_trust_changed, which used to clear it, is gone, and the prompt dismissals fire only for an attempt that showed a code or a window. The library arms a 120 s deadline when an attempt starts, so an attempt that shows no prompt has an outcome, a timeout or a dropped connection by then unless the server cancelled it; the listener forgets such an attempt 150 s after it first saw it. A dropped connection forgets only an attempt an earlier tick saw, since one loop() delivered in the same pass may be the next session's. Known limit: a cancelled token attempt still shows in status for up to 150 s; reporting the cancel needs a library callback.
  • status reads is_paired() before is_connected() too. The trust line is paired, unpaired or not connected as before. unknown is gone: a connected session is always one or the other.
  • docs/ROADMAP.md item 3 names the new pin. None of the library gaps it lists is closed by these commits.

Compatibility

No flag, config key, control-socket message, state format or exit code changes. The only visible difference is that status no longer prints trust: unknown.

Testing

At 78b13d5e with main merged in (90bfa89), -DSENDSPIN_CLI_WERROR=ON, no warnings:

  • Linux (Ubuntu 24.04 under WSL, gcc 13, ALSA only): ctest 558/558 passed; scripts/smoke_test.sh: every check passed. --version reports sendspin-cpp 78b13d5e….
  • Windows (clang-cl, PortAudio): ctest 550/550 passed (the existing symlink test is skipped, as on main).
  • ARMv6, before the merge of main, in the same Raspbian image and with the same options as build-armv6.yml, under qemu: builds, with all six audio backends and dns_sd found; readelf reports Tag_CPU_arch: v6 with hard-float. ctest 558 of 561 passed. The three failures are StateStore tests that make a directory read-only and expect a write to fail, and the container ran as root, which writes regardless; CI runs them unprivileged.
  • clang-format 20.1.8 on the changed files.
  • New tests/pairing_listener_test.cpp, 9 cases: an attempt started before the session reads connected is kept; one on a connection that stays is kept; one an earlier tick saw is forgotten when its connection drops, but one delivered in the loop that sees the drop is kept; an outcome or a withdrawn code or window ends it; an unprompted attempt is forgotten at the 150 s limit and not a millisecond before, a prompted one is not, and a new attempt restarts the clock. Disabling the fallback, or the same-loop rule, each fails exactly its test.

3a3722a8 is sendspin-cpp#218 as merged, which adds application-specific roles. It brings #234, which removes ConnectionTrust and on_trust_changed() for SendspinClient::is_paired(). The main loop now polls it and logs "Connected server is paired/not paired" when a session is new or re-keyed, as the callback did. status reads it before is_connected(), as the library asks. Its trust line loses "unknown": a connected session is always paired or not.

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

Clearing server_id_ on the first connected tick can discard a newly started pairing attempt and incorrectly report pairing: none; the callback ordering needs a fix and regression test.

1 open issue
What changed in this PR

Updates sendspin-cpp to 3a3722a8, enabling the application-role support needed for local pairing in #110, and migrates pairing state to the new is_paired() API.

Changes:

  • Re-pins the dependency and updates the roadmap reference.
  • Replaces trust callbacks with main-loop polling and direct pairing-state reads for status.
  • Updates status formatting and tests to remove the unknown trust state.
File Description
tests/​control_test.cpp Tests paired, unpaired, and disconnected status values.
src/​main.cpp Polls pairing state and migrates status snapshots to is_paired().
src/​control.h Replaces optional trust with a pairing boolean.
src/​control_common.cpp Formats trust using connection and pairing state.
docs/​ROADMAP.md Updates the documented dependency pin.
CMakeLists.txt Pins sendspin-cpp to 3a3722a8.

Review effort: Balanced

Comment thread src/main.cpp Resolved
…s up

A new session's first server/activate can start pairing, and loop()
delivers that start before is_connected() first reads true. Clearing
the attempt on the session's rising edge then wiped the live attempt,
and status reported no pairing while one was in progress.

Clear it on the falling edge instead: an attempt on a dropped
connection is the only one that never reports its end. PairingListener
moves to its own file so its tick and callback ordering can be tested.
Moves the pin to the head of sendspin-cpp main, seven commits past
3a3722a8. None of them touches is_paired(), is_connected() or the pairing
callbacks this PR relies on. connect_to() now takes its URL by value, which
the existing call site compiles against unchanged. None of the library gaps
listed in the roadmap is closed by these commits.
@chrisuthe chrisuthe changed the title Re-pin sendspin-cpp to 3a3722a8 and read pairing from is_paired() Re-pin sendspin-cpp to 3c28f669 and read pairing from is_paired() Nov 10, 2026
3c28f669 broke the linux-armv6 build: CONNECTION_BLOCK_BYTES left 32
bytes for the shared_ptr control block, and Raspbian's libstdc++ uses the
mutex lock policy, which needs 48. sendspin-cpp#263 fixes that and merged
as 78b13d5e.

The commits between them deprecate the callbacks and accessors this CLI
used, and -Werror turns each use into an error. The CLI now overrides
on_pairing_attempt, on_paired, on_pairing_aborted, on_pairing_code and
on_track_metadata, and reads server_information() and
client_pairing_token(). Their text arrives as string_view, valid only for
the callback or until the next loop(), so whatever status, the hooks or
the state store keep is copied first.
@chrisuthe chrisuthe changed the title Re-pin sendspin-cpp to 3c28f669 and read pairing from is_paired() Re-pin sendspin-cpp to 78b13d5e, move off its deprecated APIs and read pairing from is_paired() Nov 12, 2026
At this pin a server that cancels pairing with a server/activate ends the
attempt with no callback at all: on_trust_changed, which used to clear it,
is gone, and the prompt dismissals fire only for an attempt that showed a
code or a window. A token attempt cancelled that way stayed in status as
in progress until the connection dropped.

The library arms a 120 s deadline when an attempt starts, so an attempt
that shows no prompt has an outcome, a timeout or a dropped connection by
then unless the server cancelled it. The listener now forgets such an
attempt 150 s after a tick first saw it.

A dropped connection now forgets only an attempt an earlier tick saw. One
that loop() delivered in the same pass may be the next session's first
attempt.
Brings in #116, so macOS builds on the macos-15 runner, and everything since through #119.
@chrisuthe
chrisuthe merged commit de09eb9 into main Nov 19, 2026
28 of 31 checks passed
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.

2 participants