Skip to content

fix: inspector hardening (live-view timeout, heartbeat slot, select-from-screen retries) - #2

Open
rucindrea wants to merge 3 commits into
mainfrom
fix/inspector-hardening
Open

rucindrea wants to merge 3 commits into
mainfrom
fix/inspector-hardening

Conversation

@rucindrea

Copy link
Copy Markdown
Contributor

Three findings left over from the web inspector's code review on 7 Nov. Each one is its own commit.

Live view that never opens (LiveUpdateSocket)

A host that drops packets, or a wss:// connect to a plain ws server, left the socket waiting forever, so the inspector showed "Connecting" with no error. It now gives up after openTimeoutMs (default 5 s), the same option AppListSocket already has. It reports unreachable if the socket never opened, or notRegistered if it opened but the server never sent driverRegistered.

Heartbeat holding the command slot (AltSocket)

The idle getServerVersion ping used the 60 s command timeout and ignored failures. Since only one command runs at a time, a silent app made the next real command (a tap, a selection) wait up to a minute behind the ping.

  • Each ping now times out after heartbeatTimeoutMs: default 5 s, never longer than heartbeatMs.
  • No ping is sent while the app reports it is paused.
  • Three missed pings in a row close the socket with kind unresponsive and the new appStoppedAnswering() message. Any ping that gets a reply resets the count.

Select-from-screen retries (hightlightObjectFromCoordinatesScreenshot)

The app remembers earlier hits at a point and returns the next stacked object on each call. As a retried read, a late first reply plus a retry skipped an object. Two quick clicks at one point were also collapsed into one call. The command is now sent as input (never retried, never collapsed) in both the protocol client and the binding.

Checked

  • npm test: 179 passed (9 new tests).
  • npm run typecheck and npm run build are clean.

After merge

The web inspector pins v0.2.1. To pick these fixes up it needs a new tag (for example v0.2.2) and a lockfile repin in alttester-web. The version in package.json is left unchanged here.

A host that drops packets, or a wss:// connect to a plain ws server, left
LiveUpdateSocket waiting forever, so the inspector stayed on Connecting.
It now gives up after openTimeoutMs (default 5 s), as AppListSocket does,
and reports unreachable, or notRegistered when the socket opened.
The idle liveness ping used the 60 s command timeout and ignored failures,
so a silent app made the next real command wait up to a minute behind it.
Pings now time out after heartbeatTimeoutMs (default 5 s), are skipped
while the app is paused, and three misses in a row close the socket as
unresponsive.
The app cycles through stacked hits at a point, so a retry after a late
reply, or two clicks collapsed into one, selected the wrong object.
hightlightObjectFromCoordinatesScreenshot is now sent as an input command
in both the protocol client and the binding.
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