Skip to content

fix(cursor): centralize platform-aware Cursor storage path resolution - #740

Open
beruro wants to merge 3 commits into
developfrom
junyu/fix-cursor-storage-paths
Open

fix(cursor): centralize platform-aware Cursor storage path resolution#740
beruro wants to merge 3 commits into
developfrom
junyu/fix-cursor-storage-paths

Conversation

@beruro

@beruro beruro commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

Cursor storage paths were resolved independently in agent_cli and orgtrack_core. One implementation was macOS-only and fabricated /Users/_unknown when home discovery failed; the other had a broader but separate platform matrix. The duplicate ownership produced incorrect Linux/Windows behavior and inconsistent override handling.

Solution

  • Add the canonical resolver under the workspace's existing leaf crate, app_paths::cursor, and make both consumers delegate to it.
  • Resolve macOS, Linux/XDG, and Windows/APPDATA layouts with explicit fallbacks.
  • Preserve ORGII_EXTERNAL_HISTORY_HOME isolation and keep the Cursor plugin cache home-anchored.
  • Return typed unavailability instead of manufacturing a filesystem path; both consumers degrade to their existing "Cursor not installed" empty state.
  • Implement the core as a pure CursorEnv plus platform resolver so every platform and override path can be tested on any host.

The branch is merged with the current develop; GitHub reports it mergeable.

Potential risks

  • Linux now honors absolute XDG_CONFIG_HOME, and Windows honors relocated %APPDATA%; this intentionally changes edge configurations to match Cursor/Electron behavior.
  • agent_cli is now isolated by ORGII_EXTERNAL_HISTORY_HOME, consistent with other external-history discovery but different from its previous real-home lookup.
  • Missing-home behavior now returns None immediately instead of probing a fabricated path whose existence check failed; the user-visible result is equivalent.
  • Other Cursor-path duplicates remain outside this PR and are follow-up sweep candidates.
  • There is no persistence, schema, wire, or dependency migration. Rollback is a normal revert to the two prior resolvers.

Audit

Architecture review covered path ownership, dependency direction, platform/config precedence, typed failure handling, caller compatibility, and initialization parity. The canonical leaf-crate placement avoids a new agent_cli -> orgtrack_core dependency edge.

Verification

  • cargo test -p app_pathsPASS, 21 passed / 0 failed, including the 13 Cursor-path matrix tests.
  • cargo check -p agent_cli -p orgtrack_core -p app_pathsPASS.
  • git diff --checkPASS.
  • Merge of current origin/developPASS, no conflicts; checks were run after integration.

@beruro
beruro marked this pull request as ready for review August 8, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant