Skip to content

refactor(host): cut the viewer connection and terminal seams - #2837

Open
fpresta0607 wants to merge 4 commits into
mainfrom
feat/2366-host-seams
Open

fpresta0607 wants to merge 4 commits into
mainfrom
feat/2366-host-seams

Conversation

@fpresta0607

Copy link
Copy Markdown
Owner

What Changed

  • Added hostConnection and terminal interfaces in a new platform-neutral internal/host/host.go, and moved the serving logic out of host_windows.go into it: RunArgs, handshake and farewell timeouts, greet, serve, Answer, and a new runTerminal that drives a terminal over connections from an injected accept function. The Windows pipe listener, serveStream, StreamViewer and StreamWriter now take a hostConnection instead of *os.File.
  • Made client.go, delivery.go and screen.go build on every platform (renamed from *_windows.go). The stub Client, Delivery, ReadScreen and Answer in host_other.go and stream_other.go are gone, so off Windows the shared code now runs and fails at a dialPipe stub that returns the not-ported error. One visible difference: ReadScreen off Windows now prefixes that error with host: read the screen of terminal <id>: .
  • Added host_test.go, which uses a fake terminal and net.Pipe connections to test input from viewers and deliveries, resizes, exit codes, query answers, and handshake refusals. Added host_other_test.go, which checks that Dial, View, Watch, DialDelivery, Answer and ReadScreen return errors wrapping errors.ErrUnsupported off Windows.

Risk Assessment

Validation text withheld because intent publication is disabled. Full results remain in the local run record. Recorded finding counts by snapshot: Intent: final unavailable, rounds [1: unavailable]; Rebase: final unavailable, rounds [1: unavailable]; Review: final 1, rounds [1: 2, 2: 1]; Test: final 0, rounds [1: 0]; Document: final 0, rounds [1: 0]; Lint: final unavailable, rounds [1: unavailable]; gate.lint.tests-kept: final unavailable, rounds [1: unavailable]; Push: final unavailable, rounds [1: unavailable].

Pipeline

Updates from git push no-mistakes

  • Intent: completed

  • Rebase: completed

  • Review: completed

  • Test: completed

  • Document: completed

  • Lint: completed

  • gate.lint.tests-kept: completed

  • Push: completed

The host's run loop, its serving of viewers, its client and its delivery
were written against a Windows named pipe and pseudo console, so a Linux
host would have to copy them. The viewer connection and the terminal are
now small interfaces, and everything that needs no Windows call moves to
untagged files unchanged, leaving the pipe, the pseudo console's start
and the launch in the Windows files. Tests of serving on a fake terminal
and an in-memory connection now run on every system.
The new host tests bounded each wait to 10 s, under the 30 s floor the
repository's stall check sets for a bound that only keeps a hung test
from waiting forever, so the check failed on every system. The bound
times nothing, so it is a minute, as the package's other waits are.

This branch has not been deployed

No deployments
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