fix(channel): diagnostics for a pairing that never completes, and 201 for watches up to v0.5.0 #62

Merged
dawid merged 2 commits from relay-old-watches into main 2026-11-19 13:16:32 +00:00
Owner

A pairing that ends with "the watch hasn't answered" says nowhere why. The watch runs v0.5.1, and the relay and its proxy work end to end: I acted out a pairing by hand against production, and the message reached the waiting poll the moment it was sent. So this PR makes the next attempt show where it stops, from both ends.

Relay request log (RELAY_LOG=1 in the app panel's environment; compose.yaml passes it on):

  • One line per request: the route with {id} for the channel, the status, the time taken, and a poll's number of messages.
  • No IDs, addresses, tokens or bodies. Off by default.
  • The privacy page (English and German) now mentions it.
  • docs/dev/deployment.md#relay-log shows what a working pairing looks like in the log.

Pairing screen on the watch: a line under "Pairing" shows what the link is doing, or what last went wrong:

  • Creating the channel / Channel created (201) / Waiting for the phone;
  • Relay not reached (code), Poll failed (code), or no phone (-104) without a Bluetooth link to Garmin Connect;
  • Message refused: wrong key / clocks apart / replayed / malformed, or Message broke: … when opening the viewer's message throws. Until now such messages were dropped silently.

Also: the relay answers 201 with {} again for a channel created again. The watch apps up to v0.5.0 accept only 201, 204 or 409 there, and the viewer creates the channel first in every pairing. This doesn't affect v0.5.1.

Not tested on a device: the watch changes are compiled by CI only. The relay log has tests, including one that checks the event stream still flushes through it.

A pairing that ends with "the watch hasn't answered" says nowhere why. The watch runs v0.5.1, and the relay and its proxy work end to end: I acted out a pairing by hand against production, and the message reached the waiting poll the moment it was sent. So this PR makes the next attempt show where it stops, from both ends. **Relay request log** (`RELAY_LOG=1` in the app panel's environment; `compose.yaml` passes it on): - One line per request: the route with `{id}` for the channel, the status, the time taken, and a poll's number of messages. - No IDs, addresses, tokens or bodies. Off by default. - The privacy page (English and German) now mentions it. - `docs/dev/deployment.md#relay-log` shows what a working pairing looks like in the log. **Pairing screen on the watch:** a line under "Pairing" shows what the link is doing, or what last went wrong: - `Creating the channel` / `Channel created (201)` / `Waiting for the phone`; - `Relay not reached (code)`, `Poll failed (code)`, or `no phone (-104)` without a Bluetooth link to Garmin Connect; - `Message refused: wrong key / clocks apart / replayed / malformed`, or `Message broke: …` when opening the viewer's message throws. Until now such messages were dropped silently. **Also:** the relay answers 201 with `{}` again for a channel created again. The watch apps up to v0.5.0 accept only 201, 204 or 409 there, and the viewer creates the channel first in every pairing. This doesn't affect v0.5.1. **Not tested on a device:** the watch changes are compiled by CI only. The relay log has tests, including one that checks the event stream still flushes through it.
fix(relay): 201 for a channel created again, which watch apps up to v0.5.0 need
Some checks failed
CI / e2e (pull_request) Successful in 4m0s
CI / checks (pull_request) Successful in 36s
CI / relay (pull_request) Has been cancelled
CI / image (pull_request) Has been cancelled
CI / watch (pull_request) Has been cancelled
CI / android (pull_request) Has been cancelled
aaa2bc5cfe
Since #60 the relay answered 200 to a PUT of a channel that exists with the same
hashes. The watch apps up to v0.5.0 take only 201, 204 and 409 there and retry
anything else every 5 seconds without reaching their long-poll. In a pairing the
viewer creates the channel first, so such a watch never saw its hello and the
viewer said that the watch hadn't answered.
feat(channel): a request log for the relay and the link's status on the pairing screen
All checks were successful
CI / relay (pull_request) Successful in 1m31s
CI / checks (pull_request) Successful in 36s
CI / e2e (pull_request) Successful in 4m6s
CI / android (pull_request) Successful in 2m10s
CI / image (pull_request) Successful in 58s
CI / watch (pull_request) Successful in 3m18s
90faa22757
A pairing that never completes said nowhere why. The relay now writes a line
per request when RELAY_LOG=1 is set (route, status, time, a poll's number of
messages; no IDs, addresses, tokens or bodies), off by default, as the privacy
page now says. The watch's pairing screen shows under "Pairing" what the link
does or what last went wrong: a failed request's code, or why a message from
the viewer was refused (wrong key, clocks apart, replayed, malformed).
dawid changed title from fix(relay): 201 for a channel created again, which watch apps up to v0.5.0 need to fix(channel): diagnostics for a pairing that never completes, and 201 for watches up to v0.5.0 2026-11-19 13:12:18 +00:00
dawid merged commit 9ca756b826 into main 2026-11-19 13:16:32 +00:00
dawid deleted branch relay-old-watches 2026-11-19 13:16:32 +00:00
Sign in to join this conversation.
No description provided.