Skip to content

ci(terminal): run the browser terminal suite on Linux, Windows and real Safari - #260

Merged
zackees merged 6 commits into
mainfrom
ci/terminal-browser-suite
Sep 17, 2026
Merged

zackees merged 6 commits into
mainfrom
ci/terminal-browser-suite

Conversation

@zackees

@zackees zackees commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Fixes #259.

What changed

  • Linux CI (linux-x86-terminal-test.yml → _terminal-test.yml): builds the debug fastled, installs esbuild 0.28.0 and Playwright 1.62.0 Chromium + WebKit, runs all 4 cases of tests/frontend/test_terminal.py, and uploads the server log on failure.
  • Windows CI (windows-x86-terminal-test.yml): runs the slot-release regression against ConPTY. The interactive test drives a POSIX shell, so this job deselects it rather than skipping it.
  • Real Safari (ci/safari_terminal_smoke.py, run by macos-arm-live-test.yml via safaridriver):
    • the four-blocked-writer slot release, driven by Safari's own WebSocket;
    • a typed command rendered in xterm, with a screenshot artifact.
  • Test file:
    • Under CI, a missing binary, esbuild, Playwright or psutil fails the run instead of skipping.
    • The blocked-stdin test is platform-neutral: all four slots must come back within 5 s, with no surviving PTY master or blocked program.
    • Windows fixes: UTF-8 file IO, forward-slash imports, and answering ConPTY's cursor query.
    • FASTLED_PLAYWRIGHT_WEBKIT_ENDPOINT attaches WebKit to a Playwright server on hosts that can't install it.
  • Docs (docs/interactive-terminal.md):
    • The stale nix-shell gate is replaced by the CI gates and a portable local recipe.
    • The lifecycle text no longer claims a disconnect was seen during a blocked write.
    • Records the phase 4 decisions and the Windows finding.

RED → GREEN evidence

Throwaway commit 7682b49 restored the pre-#258 blocking write. It was pushed, run, and removed from the branch.

Check RED (blocking write) GREEN
Linux, blocked stdin, Chromium + WebKit failed: "leaked terminal slots" (run) 4 passed, 0 skipped (run)
Real Safari 26.6.1 failed: "leaked terminal slots", recoveredMs: None (run) slots back in 722 ms, SAFARI240 rendered (run)
Windows ConPTY, blocked stdin passes even with the blocking write (run) passes (run)

Phase 3 (Windows): no leak exists, so no fix

The issue inferred a Windows slot leak from code: kernal-api has no ConPTY write_available, so it falls back to a blocking WriteFile. Measurement disproved it.

So both kernal-api PRs were closed unmerged, and there is no v0.1.12. Acceptance criterion 4 can't be demonstrated RED, because the defect doesn't occur. The Windows job now guards it on every PR.

Phase 4 decisions (in docs/interactive-terminal.md)

  • Per-message cap: none beyond the 64 KiB WebSocket limit. The bounded write already slices a message and checks for disconnect between slices.
  • Non-blocking scope: only the bounded write (Unix O_NONBLOCK, toggled per call). The reader stays blocking on its own thread.

Local: bash test passes (304 Rust + 45 Python). Python lint is clean. No JSPI flags or code touched.

🤖 Generated with Claude Code

zackees and others added 5 commits September 16, 2026 19:58
…al Safari

- _terminal-test.yml builds the debug binary, installs esbuild and Playwright
  Chromium + WebKit, and runs tests/frontend/test_terminal.py. Linux runs the
  whole file; Windows runs the slot-release regression against ConPTY.
- Under CI the suite fails instead of skipping when its binary, esbuild,
  Playwright or psutil is missing.
- The blocked-stdin regression is platform-neutral: a per-platform non-reading
  foreground program, all four slots back within 5 s, and no surviving PTY
  master or blocked program (psutil, plus /proc on Linux).
- FASTLED_PLAYWRIGHT_WEBKIT_ENDPOINT attaches WebKit to a Playwright server for
  hosts that cannot install it.
- ci/safari_terminal_smoke.py drives real Safari through safaridriver in the
  macOS live test: the blocked-writer slot release from Safari's WebSocket, and
  a typed command rendered in xterm.

Refs #259

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The fixture read the server's log through the locale codec, which on Windows
(cp1252) fails on UTF-8 bytes before any test runs.

Refs #259

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…rward slashes

Windows decoded the frontend HTML through cp1252 and would have embedded
backslash paths in the fixture's JS import strings.

Refs #259

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
On Windows soldr builds for an explicit host triple, so the binary lives under
target/<triple>/debug and the fixed target/debug path did not exist.

Refs #259

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…eady timeout

The raw-WebSocket clients in the slot-release regression never answered the
cursor position query ConPTY sends at startup, which xterm answers in the real
page. The timeout now also carries the terminal output it saw.

Refs #259

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… decisions

Replace the stale nix-shell gate (a /tmp shell file, a pinned /nix/store
browser bundle and a personal worktree path) with the CI jobs and a local
recipe, including Playwright WebKit through a container on hosts that cannot
install it. Correct the lifecycle description, which claimed a disconnect was
observed even while a write was blocked (#256), and record the decisions on
per-message input bounds, non-blocking scope and Windows ConPTY.

Refs #259

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zackees
zackees force-pushed the ci/terminal-browser-suite branch from 7682b49 to 370fd61 Compare September 17, 2026 04:16
@zackees zackees changed the title ci(terminal): browser terminal suite in CI, real Safari, and the Windows slot leak ci(terminal): run the browser terminal suite on Linux, Windows and real Safari Sep 17, 2026
@zackees
zackees marked this pull request as ready for review September 17, 2026 04:18
@zackees
zackees merged commit c61364b into main Sep 17, 2026
18 of 36 checks passed
@zackees
zackees deleted the ci/terminal-browser-suite branch September 17, 2026 04:28
zackees added a commit that referenced this pull request Sep 18, 2026
CLI:
- `fastled <sketch>` no longer crashes with "Cannot drop a runtime" after
  starting the server (#269).
- `--terminal-cmd` / FASTLED_TERMINAL_CMD runs an agent in the browser
  terminal, and a configured session survives a page reload through a
  single-use reattach token (#254, #267).

Terminal:
- The shell starts in the named directory and emits valid exit frames (#257).
- A client that disconnects mid-write releases its session slot (#256, #258).

Viewer:
- Screen maps registered after setup() now reach the renderer, so sketches
  like Blink no longer show an empty canvas (#250, #264).
- The page no longer overflows the window by 40 px, and the title scales
  with the window (#268, #270).

CI:
- Browser terminal suite on Linux, Windows and real Safari (#259, #260).
- Linux render smoke that fails on a blank canvas (#247, #266).
- Linux dependencies install before setup-soldr, so the dependency cook
  succeeds (#263); lint covers ci/ (#265); an Intel macOS guest WebKit
  probe (#251, #261).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

test(terminal): run the browser terminal suite in CI, on real Safari, and close the Windows slot leak

1 participant