Skip to content

fix(loop-link): linear frame reads, safe Ctrl-C, no local token to remote hosts - #410

Merged
lachlangrose merged 3 commits into
masterfrom
fix/loop-link-transport
Nov 25, 2026
Merged

lachlangrose merged 3 commits into
masterfrom
fix/loop-link-transport

Conversation

@lachlangrose

Copy link
Copy Markdown
Member

Fixes three problems found in a repo audit.

  • Receiving large frames took quadratic time. _read_exactly appended to an immutable bytes buffer, copying it on every chunk. A 32 MB frame took 42 s; it now takes 0.2 s (bytearray buffer).
  • Ctrl-C during a send or receive left the link broken but "connected". A half-written frame stayed on the wire, and later sends wrote into it and reported success. The client now aborts on any interrupt in the middle of a frame. Viewer and ToolConnection see the closed client and reconnect on the next call. An interrupt while the client waits for a new frame does not close it.
  • The saved local token went in plain text to remote hosts. Viewer(host="10.x") with no token= sent the token from ~/.geoviewer/link.json. For a host that is not loopback, only an explicit token or GEOVIEWER_TOKEN is used now, instance files are not read, and a warning says the link is not encrypted. ViewerAddress.__repr__ no longer prints the token.

Behaviour change: a remote user who relied on the saved local token now gets a TokenError, and must pass token= or set GEOVIEWER_TOKEN. The README says so.

Tests: cd packages/loop_link && pytest gives 817 passed, 66 skipped. Each fix has a regression test that fails without it.

🤖 Generated with Claude Code

lachlangrose and others added 3 commits November 25, 2026 16:21
…fter an interrupted send

The receive buffer was bytes, so each chunk copied the full buffer: a 64 MB
frame took 40 s. The buffer is now a bytearray.

A Ctrl-C in the middle of a frame left half a frame on the socket, and the
next send wrote into it. Now any exception during a frame write closes the
client, and the next Viewer send opens a new connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
For a host that is not loopback, find_viewer now uses only an explicit
token or GEOVIEWER_TOKEN. It does not read link.json or the instance files,
and it gives a warning because the link is not encrypted. The repr of
ViewerAddress does not show the token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ToolConnection kept a client that closed itself after a broken send, so
the next request failed one time. It now drops a closed client and opens
a new one, and connected is False for a closed client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lachlangrose
lachlangrose merged commit bbd093c into master Nov 25, 2026
21 checks passed
@lachlangrose
lachlangrose deleted the fix/loop-link-transport branch November 25, 2026 21:29
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