feat(desktop): add Connection log popout for handshake diagnosis #88
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VAPP-76-connection-log-popout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A "server says connected but the display is black" desktop session was only diagnosable by opening the browser devtools console, where every relay / WebRTC / framing diagnostic is written. The relay WebSocket's own onopen/onerror were never surfaced at all: the error slot was only ever cleared to None, so a relay WS error was invisible in the UI. This adds an on-screen, opt-in log of the desktop connection lifecycle so the failure is self-diagnosable without devtools.
A process-global ring buffer (cap 500, oldest dropped) records every connection-path event: the tunnel request/response legs, the relay WS open/close (with code/reason)/error, the rendezvous handshake, the WebRTC answer and webrtc0/webrtc1 signalling, the Direct/Relayed switchover, the first relay payload, the first screen-size frame, the tile-before-size (canvas unsized) warning, framing desync, and the RTC/decode failures. Each entry carries a timestamp, a direction category (agent->browser / browser->agent / local), and a message; the relay url stays redacted exactly as it already is in console output. The existing console calls are kept, the buffer is purely additive.
A "Connection log" toolbar button next to Detach/Refresh opens the buffer in a separate window.open popout (reusing the VAPP-75 popout primitive), rendering entries newest-last and appending live while open, with a Copy button that copies the whole buffer as plain text. The popout is torn down cleanly by reusing install_closed_poll plus a pagehide listener and a closed latch, so no interval or listener outlives it; teardown also closes it. A real ws.set_onerror handler is now installed in build. The buffer, its plain-text export, and the timestamp formatter are pure and host-tested; the VAPP-70/75 source guard is extended to fail the build if the error handler or the toolbar button regress.
#VAPP-76