Skip to content

Commit 8f5bcca

Browse files
committed
fix(smoke): skip terminal sidecar in mock smoke runs
The Linux release smoke path uses the mock terminal backend, so it should not spawn the terminal session sidecar at all. Skipping that helper in smoke mode avoids the CI-only auxiliary-process crash while preserving normal runtime persistence behavior outside smoke runs. Constraint: Smoke mode must still exercise the real app binary and embedded terminal host startup path Rejected: Disable the terminal sidecar globally for mock backend runs | normal desktop sessions may still want persistence fallback semantics outside smoke mode Confidence: high Scope-risk: narrow Directive: Keep CI smoke-specific runtime relaxations gated on smoke mode, not on backend choice alone Tested: cargo test -p taskers smoke_with_mock_backend_skips_terminal_sidecar -- --nocapture; cargo build -p taskers --bin taskers --bin taskers-gtk --bin taskersctl --bin taskers-terminald; TASKERS_TERMINAL_BACKEND=mock TIMEOUT_SECONDS=90 bash scripts/headless-smoke.sh ./target/debug/taskers --smoke-script baseline --diagnostic-log stderr --quit-after-ms 5000 Not-tested: Full GitHub release-assets workflow rerun after retag
1 parent 826d00e commit 8f5bcca

1 file changed

Lines changed: 52 additions & 14 deletions

File tree

crates/taskers-app/src/main.rs

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ struct RuntimePathOverrides {
116116
terminal_socket_path: PathBuf,
117117
}
118118

119+
fn should_skip_terminal_sidecar_in_smoke(path_overrides: Option<&RuntimePathOverrides>) -> bool {
120+
path_overrides.is_some()
121+
&& matches!(
122+
std::env::var("TASKERS_TERMINAL_BACKEND").ok().as_deref(),
123+
Some("mock")
124+
)
125+
}
126+
119127
enum HostAutomationCommand {
120128
Browser(BrowserControlCommand),
121129
Screenshot(ScreenshotCommand),
@@ -1355,19 +1363,26 @@ fn resolve_runtime_bootstrap(
13551363
shell_launch
13561364
.env
13571365
.insert("TASKERS_SOCKET".into(), socket_path.display().to_string());
1358-
let terminal_session_client = match ensure_terminal_session_daemon(&terminal_socket_path) {
1359-
Ok(()) => {
1360-
shell_launch.env.insert(
1361-
"TASKERS_TERMINAL_SOCKET".into(),
1362-
terminal_socket_path.display().to_string(),
1363-
);
1364-
Some(TerminalSessionClient::new(terminal_socket_path))
1365-
}
1366-
Err(error) => {
1367-
startup_notes.push(format!(
1368-
"terminal session sidecar unavailable; terminals will start fresh shells and will not survive Taskers restart ({error})"
1369-
));
1370-
None
1366+
let terminal_session_client = if should_skip_terminal_sidecar_in_smoke(path_overrides) {
1367+
startup_notes.push(
1368+
"Smoke mode with mock terminal backend skips the terminal session sidecar.".into(),
1369+
);
1370+
None
1371+
} else {
1372+
match ensure_terminal_session_daemon(&terminal_socket_path) {
1373+
Ok(()) => {
1374+
shell_launch.env.insert(
1375+
"TASKERS_TERMINAL_SOCKET".into(),
1376+
terminal_socket_path.display().to_string(),
1377+
);
1378+
Some(TerminalSessionClient::new(terminal_socket_path))
1379+
}
1380+
Err(error) => {
1381+
startup_notes.push(format!(
1382+
"terminal session sidecar unavailable; terminals will start fresh shells and will not survive Taskers restart ({error})"
1383+
));
1384+
None
1385+
}
13711386
}
13721387
};
13731388
let terminal_persistence = if terminal_session_client.is_some() {
@@ -2456,7 +2471,10 @@ fn looks_like_dev_install(path: &Path) -> bool {
24562471

24572472
#[cfg(test)]
24582473
mod startup_tests {
2459-
use super::{looks_like_dev_install, should_defer_initial_sync, smoke_runtime_path_overrides};
2474+
use super::{
2475+
RuntimePathOverrides, looks_like_dev_install, should_defer_initial_sync,
2476+
should_skip_terminal_sidecar_in_smoke, smoke_runtime_path_overrides,
2477+
};
24602478
use std::path::Path;
24612479

24622480
#[test]
@@ -2504,4 +2522,24 @@ mod startup_tests {
25042522
.starts_with(&overrides.root_dir)
25052523
);
25062524
}
2525+
2526+
#[test]
2527+
fn smoke_with_mock_backend_skips_terminal_sidecar() {
2528+
let overrides = RuntimePathOverrides {
2529+
root_dir: Path::new("/tmp/taskers-smoke").to_path_buf(),
2530+
session_path: Path::new("/tmp/taskers-smoke/session.json").to_path_buf(),
2531+
socket_path: Path::new("/tmp/taskers-smoke/control.sock").to_path_buf(),
2532+
terminal_socket_path: Path::new("/tmp/taskers-smoke/terminal.sock").to_path_buf(),
2533+
};
2534+
2535+
unsafe { std::env::set_var("TASKERS_TERMINAL_BACKEND", "mock") };
2536+
assert!(should_skip_terminal_sidecar_in_smoke(Some(&overrides)));
2537+
unsafe { std::env::set_var("TASKERS_TERMINAL_BACKEND", "ghostty") };
2538+
assert!(!should_skip_terminal_sidecar_in_smoke(Some(&overrides)));
2539+
unsafe { std::env::remove_var("TASKERS_TERMINAL_BACKEND") };
2540+
assert!(!should_skip_terminal_sidecar_in_smoke(Some(&overrides)));
2541+
unsafe { std::env::set_var("TASKERS_TERMINAL_BACKEND", "mock") };
2542+
assert!(!should_skip_terminal_sidecar_in_smoke(None));
2543+
unsafe { std::env::remove_var("TASKERS_TERMINAL_BACKEND") };
2544+
}
25072545
}

0 commit comments

Comments
 (0)