Repository navigation
Make ADR-048 Tauri-seam e2e tests tolerant of machine load (closes #1610) - #1616
Conversation
#1610) Real daemon spawns in this suite (socket bind, real inference) are far more load-sensitive than in-process assertions, and the suite's own #[tokio::test] concurrency plus any competing cargo test elsewhere on the machine could push past the old fixed timeouts under contention. - Centralize the daemon-connect timeout as DAEMON_CONNECT_TIMEOUT (60s, up from a duplicated 30s literal at every call site) - Raise ai_chat_send_to_idle_test's turn-completion wait (180s -> 300s) - Cap cargo test -p nodespace-app to --test-threads=2 in the pre-push gate, mirroring nodespace-core's existing cap, so fewer real daemons spawn concurrently within a single test binary Verified passing both on an idle machine and with a concurrent cargo test --workspace running to reproduce representative load. Co-Authored-By: Claude Sonnet 5 <[email protected]>
--test-threads=2 still reproduced #1610's exact daemon-health timeout against real contention (a concurrent cargo build -p nodespace-daemon): NotRunning after the full 60s wait, not just close. Each spawned nodespaced loads a real embedding model (Metal shader compilation included) before its socket binds, so two concurrent spawns compete for CPU/GPU in a way =2 didn't fully protect against. Verified: --test-threads=1 passes cleanly, repeatedly, against a live competing `cargo build -p nodespace-daemon` on this machine, and costs almost no wall-clock (suite is dominated by the one real-inference test regardless of thread count). Co-Authored-By: Claude Sonnet 5 <[email protected]>
Code Review SummaryThis is a well-scoped, well-documented fix for a real, reproducible flake (#1610). I independently re-derived the full diff and read the entire The core engineering judgment — Net positive. Recommending approve, with one non-blocking follow-up worth tracking as an issue (the raw- FindingsCritical IssuesNone. Suggested Improvements
Nitpicks
Section-by-section coverageArchitectural fit — Good. Correctness of the migration — Verified directly (not just via grep on the summary): all ~11 call sites across
Timeout-raise DX tradeoff (30s→60s, 180s→300s) — Acceptable given the constraints stated in the issue and confirmed in the repo: Consistency/completeness across ~11 call sites — Complete and consistent; verified directly, not just via grep count matching. No stray literals, no partial migration, no test file missed. Anything unrelated bundled in — None found. Diff stat is exactly the 12 files described, all within the stated scope (timeout constant, its call sites, import cleanup, and the test-gate.ts threading change). Issue #1610 acceptance criteria — gap check
RecommendationApprove. The change is atomic, correctly scoped, well-reasoned, and the migration is complete and mechanically verified. The |
malibio
left a comment
There was a problem hiding this comment.
Review posted above. Recommendation: APPROVE (net positive, no blockers) — GitHub blocks self-approval since this PR's author is the authenticated account, so recording as a comment-review instead. See the full review comment for the complete analysis and one non-blocking follow-up.
- DAEMON_CONNECT_TIMEOUT: clarify 60s is a ceiling on the failure path, not an added cost on the success path (wait_for_daemon returns early) - test-gate.ts: replace the "confirmed on this machine" anecdote (which can't be re-verified by a future reader) with the durable structural reason --test-threads=1 is needed — SpawnedDaemon::spawn() happens before CONNECT_MUTEX is acquired, so concurrent daemon spawns are self-inflicted contention the suite creates on its own, not just an external-load sensitivity - test-support/src/lib.rs: point developers running the crate's tests directly (bypassing test-gate.ts) at --test-threads=1, since a bare `cargo test -p nodespace-app` still gets the old concurrency behavior Addresses reviewer nits from PR #1616's review. Skipped one suggestion (the CONNECT_MUTEX-is-now-dormant-under-=1 observation) since the reviewer explicitly flagged it as informational only, not actionable. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Addressed review feedbackThanks for the thorough review. Summary of what changed in commit 4e55fe6: ✅ Addressed:
⏭️ Skipped:
Verified after changes: Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: All changes in this follow-up commit are doc-comment-only — no logic, no behavior change, no new code paths. The one skipped item was explicitly marked non-actionable by the reviewer. Low risk, straightforward, and directly traceable to the review's own findings. |
Summary
DAEMON_CONNECT_TIMEOUT(60s, up from a duplicated 30s literal at every call site) intest-support/src/lib.rsai_chat_send_to_idle_test's turn-completion wait (180s → 300s) — a real inference call, same load-sensitivity classcargo test -p nodespace-appto--test-threads=1in the pre-push gate (scripts/test-gate.ts)Why
--test-threads=1, not=2Every test in this suite spawns a real
nodespacedprocess that loads a real embedding model (Metal shader compilation included) before its socket binds. I initially tried--test-threads=2(matchingnodespace-core's existing cap) but reproduced the exact failure from the issue against real contention — a concurrentcargo build -p nodespace-daemonin a sibling worktree — with the daemon reportingNotRunningafter the full 60s wait, not just running close to it.--test-threads=1passed cleanly and repeatedly under the same live contention. Serializing costs almost no wall-clock: the suite's total runtime is dominated by the one real-inference test (~25-40s) regardless of thread count, since every other test is sub-second.Test plan
cargo test -p nodespace-app -- --test-threads=1passes on an idle machinecargo build -p nodespace-daemon(reproducing the issue's background-load scenario)bun run scripts/test-gate.ts(pre-push gate) passes end-to-endbun run quality:fix— 0 errors, 0 warnings, clippy cleanCloses #1610.
🤖 Generated with Claude Code