Skip to content

fix: support tilde paths and persistent recent dirs in mobile add-workspaces#512

Merged
Dimillian merged 5 commits intoDimillian:mainfrom
vforsh:fix/mobile-remote-paths-tilde-recents
Feb 27, 2026
Merged

fix: support tilde paths and persistent recent dirs in mobile add-workspaces#512
Dimillian merged 5 commits intoDimillian:mainfrom
vforsh:fix/mobile-remote-paths-tilde-recents

Conversation

@vforsh
Copy link
Contributor

@vforsh vforsh commented Feb 25, 2026

Summary

  • allow ~ (~/...) in Add project directories flow
  • add persistent Recently added list (MRU, deduped, limit 5)
  • clicking a recent directory appends to textarea only if missing
  • render recent path items as full-width rows in the popup
  • add compatibility fallback for ~/... expansion using known workspace home prefixes

Validation

  • npm run typecheck
  • npm run test -- src/features/workspaces/hooks/useWorkspaces.test.tsx src/features/app/hooks/useWorkspaceController.test.tsx
  • cargo check (run earlier during implementation)

Screenshot

SCR-20260225-jjrk

@vforsh
Copy link
Contributor Author

vforsh commented Feb 25, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 958f67a108

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 72 to 73
const expanded = homePrefixes.map((prefix) => `${prefix}/${rest}`);
return [...expanded, trimmed];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Try raw ~/ paths before heuristic prefix expansion

buildWorkspacePathCandidates puts inferred prefixes ahead of the literal tilde input, so the add loop validates and adds those guessed paths first. Since this commit also made backend ~ expansion work directly, this ordering can now silently choose an unrelated existing directory (or mark it as already added) when ~/... was intended, e.g. if a guessed /srv/.../<rest> exists, the literal home-relative path is never used.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f82c39b: buildWorkspacePathCandidates now tries raw ~/... first, then inferred home-prefix fallbacks only if needed. Added tests for both raw-first and fallback behavior.

@Dimillian
Copy link
Owner

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b2904b54a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@vforsh
Copy link
Contributor Author

vforsh commented Feb 26, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: afc6749017

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (!isDir) {
continue;
}
if (existingPaths.has(normalizeWorkspacePathKey(candidate))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Normalize tilde candidate before duplicate check

When a user already has /home/.../repo added and submits ~/.../repo, this branch compares existingPaths against the raw candidate string (~/...) instead of the normalized path, so the duplicate is not detected and addWorkspaceFromPath is called. In this same commit, backend add/check paths now expand ~ (normalize_workspace_path_input in add_workspace_core/is_workspace_path_dir_core), so the add succeeds and creates a second workspace entry for the same directory.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f976e36.

I updated duplicate detection to compare against normalized key candidates for ~ paths before add, so an existing /Users/... workspace now correctly blocks ~/... from being added as a duplicate.

I also added a regression test in useWorkspaces.test.tsx (skips raw tilde paths when an equivalent inferred path already exists) and verified with:

npm run test -- src/features/workspaces/hooks/useWorkspaces.test.tsx

@vforsh
Copy link
Contributor Author

vforsh commented Feb 27, 2026

Monsieur @Dimillian we can get this merged please?

@Dimillian Dimillian merged commit d125b88 into Dimillian:main Feb 27, 2026
9 checks passed
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.

2 participants