fix(sentry): tag Tauri shell events with cached user uid#2320
Conversation
Since the sidecar was removed (tinyhumansai#1061) and the core runs in-process inside the Tauri host, the shell's `before_send` is the filter that fires for ~all desktop Sentry events. It was explicitly setting `event.user = None`, so Sentry could not count unique users impacted by an issue. Mirror the standalone `openhuman-core` binary (`src/main.rs`) and attach the cached account uid via `peek_cached_current_user_identity`. Only `id` is carried — no email, name, or IP — keeping the privacy contract aligned with `send_default_pii: false`.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughSentry before_send now attaches the cached current user's ID to events; the embedded core readiness poll retries up to 100 times (10s); test env_lock() recovers from poisoned Mutexes instead of panicking. ChangesTauri shell adjustments
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
Two pre-existing CI flakes in core_process tests:
1. `ensure_running` had a hardcoded 4s readiness budget (40 × 100ms).
The embedded core's JSON-RPC controller registry has grown enough
that cold-start under CI worker load occasionally exceeded 4s,
producing "core process did not become ready" failures. Bumped to
10s (100 × 100ms) — still well under any user-visible startup
expectation, matches the upper end of observed cold-start times.
2. When `ensure_running_falls_back_for_unknown_listener_on_port`
panicked while holding `env_lock()`, the next two tests
(`..7789_when_7788_is_busy` and `..reuses_unknown_listener..`)
cascade-failed with `expect("env lock poisoned")`, turning one
real flake into three. The lock only serializes env-var mutation —
the inner `()` has no state poisoning could corrupt — so recover
via `into_inner()`.
|
@senamakel CI is failing on changes in this PR — please fix before review. |
1 similar comment
|
@senamakel CI is failing on changes in this PR — please fix before review. |
Summary
before_sendwas explicitly settingevent.user = None, so desktop events landed without a uid attached and Sentry could not count unique users impacted by an issue.openhuman-corebinary insrc/main.rsalready attaches the uid viapeek_cached_current_user_identity; the shell now mirrors that.idis carried (no email, name, or IP), consistent withsend_default_pii: false.Test plan
cargo check --manifest-path app/src-tauri/Cargo.toml✅ (verified locally)OPENHUMAN_TAURI_SENTRY_TEST=message) and confirm the event in Sentry shows the user id under "User" and contributes to "users impacted"useris absent (cache not yet populated)Summary by CodeRabbit
Improvements
Tests