From 0d14759cb6381b2cfc3fb33ff02761668c8c6405 Mon Sep 17 00:00:00 2001 From: Eric Yue Date: Wed, 16 Sep 2026 20:52:48 +0800 Subject: test: wait for app readiness before late session injection (#4224) Root cause: The API socket is bound before App evaluates session restore. Waiting only for that socket lets the late-session test inject its file during startup, so the server may load it normally instead of exercising late-file recovery. The missing backup then fails an otherwise correct persistence assertion. Fix: Wait for a read-only workspace-list request to pass through App and assert that the workspace list is still empty before injecting the session file. Keep the existing autosave deadline and byte-for-byte backup assertion. Add no sleeps, retries, longer timeouts or production changes. Validation: The original assertion fails with unchanged master. With the barrier, five independent runs pass. Full native just ci passes 3624 Rust tests with six default skips, formatting, all-target Clippy, 112 maintenance tests, six architecture tests and 39 integration-asset tests. All seven docs contract tests pass. Local Windows cross-lint was not run because its SDK is absent. Co-authored-by: JJ Liebig --- tests/cli/sessions.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/cli') diff --git a/tests/cli/sessions.rs b/tests/cli/sessions.rs index 717f02ef..66232ce2 100644 --- a/tests/cli/sessions.rs +++ b/tests/cli/sessions.rs @@ -706,6 +706,9 @@ fn session_appearing_after_startup_is_preserved_before_autosave() { let data_dir = config_home.join(app_dir_name()); let herdr = spawn_herdr(&config_home, &runtime_dir, &socket_path); wait_for_socket(&socket_path, Duration::from_secs(5)); + // The API socket binds before restore; a read-only App request waits for it. + let ready = run_cli_json(&socket_path, &["workspace", "list"]); + assert_eq!(ready["result"]["workspaces"], serde_json::json!([])); // The server has already evaluated restore, but has not created any layout. let original = include_bytes!("../fixtures/session/current-herdr-session.json"); fs::write(data_dir.join("session.json"), original).unwrap(); -- cgit v1.2.3