Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/src-tauri/src/core_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,14 @@ impl CoreProcessHandle {
}
}

for _ in 0..40 {
// Readiness budget: 100 iterations × 100ms = 10s. The embedded
// core's JSON-RPC controller registry has grown over time and
// the previous 4s budget started flaking under CI worker load
// (issue: core_process tests intermittently failing with
// "core process did not become ready"). 10s is still well
// under any user-visible startup expectation and matches the
// upper end of observed cold-start times.
for _ in 0..100 {
if !received_ready {
match ready_rx.try_recv() {
Ok(ready_signal) => {
Expand Down
8 changes: 7 additions & 1 deletion app/src-tauri/src/core_process_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ use std::sync::{Mutex, MutexGuard, OnceLock};

fn env_lock() -> MutexGuard<'static, ()> {
static ENV_LOCK: OnceLock<Mutex<()>> = OnceLock::new();
// Recover from poison: when one test panics while holding this lock
// (e.g. an embedded-core readiness timeout under CI load), every
// subsequent test in the suite would otherwise cascade-fail with
// "env lock poisoned" — turning one real flake into three. The lock
// only serializes process-wide env-var mutation; the inner `()`
// carries no state that poisoning could corrupt.
ENV_LOCK
.get_or_init(|| Mutex::new(()))
.lock()
.expect("env lock poisoned")
.unwrap_or_else(|poisoned| poisoned.into_inner())
}

struct EnvGuard {
Expand Down
15 changes: 14 additions & 1 deletion app/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,20 @@ pub fn run() {
}
// Strip server_name (hostname) to avoid leaking machine identity.
event.server_name = None;
event.user = None;
// Attach the cached account uid so Sentry can count unique users
// affected by an issue. We only carry `id` — never email, name,
// or IP — so this stays consistent with `send_default_pii: false`.
// Since #1061 the core runs in-process inside this shell, so this
// is the surface that tags ~all desktop events. Mirrors the
// standalone `openhuman-core` binary's filter in `src/main.rs`.
// Empty/missing on early-startup events (cache populates after
// the first `auth_get_me` RPC); that's expected.
event.user = openhuman_core::openhuman::app_state::peek_cached_current_user_identity()
.and_then(|identity| identity.id)
.map(|id| sentry::User {
id: Some(id),
..Default::default()
});
Some(event)
})),
sample_rate: 1.0,
Expand Down
Loading