fix(tauri): pre-flight every xdg-utils binary before register_all (#5V)
Summary
- Extends the existing Linux deep-link pre-flight from just
xdg-mimeto all three binariestauri-plugin-deep-link::register_allshells out to:xdg-mime,update-desktop-database,xdg-icon-resource. - Skips the plugin call when any of them is missing on PATH — partial registration can't succeed, and the plugin's internal
log::error!on the first missing binary is what was leaking to Sentry. - Closes OPENHUMAN-TAURI-5V (18 events). Sister bug to OPENHUMAN-TAURI-AS — same wire shape, different missing binary.
Problem
The original Wave 1 fix for OPENHUMAN-TAURI-AS pre-flighted only xdg-mime before calling app.deep_link().register_all(). That covered the WSL2 / fully-minimal-container case where xdg-utils is wholly absent.
But the plugin internally invokes three xdg-utils commands in sequence inside register_all:
xdg-mimeupdate-desktop-databasexdg-icon-resource
On Linux installs where xdg-mime exists but one of the other two is missing (some partial / size-trimmed container images, certain bespoke minimal distros), the pre-flight passes but the plugin still hits a Failed to run OS command on step 2 or 3 — which surfaces in Sentry as:
Failed to run OS command `update-desktop-database`: No such file or directory (os error 2)
That's OPENHUMAN-TAURI-5V (18 events). The plugin emits this via log::error! inside register_all before returning the Err, so the existing if let Err arm downstream only catches the demoted user-visible failure — the internal log already escaped to sentry-tracing and produced an event.
Solution
Replace the single-binary check with a slice of all three, compute the missing subset, and skip register_all if the subset is non-empty:
const XDG_BINARIES: &[&str] =
&[\"xdg-mime\", \"update-desktop-database\", \"xdg-icon-resource\"];
let missing: Vec<&str> = XDG_BINARIES
.iter()
.copied()
.filter(|name| !path_has_executable(name))
.collect();
if missing.is_empty() {
if let Err(err) = app.deep_link().register_all() {
log::warn!(\"[deep-link] register_all failed (non-fatal): {err}\");
}
} else {
log::warn!(
\"[deep-link] skipping register_all — xdg-utils binaries missing on PATH: {} \
(xdg-utils not installed; deep-link MIME registration unavailable on this host)\",
missing.join(\", \")
);
}
The warn log now enumerates exactly which binaries are missing so any future variant of this bug (a different partial install) is diagnosable from the local logs without a fresh Sentry event.
New test
path_has_executable_returns_false_for_partial_xdg_utils_install pins the partial-install case directly:
- Builds a
$PATHcontaining onlyxdg-mime(noupdate-desktop-database, noxdg-icon-resource). - Asserts the lookup correctly classifies each binary independently —
xdg-mime→ true, the other two → false. - Mirrors the OPENHUMAN-TAURI-5V wire shape exactly: that's the exact host configuration the 18 affected boots had.
Test is #[cfg(target_os = \"linux\")] (matches the existing sibling tests for path_has_executable_* predicates). CI Linux runner exercises it; the macOS local runner skips.
Submission Checklist
If a section does not apply to this change, mark the item as
N/Awith a one-line reason. Do not delete items.
- [x] Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
- [x] Diff coverage ≥ 80% — changed lines (Vitest + cargo-llvm-cov merged via
diff-cover) meet the gate enforced by.github/workflows/coverage.yml. New test covers the load-bearing partial-install branch; the early-return onmissing.is_empty()is exercised by the existingpath_has_executable_finds_file_on_pathtest. - [x] N/A: behaviour-only change, no feature row impact. Coverage matrix updated — added/removed/renamed feature rows in
docs/TEST-COVERAGE-MATRIX.mdreflect this change. - [x] All affected feature IDs from the matrix are listed in the PR description under
## Related. - [x] No new external network dependencies introduced (mock backend used per Testing Strategy).
- [x] N/A: pre-flight extension is invisible at the user level — boots that previously logged a noisy Sentry event now log a warn and skip a no-op plugin call. No release-cut surface change. Manual smoke checklist updated if this touches release-cut surfaces (
docs/RELEASE-MANUAL-SMOKE.md). - [x] Linked issue closed via
Closes #NNNin the## Relatedsection.
Impact
- Runtime: Linux only. Boot now runs three
path_has_executablelookups instead of one before the deep-link plugin call. Each is a$PATHsplit +is_filestat — negligible. Other platforms unchanged. - Performance: O(PATH_entries × 3) stat calls at app startup. Same big-O class as before. Adds ~tens of µs on a typical Linux desktop.
- Security: no new attack surface. Lookups are read-only checks against the user's
$PATH. Thelog::warn!enumerates binary names only — no paths, no PII. - Migration: none.
- Compatibility: forward-compatible. On hosts that have all three binaries (the desktop-environment-installed default), behavior is identical to the pre-#5V pre-flight. On hosts missing one or more, the boot now logs a single warn naming which binaries to install — actionable diagnosis the previous code couldn't give.
Related
- Closes OPENHUMAN-TAURI-5V
- Related context: OPENHUMAN-TAURI-AS (Wave 1, originally introduced the
xdg-mimepre-flight);tauri-plugin-deep-linkinternallog::error!shape that escapes theif let Errarm in this hook. - Follow-up PR(s)/TODOs: if
tauri-plugin-deep-linkgains atry_register_all_or_skipAPI or per-binary feature gating, this pre-flight becomes vestigial and can be deleted.
AI Authored PR Metadata (required for Codex/Linear PRs)
Keep this section for AI-authored PRs. For human-only PRs, mark each field
N/A.
Linear Issue
- Key: N/A (Sentry-driven triage; no Linear ticket)
- URL: N/A
Commit & Branch
- Branch: fix/sentry-5v-xdg-utils-preflight
- Commit SHA: f4e6a4f8 (tip)
Agent
- Claude Code (Opus 4.7, 1M context) running locally
Summary by CodeRabbit
-
Bug Fixes
- Enhanced stability of protocol handler registration on Linux. The application now checks for required system dependencies before attempting registration and gracefully skips the process when tools are unavailable, preventing unnecessary error logging.
-
Tests
- Added regression test for systems with incomplete dependencies on Linux.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2dce2afa-9570-44e0-a556-d20090561320
📥 Commits
Reviewing files that changed from the base of the PR and between c204a53de2f5e146d51cc90583a284d61b3d19ea and f4e6a4f80a4688cf64a83007f54285206c90688a.
📒 Files selected for processing (1)
app/src-tauri/src/lib.rs
📝 Walkthrough
Walkthrough
Linux deep-link registration now preflights all three xdg-utils binaries (xdg-mime, update-desktop-database, xdg-icon-resource) before attempting registration, skipping the operation and logging the missing tools when any are absent, with a regression test validating correct detection of partial installations.
Changes
xdg-utils Binary Preflight for Deep-Link Setup
| Layer / File(s) | Summary |
|---|---|
Deep-link binary preflight and conditional registration app/src-tauri/src/lib.rs |
Linux deep-link initialization now checks all three xdg-utils binaries required by register_all using path_has_executable, builds a list of missing binaries, skips registration when any are absent, and logs a warning naming the missing tools. |
Partial xdg-utils installation regression test app/src-tauri/src/lib.rs |
Linux-only unit test ensures path_has_executable correctly reports xdg-mime as present and update-desktop-database and xdg-icon-resource as absent when only xdg-mime exists in a controlled $PATH. |
Possibly related PRs
- tinyhumansai/openhuman#1766: Both PRs modify
app/src-tauri/src/lib.rsto gatetauri-plugin-deep-link::register_allusing Linuxpath_has_executablepreflight (this PR extends it to check multiplexdg-utilsbinaries beyond justxdg-mime).
Poem
🐰 A trio of tools now checked with care, Before deep-linking dares to declare, If
xdg-mimeor friends aren't there, We log and skip with rabbit flair, No crashes on systems halfway unprepared!
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately describes the main change: pre-flighting all xdg-utils binaries before calling register_all on Linux, which is the core objective of this PR. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
Comment @coderabbitai help to get the list of available commands and usage tips.