fix(tauri): pre-flight every xdg-utils binary before register_all (#5V)#2416
Conversation
…er_all (OPENHUMAN-TAURI-5V)
Extend the existing Linux pre-flight in the Tauri setup hook from just
`xdg-mime` to all three binaries that `tauri-plugin-deep-link::register_all`
shells out to in sequence: `xdg-mime`, `update-desktop-database`, and
`xdg-icon-resource`. Skip the plugin call when *any* of them is missing.
The original OPENHUMAN-TAURI-AS pre-flight only checked `xdg-mime`, so a
host with `xdg-mime` installed but `update-desktop-database` missing
(small / minimal Linux installs, certain container images) still entered
`register_all`, which then fires
`log::error!("Failed to run OS command \`update-desktop-database\`…")`
internally before returning Err. That internal error log is scooped up
by `sentry-tracing` even though the user-visible failure was already
demoted to a warn by our `if let Err` arm — net effect is one Sentry
event per affected boot with no remediation path (the binary doesn't
exist on the host).
Partial registration can't succeed because the plugin runs all three
xdg-utils commands in sequence inside `register_all`; the first miss
kills the whole flow. Pre-flighting every binary preserves the existing
contract (no plugin call → no internal log → no Sentry event) while
extending coverage to the partial-install case the Wave-4 triage
surfaced.
Test: `path_has_executable_returns_false_for_partial_xdg_utils_install`
pins the contract by checking each binary independently with a $PATH
that contains only `xdg-mime` — mirrors the OPENHUMAN-TAURI-5V wire
shape exactly.
Closes OPENHUMAN-TAURI-5V
|
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 (1)
📝 WalkthroughWalkthroughLinux deep-link registration now preflights all three Changesxdg-utils Binary Preflight for Deep-Link Setup
Possibly related PRs
Poem
🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
graycyrus
left a comment
There was a problem hiding this comment.
Looks good, nice work!
Summary
xdg-mimeto all three binariestauri-plugin-deep-link::register_allshells out to:xdg-mime,update-desktop-database,xdg-icon-resource.log::error!on the first missing binary is what was leaking to Sentry.Problem
The original Wave 1 fix for OPENHUMAN-TAURI-AS pre-flighted only
xdg-mimebefore callingapp.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-resourceOn Linux installs where
xdg-mimeexists 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 aFailed to run OS commandon step 2 or 3 — which surfaces in Sentry as:That's
OPENHUMAN-TAURI-5V(18 events). The plugin emits this vialog::error!insideregister_allbefore returning the Err, so the existingif let Errarm downstream only catches the demoted user-visible failure — the internal log already escaped tosentry-tracingand produced an event.Solution
Replace the single-binary check with a slice of all three, compute the missing subset, and skip
register_allif the subset is non-empty: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_installpins the partial-install case directly:$PATHcontaining onlyxdg-mime(noupdate-desktop-database, noxdg-icon-resource).xdg-mime→ true, the other two → false.Test is
#[cfg(target_os = \"linux\")](matches the existing sibling tests forpath_has_executable_*predicates). CI Linux runner exercises it; the macOS local runner skips.Submission Checklist
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.docs/TEST-COVERAGE-MATRIX.mdreflect this change.## Related.docs/RELEASE-MANUAL-SMOKE.md).Closes #NNNin the## Relatedsection.Impact
path_has_executablelookups instead of one before the deep-link plugin call. Each is a$PATHsplit +is_filestat — negligible. Other platforms unchanged.$PATH. Thelog::warn!enumerates binary names only — no paths, no PII.Related
xdg-mimepre-flight);tauri-plugin-deep-linkinternallog::error!shape that escapes theif let Errarm in this hook.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)
Linear Issue
Commit & Branch
Agent
Summary by CodeRabbit
Bug Fixes
Tests