Repository navigation
Description
Overview
The cargo test -p nodespace-app pre-push gate (the ADR-048 Tauri-seam integration test suite under packages/desktop-app/src-tauri/tests/) intermittently fails on real-daemon-spawning tests when the machine is under concurrent load, blocking pushes for unrelated changes.
Problem Statement
Several tests/*.rs files in packages/desktop-app/src-tauri/ spawn a real nodespaced binary and wait for it to become healthy before running assertions, via connected_client() in packages/desktop-app/src-tauri/test-support/src/lib.rs:
let status = wait_for_daemon(&daemon.socket_path, timeout).await;
assert_eq!(
status,
DaemonStatus::Healthy,
"daemon never became healthy at {}",
daemon.socket_path.display()
);This assertion is timing-sensitive: spawning a whole OS process and waiting for it to bind a socket takes meaningfully longer under CPU contention than the fixed timeout accounts for.
Reproduction context: while pushing an unrelated branch, the pre-push gate failed 4 times in a row across 4 separate attempts, each time on a different test in the suite:
adapter_contract_test::create_node_insert_position_matches_the_http_adapter_contract—daemon never became healthyai_chat_send_to_idle_test::ai_chat_send_reaches_idle_with_no_stuck_processing_state— separate 180s turn-completion timeout, not the daemon-health assertion, but the same class of load-sensitive timing failurecommits_per_edit_test::second_coalesced_edit_uses_the_confirmed_version_not_a_stale_guess—daemon never became healthy(twice)
Every failing test passed cleanly when re-run alone immediately after failing as part of the full suite, which rules out a logic bug in any specific test — this is contention/timing, not correctness.
Correlation with machine load: the failures coincided with a concurrent cargo test --workspace running in another worktree session plus a live Ollama llama-server process competing for CPU. System load average (15-min) was ~10.5 on a 10-core machine during the failures; once the concurrent test run finished and load dropped to ~1.3, one retry got further before hitting the next timing-sensitive test.
Proposed Solution
Make the daemon-health wait (and any other fixed-timeout assertions in this suite, such as the ai_chat_send_to_idle_test turn-completion wait) tolerant of load-induced delay:
- Increase the timeout passed to
wait_for_daemoninconnected_client(), and/or - Add retry-with-backoff around the health check instead of a single deadline, and/or
- Detect and reduce test parallelism for this specific suite (real daemon spawns are far more load-sensitive than in-process assertions) —
rust:testalready runsnodespace-corewith--test-threads=2; thenodespace-appTauri-seam suite may need the same or lower.
Acceptance Criteria
-
cargo test -p nodespace-apppasses reliably under representative background load (e.g. a concurrentcargo test --workspacerunning in another checkout) without raising the wall-clock cost of a clean, unloaded run significantly - The daemon-health wait in
connected_client()(packages/desktop-app/src-tauri/test-support/src/lib.rs) has headroom for slow process spawn under load, via a longer timeout, retry/backoff, or both - Any other fixed-timeout assertions in the same test suite with the same load-sensitivity (e.g. the ai-chat turn-completion wait in
ai_chat_send_to_idle_test.rs) are reviewed for the same fix - Code passes
bun run quality:fix; tests pass
Technical Specifications
Reference Files
packages/desktop-app/src-tauri/test-support/src/lib.rs—connected_client()(the shared helper everytests/*.rsfile uses to spawn a daemon and wait for health),CONNECT_MUTEX,SpawnedDaemonpackages/desktop-app/src-tauri/tests/adapter_contract_test.rspackages/desktop-app/src-tauri/tests/commits_per_edit_test.rspackages/desktop-app/src-tauri/tests/ai_chat_send_to_idle_test.rs.husky/pre-push/scripts/test-gate.ts— the pre-push gate that runs this suite
Related Issues
- Wire cargo test -p nodespace-app (Tauri-seam, ADR-048) into CI #1571 (wired this suite into the pre-push gate and CI)
Activity
Address review: doc improvements for #1610 fix
Make ADR-048 Tauri-seam e2e tests tolerant of machine load (closes #1610