TESTED 28 SEP 2026 · HEAD 21a30a5ec4

Refresh Linux MIME handler cache

pingdotgg/t3code #8673 adds update-desktop-database between writing the Linux desktop entry and setting the URL-scheme default. Refresh failures are caught; a five-second timeout limits the exit wait.

Recommendation

Ready to merge. The fix is verified and CI is green.

No blocking implementation issue found. Focused tests, static checks and isolated Linux integration checks passed at 21a30a5ec4ae881d8ab3d094c1ec877881435cf2.

GitHub now reports MERGEABLE and CLEAN. The latest CI workflow passed: Test, Check, Release Smoke, Test Server 1–3 and Rust. Mobile Native Static Analysis was skipped after the native-change check. No merge or GitHub approval was performed.

What this solves

After signing in, a browser may return to T3 Code through a t3code:// callback link. Linux can know that T3 Code is the default and still show an empty application chooser because its application-discovery cache does not contain T3 Code.

This PR refreshes that cache. Linux can then discover and offer T3 Code as the application for the callback link.

Before: no application available. The base version records the default but leaves the MIME cache absent. The native chooser says “No applications found” and Select is disabled.
Native Linux application chooser before the fix: no applications found for x-scheme-handler/t3code and Select disabled
After: T3 Code appears. The PR refreshes the cache. The same native chooser lists T3 Code (Alpha) under Recommended Applications, with Select enabled.
Native Linux application chooser after the fix: T3 Code Alpha appears under Recommended Applications and Select is enabled

Actual GTK 3 application-chooser screenshots, captured on an isolated X display. Each state was generated by executing the corresponding version of T3 Code’s registration service with real filesystem/process services. The dialog queries x-scheme-handler/t3code; its explanatory heading was set by the test harness. These are not mockups or screenshots of a complete OAuth login. Both use the same test executable and isolated XDG directories; only the registration implementation differs.

Before & after: real Linux discovery

Executed the actual registration service with real Node filesystem/process services and Debian desktop-file-utils 0.26 plus xdg-utils 1.1.3. Each case used separate temporary XDG data/config directories. GIO queried the resulting scheme registration.

Before — base ba79610d16

xdg-mime default: com.t3tools.T3Code.desktop
GIO default: com.t3tools.T3Code.desktop
No registered applications
No recommended applications
mimeinfo.cache: absent

After — PR head 21a30a5ec4

xdg-mime default: com.t3tools.T3Code.desktop
GIO default: com.t3tools.T3Code.desktop
Registered applications:
    com.t3tools.T3Code.desktop
Recommended applications:
    com.t3tools.T3Code.desktop

[MIME Cache]
x-scheme-handler/t3code=com.t3tools.T3Code.desktop;

gio open dispatched a synthetic t3code://oauth/callback?code=pr8673-test&state=isolated URL intact as one argument to a temporary handler executable whose path contained a space. A socket receipt confirmed delivery; no real OAuth account or installed T3 instance was used.

Verification

ScenarioResult
Focused URL-handler and pre-ready platform tests13/13 passed across two files.
Desktop typecheck; changed-file lint and formatting; diff checkAll passed.
Successful refresh and URL dispatchCache populated; GIO discovers handler and delivers complete URL.
Existing desktop entryRepeat registration preserved nanosecond modification time.
Missing update-desktop-databaseWarning logged; xdg-mime still recorded the default.
Refresh exits with status 7Warning contains exit code; default registration continues.
Real stalled refresh processRegistration completed in 5,031 ms; spawned child no longer existed; default recorded.
Development modeEntry written; no cache refresh or default registration.
macOS and Windows guards, simulated on LinuxNo handler directory created.
Write failure; xdg-mime failure; executable fallbackCovered by the passing focused suite.

Commands: vp test run src/app/DesktopLinuxUrlHandler.test.ts src/app/DesktopPreReadyPlatform.test.ts from apps/desktop; vp run --filter @t3tools/desktop typecheck; targeted vp lint and vp fmt --check. No repo-wide suite was run locally.

Merge risk & limits

Low implementation risk. The added subprocess runs only for packaged Linux registration. A missing or failing utility leaves discovery unfixed but preserves the existing default-setting path. A stalled utility adds roughly five seconds to startup before registration continues.

The production code preserves the dynamic desktop-entry name, pre-ready write and unchanged-content check requested in the earlier review. The remaining review nit is test hardening: unit tests record writes and commands separately rather than asserting their combined order. The real integration run confirmed the correct final cache contents.

Surface coverage: desktop Linux startup applies. Web, mobile, provider adapters, wire contracts, Settings/command palette entry points and remote connection paths are unchanged. macOS/Windows exclusion was tested through environment guards, not native execution. No documentation change is needed for this fix.

Not exercised: a complete OAuth round trip in a packaged Electron build or each browser’s portal integration. The screenshots verify the native GTK chooser’s before/after behavior. The separate GIO dispatch test verifies delivery to an isolated executable, not account login.

Source files were not edited. Temporary harnesses, MIME utilities, XDG fixtures and local screenshots are removed after publishing; isolated X displays were stopped. No dev server was started; live user state and URL-handler defaults were not changed.

Tested by GPT-6-Astra through the Codex harness.