Repository navigation
fix(desktop): treat nonempty relative XDG bases as unset, fall back to home - #10496
LexLuthorPrimero wants to merge 1 commit into
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The change reaches Linux desktop discovery and the state paths used by desktop capture. The PR appears safe to merge, with a non-blocking gap in regression coverage for desktop-entry lookup. Findings
Fix with agent prompt### Issue 1
src/desktop/ApplicationStateDirectories.test.ts:62-66
The new regression only exercises `stateDirectories` with a relative `XDG_CONFIG_HOME`. It never reaches the changed desktop-entry search, so removing the fix in `desktopEntryDirectories` would still leave it passing. Add an `inspectLinuxApplication` test with relative `XDG_DATA_HOME` and a desktop entry found only under `<home>/.local/share/applications`.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryRelative XDG bases now use the default folders under the user's home.
Reviews (1) · Last reviewed commit: "fix(desktop): treat nonempty relative XD..." · Reviewed by Greptile |
Summary
Fixes #9702.
A nonempty relative
XDG_CONFIG_HOME/XDG_DATA_HOME/XDG_STATE_HOME/XDG_CACHE_HOMEwas being treated as an absolute state-directory base, so the inventory resolvedXDG_*=relative/against REA's working directory — producing spurious state bases and concrete mistakes (e.g. reportingnotes.desktopmissing). The XDG Base Directory spec requires an absolute path; a relative value is out-of-contract and must not escape the caller's filesystem scope.Change and scope
src/desktop/absoluteStateBase.ts:absoluteStateBase(value, fallback)— returns the fallback when the value is unset/empty/relative; returns the absolute value otherwise.src/desktop/ApplicationStateDirectories.ts: the four bases instateDirectorieshonor it.src/desktop/LinuxApplicationInventory.ts:desktopEntryDirectoriesalso honors it (same root cause, second call site).src/desktop/ApplicationStateDirectories.test.ts: regression test — the relativeXDG_CONFIG_HOME="relative-config"case falls back to home, and therelative-config/notescandidate no longer leaks.Evidence
npx vitest run src/desktop— 267 passed, 5 skipped.npx vitest run src/desktop/ApplicationStateDirectories.test.ts— 2 passed including new regression.npm run typecheck,npm run format:check,npm run lint— passed.Known gaps / honest limitations
$XDG_DATA_HOME="foo"becomes<home>/.local/share, exactly the same behavior as an unset$XDG_DATA_HOME.Compatibility
Breaking changes: none operationally; arguably the previous behavior (silently using CWD-rooted candidates) was the defect this fixes.
Author readiness
Human owner: @LexLuthorPrimero