Skip to content

Move to protocol version 8: application icons and session details - #15

Draft
Wavesonics wants to merge 21 commits into
masterfrom
v8-icons
Draft

Wavesonics wants to merge 21 commits into
masterfrom
v8-icons

Conversation

@Wavesonics

@Wavesonics Wavesonics commented Nov 15, 2026 •

Copy link
Copy Markdown

Moves the app to protocol version 8 and adds what it brings: application icons and session details (such as a browser tab title) in each row.

Breaking: this version of the app speaks protocol version 8 only. It does not work with the original C# PcVolumeControlWindows server (version 7) and needs PcVolumeControlServer. Against an older server it disconnects and tells the user to update the server.

Left as a draft on purpose: two test-host crashes on earlier commits of this branch are still unexplained (see Testing).

What it changes

  • Version 8 both ways: every outgoing message carries protocolVersion 8. A full state with another version is rejected before the rest is decoded; the app disconnects without reconnecting and shows a localised message: a lower version means the server needs updating, a higher one means the app does.
  • No feature gate: there is no features list. Icons are requested for any unknown iconId; a server without icons simply never sends one and rows keep the placeholder.
  • Opaque session ids: session updates are sent with the current state's defaultDevice.deviceId instead of a device id searched for inside the session id. The old parsing of |PCVC# purpose suffixes out of session ids is gone too.
  • Line handling and framing: lines are classified by key (defaultDevice is a full state, icon an icon reply, anything else ignored). LineFramer handles split reads and icon lines of several hundred KiB, drops a trailing CR, skips blank lines and discards lines over 4 MiB. A full state that cannot be decoded ends the connection and goes through the normal reconnect path.
  • Icons: IconRequestPlanner (pure) requests only ids neither cached nor outstanding, at most 32 per request and 64 outstanding, at the row's pixel size (points times display scale, clamped to 16..256). Ids with no usable image are not asked for again until the user connects anew; outstanding ids reset when the connection drops or the app goes to the background. IconRepository (actor, decodes off the main thread, bounded memory cache) sits over IconDiskCacheDataSource (Caches/AppIcons, keyed by id and size, count bounded, ids validated before use in a path).
  • Session details: shown under the name or the user's alias, smaller and dimmer, on one line, truncated at the tail. Every row reserves that line so heights never change as details come and go; changes are not animated and never reorder rows. Details are display only: aliases and saved order key on the session id, outgoing updates never include them, and a detail-only state keeps the values of a slider being dragged. VoiceOver reads the name, then the detail.
  • UI: SessionIconView beside the name (icon or a same-size placeholder, scales with Dynamic Type, hidden from VoiceOver).
  • Setup guide and docs: the in-app guide links to PcVolumeControlServer releases and its copy is platform neutral (firewall advice names TCP 3000 and mDNS, addresses are on the server's Status page); README and the repository's contributor notes describe version 8, icons and details, and the new server requirement.
  • Test seam: ServersRepository takes a transport factory (defaulting to the socket transport) so tests can drive MainViewModel with a scripted server.
  • mDNS discovery is unchanged: it does not read TXT records, so an older server still appears in the list and connecting to it shows the version message.

CI changes

  • The workflow only triggered for main, which does not exist; it now also triggers for master.
  • The periphery Homebrew tap no longer installs on current Homebrew, so CI installs the pinned 3.8.0 release binary.
  • Superseded runs are cancelled.
  • On test failure, the raw xcodebuild log, the result bundle and crash reports are uploaded as test-diagnostics (kept 7 days).

Testing

Developed without a local build: compiled and tested only by CI (test and periphery jobs). It has not been run on a device or simulator by hand, and has not been connected to a real server from the app.

The final commit (7681fab) passed both jobs on the first attempt, without reruns: 93 tests, no failures, no test-host crash. Unit tests cover:

  • version 8 and version 7 states (the older one rejected with the right message), a newer version rejected even when its state cannot be decoded, every outgoing message saying version 8;
  • the view model against a scripted older or newer server: it disconnects, shows the matching message and does not try to reconnect;
  • the protocol repo's reference example full state (examples/full-state.json);
  • session updates going to the default device for an opaque session id;
  • decoding states with and without icons and details, line classification (unknown, malformed, both keys), icon replies (real captured image and notFound), framing (split reads, one-byte reads, a 1.5 MB line, overlong lines);
  • the request planner (dedupe, 32 per batch, 64 outstanding, unavailable ids, reconnect), the disk cache (store, load, bound, invalid ids), the icon repository;
  • detail-only updates keeping row order, identity and edited values; outgoing updates not including details; the spoken row name.

Test-host crashes: two test-host crashes happened on earlier commits, in older MainViewModelSimpleTests tests (testReconnectGoesThroughReconnectingState and testDeinitCleansUpObservers). They have not recurred in any of the runs since the diagnostics upload was added, so there is no crash report and their cause is unknown. One of those tests was also timing sensitive; it now records every status change instead of polling.

Not verified: the look of rows with icons, placeholders and details; VoiceOver output; the mismatch alert and navigation on screen; real connections to a version 8 or version 7 server.

Manual test (needs a Mac)

  1. Connect to a PcVolumeControlServer: rows show placeholders, then icons; apps sharing an icon show the same one.
  2. Relaunch and reconnect: icons appear at once from the cache.
  3. Drop the connection and reconnect: icons keep working, no repeated requests in the server log.
  4. Change Dynamic Type: rows and icons scale, sharper icons are fetched.
  5. Play several Firefox tabs on a Linux server: each row shows its tab title, rows do not jump or change height as titles change, dragging a slider is not disturbed while a title updates. Set an alias on one: the alias replaces the name and the title still shows beneath it.
  6. Change a session's volume and mute, the master, and the default device: all apply on the server.
  7. Connect to the original C# Windows server: the app disconnects and says the server needs updating.
  8. VoiceOver: icons are not announced; a row with a detail reads the name, then the detail.

The periphery Homebrew tap cask no longer installs on current Homebrew. Also cancel superseded CI runs.
Lines with defaultDevice are full states, lines with icon are icon replies, and anything else is ignored instead of ending the connection. The full state decodes the v8 features list and per-session iconId. Framing now searches only new bytes, drops a trailing CR, skips blank lines and discards lines over 4 MiB.
An undecodable full state ends the connection as before; other unrecognized lines are still ignored. Treat any non-null icon error and empty icon data as no image, discard overlong lines completed within one read, reuse one JSON decoder, and merge edited sessions without rebuilding every field.
When the server lists the icons feature, ids that are not cached are requested in batches of at most 32 with at most 64 outstanding. Ids the server has no image for are not asked for again until the user connects anew. Icons are decoded off the main thread and cached in memory and in Caches, and each session row shows its icon or a placeholder of the same size.
Cache icons by id and requested pixel size so a larger Dynamic Type size fetches sharper icons, and share one sizing function between the row and the request. Request more ids whenever a full batch fits, drop replies that were not asked for, keep ids being decoded from being requested again, ignore lookups and decodes that finished after a size change or disconnect, load cached icons in one batch, and evict the disk cache only when its maintained count exceeds the bound.
@Wavesonics Wavesonics changed the title Show application icons from v8 servers Move to protocol version 8: application icons and session details Nov 16, 2026
Polling every 10 ms missed the 0.1 s reconnecting phase whenever the main thread was busy for longer, which failed the test on CI.
Mark an undecodable icon unavailable even when the drawn size changed meanwhile, reset outstanding icon ids when going to the background (the stream ends there), wait for the reconnect test's final state with an expectation and assert the exact status sequence, and describe the reconnect-on-bad-state and features behaviour accurately.
Decode the optional v8 session detail and show it beneath the name or alias on one line, in a smaller and dimmer style. Every row reserves the detail line so heights stay fixed as details come and go, changes are not animated, and VoiceOver reads the detail after the name. Details are display only: aliases, saved order and outgoing updates are unchanged.
Order same-named sessions by id, trim details before showing them, name the detail in the rename prompt, share line styling with the hidden height reservation, and skip widget and saved-order writes for states that change neither. The outgoing-update test now goes through the view model.
Drop the widget write skip, which needed per-path resets and could leave the widget stale after returning to the foreground. Read the saved order once per state, sort same-named sessions by id with numbers compared numerically, capture the detail when the rename prompt opens, keep a single order write path, and add the new prompt string to the catalog.
Send protocolVersion 8 in every message and reject a full state of another version before decoding the rest: the app disconnects without reconnecting and says whether the server or the app needs updating. Drop the features list and request icons for any unknown icon id. Session updates go to the current default device instead of a device id searched for in the opaque session id. Point the setup guide and README to PcVolumeControlServer.
Stop parsing session ids for purpose suffixes (ids are opaque and no server sends them), make the in-app server copy platform neutral, drop the unused synchronous session update and the protocol version alias, and fix a stale comment.
The version bump changed only the expected line, not the split chunk feeding it.
Firewall advice names the port and mDNS instead of Windows Firewall only, step 3 points to the server's Status page, and the README intro no longer says Windows only.
ServersRepository takes a transport factory so tests can drive MainViewModel with a scripted transport: an older or newer server is left with the right message and no reconnect.
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