From 207be3c771d281baae6e5fa0fb74be9a056e97a2 Mon Sep 17 00:00:00 2001 From: Can Celik Date: Tue, 1 Sep 2026 15:48:22 +0300 Subject: 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 --- tests/auto_detect.rs | 118 +-------------------------------------------------- 1 file changed, 2 insertions(+), 116 deletions(-) (limited to 'tests/auto_detect.rs') diff --git a/tests/auto_detect.rs b/tests/auto_detect.rs index 94ab3f07..49473dbb 100644 --- a/tests/auto_detect.rs +++ b/tests/auto_detect.rs @@ -2,7 +2,7 @@ #![cfg(not(target_os = "macos"))] -mod support; +pub mod support; use std::fs; use std::io::{BufRead, BufReader, Write}; @@ -150,7 +150,7 @@ fn spawn_herdr_auto( .unwrap(); let mut cmd = CommandBuilder::new(env!("CARGO_BIN_EXE_herdr")); - // No subcommand, no --no-session → auto-detect launch + // No subcommand → auto-detect launch. cmd.env("XDG_CONFIG_HOME", config_home); cmd.env("XDG_RUNTIME_DIR", runtime_dir); cmd.env("HERDR_SOCKET_PATH", api_socket_path); @@ -168,48 +168,6 @@ fn spawn_herdr_auto( } } -/// Spawn `herdr --no-session` — the monolithic escape hatch. -fn spawn_herdr_no_session( - config_home: &Path, - runtime_dir: &Path, - api_socket_path: &Path, -) -> SpawnedHerdr { - fs::create_dir_all(config_home.join("herdr")).unwrap(); - fs::create_dir_all(runtime_dir).unwrap(); - register_runtime_dir(runtime_dir); - fs::write( - config_home.join("herdr/config.toml"), - "onboarding = false\n", - ) - .unwrap(); - - let pair = native_pty_system() - .openpty(PtySize { - rows: 24, - cols: 80, - pixel_width: 0, - pixel_height: 0, - }) - .unwrap(); - - let mut cmd = CommandBuilder::new(env!("CARGO_BIN_EXE_herdr")); - cmd.arg("--no-session"); - cmd.env("XDG_CONFIG_HOME", config_home); - cmd.env("XDG_RUNTIME_DIR", runtime_dir); - cmd.env("HERDR_SOCKET_PATH", api_socket_path); - cmd.env("SHELL", "/bin/sh"); - cmd.env_remove("HERDR_ENV"); - - let child = pair.slave.spawn_command(cmd).unwrap(); - register_spawned_herdr_pid(child.process_id()); - drop(pair.slave); - - SpawnedHerdr { - _master: pair.master, - child, - } -} - fn ping_socket(socket_path: &Path) -> String { let mut stream = UnixStream::connect(socket_path).expect("should connect to API socket"); @@ -423,50 +381,6 @@ fn auto_detect_socket_path_consistency() { cleanup_spawned_herdr(herdr, base); } -/// `herdr --no-session` bypasses server/client and runs -/// monolithically. No server process is spawned. No client socket is created. -#[test] -fn no_session_flag_runs_monolithically() { - let _lock = test_lock(); - let base = unique_test_dir(); - let config_home = base.join("config"); - let runtime_dir = base.join("runtime"); - let api_socket = runtime_dir.join("herdr.sock"); - let client_socket = runtime_dir.join("herdr-client.sock"); - - // Run `herdr --no-session` — monolithic mode, no server/client. - let herdr = spawn_herdr_no_session(&config_home, &runtime_dir, &api_socket); - - // Wait for the API socket (monolithic mode creates it). - wait_for_socket(&api_socket, Duration::from_secs(10)); - - // Verify the API socket exists and responds. - let response = ping_socket(&api_socket); - assert!( - response.contains("pong"), - "monolithic API should respond: {response}" - ); - - // Verify NO client socket was created — this is the key distinction - // between monolithic mode and server/client mode. - assert!( - !client_socket.exists(), - "no client socket should exist in monolithic mode" - ); - - // Verify the API socket is served by the monolithic process itself, - // not by a separate server. We can check this by verifying the client - // PID matches what would be serving the socket — in monolithic mode, - // there is only one herdr process. - let client_pid = herdr.child.process_id().expect("should have PID"); - assert!( - process_exists(client_pid), - "monolithic process should be running" - ); - - cleanup_spawned_herdr(herdr, base); -} - /// CLI subcommands work through the server's JSON API socket. #[test] fn cli_subcommands_work_through_server() { @@ -700,34 +614,6 @@ fn auto_detect_writes_client_and_server_logs_to_separate_files() { cleanup_spawned_herdr(spawned, base); } -#[test] -fn no_session_writes_startup_logs_to_monolith_file() { - let _lock = test_lock(); - let base = unique_test_dir(); - let config_home = base.join("config"); - let runtime_dir = base.join("runtime"); - let api_socket = runtime_dir.join("herdr.sock"); - - let spawned = spawn_herdr_no_session(&config_home, &runtime_dir, &api_socket); - wait_for_socket(&api_socket, Duration::from_secs(10)); - - let app_dir_name = if cfg!(debug_assertions) { - "herdr-dev" - } else { - "herdr" - }; - let log_dir = config_home.join(app_dir_name); - let monolith_log = log_dir.join("herdr.log"); - - wait_for_log_contains( - &monolith_log, - "event=\"app.startup\" subsystem=\"app\"", - Duration::from_secs(10), - ); - - cleanup_spawned_herdr(spawned, base); -} - #[test] fn auto_detect_respects_nested_guard_before_auto_attach() { let _lock = test_lock(); -- cgit v1.2.3