fix: support tilde paths and persistent recent dirs in mobile add-workspaces#512
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 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".
| const expanded = homePrefixes.map((prefix) => `${prefix}/${rest}`); | ||
| return [...expanded, trimmed]; |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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))) { |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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
|
Monsieur @Dimillian we can get this merged please? |
Summary
~(~/...) in Add project directories flow~/...expansion using known workspace home prefixesValidation
npm run typechecknpm run test -- src/features/workspaces/hooks/useWorkspaces.test.tsx src/features/app/hooks/useWorkspaceController.test.tsxcargo check(run earlier during implementation)Screenshot