diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-01 15:48:22 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-01 15:48:22 +0300 |
| commit | 207be3c771d281baae6e5fa0fb74be9a056e97a2 (patch) | |
| tree | d7b037ecdf629224a048c841d11659efdc23507d /tests/live_handoff.rs | |
| parent | 8a6d697308162874a236c84aac0b0f8c7ac01f83 (diff) | |
refactor: render the shell in the client (#3487)
* feat: add opt-in client-rendered shell
* feat: add client-owned shell mouse controls
* feat: complete client-owned shell chrome
* feat: add client-owned shell settings and notifications
* feat: run client shell custom commands
* feat: render popup terminals in client shell
* feat: add client-owned scrollback and copy mode
* fix: preserve client worktree trust defaults
* feat: render startup diagnostics in client shell
* feat: render onboarding in client shell
* feat: render product announcements in client shell
* feat: render release notes in client shell
* feat: render mobile switcher in client shell
* feat: render kitty graphics in client shell
* fix: preserve client shell lifecycle coherence
* refactor: route client shell commands through endpoint connections
* refactor: make the client-rendered shell the default
* refactor: remove monolithic launch mode
* refactor: complete client-rendered shell cutover
* perf: retain client pane surface updates
* perf: scale retained pane surface updates
* perf: remove remote pane input latency
* test: make client shell checks platform-independent
* fix: prevent client timer starvation
* test: fix client shell platform gates
* test: accept retained surfaces in cross-area checks
* test: make client mode assertions platform-neutral
* fix: badge only outdated integrations
Diffstat (limited to 'tests/live_handoff.rs')
| -rw-r--r-- | tests/live_handoff.rs | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/tests/live_handoff.rs b/tests/live_handoff.rs index 832079e8..d58fb301 100644 --- a/tests/live_handoff.rs +++ b/tests/live_handoff.rs @@ -1,4 +1,4 @@ -mod support; +pub mod support; use std::fs; use std::io::{BufRead, BufReader, Read, Write}; @@ -12,8 +12,10 @@ use std::time::{Duration, Instant}; use portable_pty::{native_pty_system, Child, CommandBuilder, MasterPty, PtySize}; use support::{ - cleanup_test_base, client_handshake, register_runtime_dir, register_spawned_herdr_pid, - send_input, unregister_spawned_herdr_pid, wait_for_disconnect, wait_for_socket, + cleanup_test_base, client_shell_handshake, register_runtime_dir, register_spawned_herdr_pid, + send_client_shell_shift_enter, unregister_spawned_herdr_pid, wait_for_client_shell_bootstrap, + wait_for_message_variant, wait_for_socket, SERVER_MESSAGE_CLIENT_SHELL_SNAPSHOT, + SERVER_MESSAGE_SERVER_SHUTDOWN, }; struct SpawnedHerdr { @@ -868,9 +870,19 @@ fn live_handoff_preserves_pane_process_io() { .as_u64() .unwrap() as u32; let mut client_stream = UnixStream::connect(&client_socket).unwrap(); - let (server_protocol, error) = client_handshake(&mut client_stream, protocol, 80, 24).unwrap(); + let (server_protocol, error) = + client_shell_handshake(&mut client_stream, protocol, 54, 23).unwrap(); assert_eq!(server_protocol, protocol); - assert!(error.is_none(), "client handshake failed: {error:?}"); + assert!(error.is_none(), "client shell handshake failed: {error:?}"); + assert!( + wait_for_message_variant( + &mut client_stream, + Duration::from_secs(5), + SERVER_MESSAGE_CLIENT_SHELL_SNAPSHOT, + ) + .unwrap(), + "client shell should receive a complete snapshot before handoff" + ); assert_ok(request( &api_socket, @@ -888,8 +900,13 @@ fn live_handoff_preserves_pane_process_io() { )); drop(spawned); assert!( - wait_for_disconnect(&mut client_stream, Duration::from_secs(5)).unwrap(), - "connected clients should disconnect during live handoff" + wait_for_message_variant( + &mut client_stream, + Duration::from_secs(5), + SERVER_MESSAGE_SERVER_SHUTDOWN, + ) + .unwrap(), + "connected client shell should receive live-handoff shutdown" ); thread::sleep(Duration::from_millis(300)); wait_for_api(&api_socket, Duration::from_secs(10)); @@ -935,6 +952,14 @@ fn live_handoff_preserves_pane_process_io() { ); wait_for_output(&api_socket, &second_pane_id, "second:after-handoff-sec"); + let mut reattached_shell = UnixStream::connect(&client_socket).unwrap(); + let (server_protocol, error) = + client_shell_handshake(&mut reattached_shell, protocol, 54, 23).unwrap(); + assert_eq!(server_protocol, protocol); + assert!(error.is_none(), "reattached client shell failed: {error:?}"); + wait_for_client_shell_bootstrap(&mut reattached_shell, Duration::from_secs(5)) + .expect("fresh client shell should receive restored snapshot before pane content"); + let _ = request( &api_socket, serde_json::json!({"id":"test:stop","method":"server.stop","params":{}}), @@ -1020,10 +1045,13 @@ pathlib.Path({received:?}).write_text(data.hex()) wait_for_socket(&client_socket, Duration::from_secs(5)); let mut client_stream = UnixStream::connect(&client_socket).unwrap(); - let (server_protocol, error) = client_handshake(&mut client_stream, protocol, 80, 24).unwrap(); + let (server_protocol, error) = + client_shell_handshake(&mut client_stream, protocol, 54, 23).unwrap(); assert_eq!(server_protocol, protocol); - assert!(error.is_none(), "client handshake failed: {error:?}"); - send_input(&mut client_stream, b"\x1b[13;2u").unwrap(); + assert!(error.is_none(), "client shell handshake failed: {error:?}"); + wait_for_client_shell_bootstrap(&mut client_stream, Duration::from_secs(5)) + .expect("client shell should receive restored state before sending input"); + send_client_shell_shift_enter(&mut client_stream, &pane_id).unwrap(); wait_for_file_contains(&received_marker, "1b5b31333b3275", Duration::from_secs(5)); @@ -1111,10 +1139,13 @@ pathlib.Path({received:?}).write_text(data.hex()) wait_for_socket(&client_socket, Duration::from_secs(5)); let mut client_stream = UnixStream::connect(&client_socket).unwrap(); - let (server_protocol, error) = client_handshake(&mut client_stream, protocol, 80, 24).unwrap(); + let (server_protocol, error) = + client_shell_handshake(&mut client_stream, protocol, 54, 23).unwrap(); assert_eq!(server_protocol, protocol); - assert!(error.is_none(), "client handshake failed: {error:?}"); - send_input(&mut client_stream, b"\x1b[13;2u").unwrap(); + assert!(error.is_none(), "client shell handshake failed: {error:?}"); + wait_for_client_shell_bootstrap(&mut client_stream, Duration::from_secs(5)) + .expect("client shell should receive restored state before sending input"); + send_client_shell_shift_enter(&mut client_stream, &pane_id).unwrap(); wait_for_file_contains( &received_marker, |
