fix(projects): keep nested workspaces out of their repository's row - #10922
fix(projects): keep nested workspaces out of their repository's row#10922VIPlearner wants to merge 3 commits into
Conversation
Repository grouping keyed the sidebar row on the git remote alone, so two projects in one monorepo collapsed into a single row named after the repository. That row targets one member and the project picker offers one entry, so a thread started from it runs in a folder you did not choose. Group keys now include the repo-relative path. Checkouts of one folder still share a row across environments and worktrees, which is what the setting is for. This made repository_path identical to repository, so the duplicate choice is gone from the web and mobile pickers. The literal stays in the contract, so stored preferences and per-checkout overrides still decode. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| return canonicalKey; | ||
| } | ||
|
|
||
| const relativeProjectPath = deriveRepositoryRelativeProjectPath(project); |
There was a problem hiding this comment.
🟠 High state/projectGrouping.ts:113
For repositories rooted at / or a Windows drive root, nested workspaces such as /services/api receive the bare canonicalKey, so all nested projects collapse into one sidebar row. deriveRepositoryRelativeProjectPath builds a rootPrefix with a duplicate separator (// or c:\), causing the nested path check to fail; handle filesystem roots without appending another separator.
🤖 Copy this AI Prompt to have your agent fix this:
In file @packages/client-runtime/src/state/projectGrouping.ts around line 113:
For repositories rooted at `/` or a Windows drive root, nested workspaces such as `/services/api` receive the bare `canonicalKey`, so all nested projects collapse into one sidebar row. `deriveRepositoryRelativeProjectPath` builds a `rootPrefix` with a duplicate separator (`//` or `c:\`), causing the nested path check to fail; handle filesystem roots without appending another separator.
There was a problem hiding this comment.
Confirmed and fixed in 946a33e.
trimTrailingPathSeparators returns root paths unchanged, so / produced the prefix // and c:\ produced c:\\, and no nested path matched. rootPrefix now appends the separator only when the root does not already end with one.
Two tests cover it, one for / and one for a Windows drive root. Both fail against the previous rootPrefix line and pass now.
There was a problem hiding this comment.
Sorry, I'm unable to act on this request because you do not have permissions within this repository.
There was a problem hiding this comment.
🟡 Medium
When persisted projectGroupingMode is "repository_path", no radio button is checked, so the settings screen shows grouping enabled with no selected choice. resolveMobileProjectGroupingSettings preserves this legacy value, but GROUPING_OPTIONS no longer includes it; normalize "repository_path" to "repository" before comparing or render it as the repository selection.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/mobile/src/features/settings/SettingsProjectGroupingRouteScreen.tsx around line 34:
When persisted `projectGroupingMode` is `"repository_path"`, no radio button is checked, so the settings screen shows grouping enabled with no selected choice. `resolveMobileProjectGroupingSettings` preserves this legacy value, but `GROUPING_OPTIONS` no longer includes it; normalize `"repository_path"` to `"repository"` before comparing or render it as the `repository` selection.
There was a problem hiding this comment.
Confirmed and fixed in 946a33e.
Rather than patch the comparison in the mobile screen, the legacy value is normalized where the preference is read: selectProjectGroupingSettings on web (mode and per-checkout overrides) and resolveMobileProjectGroupingSettings on mobile both map repository_path onto repository. The pickers then only ever see the two modes that still differ, and ProjectDefaultsSettings, which reads client settings directly, normalizes its select value too.
Covered by a new client-runtime test for the selector and a mobile test for the persisted legacy value.
There was a problem hiding this comment.
Sorry, I'm unable to act on this request because you do not have permissions within this repository.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — The change modifies the existing default repository-grouping behavior across web and mobile, so it affects users without opting into a new mode. Unresolved findings also identify failures for filesystem-root repositories and persisted legacy mobile preferences. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change unifies repository grouping across runtime logic and settings surfaces. Nested workspaces remain separate, matching checkouts group together, and ChangesRepository grouping
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Repository grouping now keeps nested workspaces separate while preserving grouping for matching checkouts, including legacy preferences and filesystem-root repositories. No current merge-blocking risk is identified. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…ries A repository rooted at "/" or a Windows drive root already ends with its separator, so appending another one built a "//" prefix that no nested path matched. Every nested workspace fell back to the bare repository key and collapsed into one row, the case this branch set out to fix. Reading the grouping preference now maps the legacy repository_path value onto repository. The mobile settings screen left no radio checked for a stored repository_path, and the web pickers had no matching item. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Status for whoever picks this up: the Macroscope verdict above predates the fixes. Both blocking findings are addressed:
Local verification on the current head: 334 tests across the touched files, plus On the approvability note that this "modifies the existing default": that is deliberate, and I think it is the only fix that works. Client settings are written to disk fully materialized, so changing |
Fixes #10930
A project is keyed by its workspace path, so two folders in one repository are two
projects. Sidebar grouping did not agree: in the default
repositorymode the groupkey was the git remote alone, so every project sharing a remote collapsed into one row
named after the repository.
In a monorepo that row is unusable. Adding
~/code/app/services/apinext to~/code/appproduces a single
owner/approw. The row targets one member, the project picker offersone entry, and a thread started from it runs in the other folder. There is no way to aim
an agent at the folder you chose.
Repository grouping now keys on the repository and the repo-relative path. Checkouts of
one folder still share a row across environments and worktrees, which is what the
setting is for. A folder inside a repository keeps its own row.
That made
repository_pathbehave exactly likerepository, so the duplicate choice isgone from the web sidebar dialog, Settings -> Projects, Settings -> Project defaults, and
the mobile grouping screen. The literal stays in the contract, and reading the preference
maps it onto
repository, so stored preferences and per-checkout overrides still work.A repository rooted at
/or a Windows drive root already ends with its separator. Therepo-relative path check appended a second one, so no nested path matched and every
nested workspace collapsed anyway; that is fixed with tests for both root shapes.
Supersedes #8490, which diagnosed the same bug but also changed labels, search terms, and
added a setting.
Before
A demo workspace with four projects: the
acme-platformmonorepo, itsapps/webandservices/apifolders, and a separatetoolboxrepository. The three monorepo projectscollapse into one
acme-corp/platformrow, sowebandapicannot be selected.After
Each folder keeps its own row and is selectable.
toolboxis unchanged.Model: Claude Opus 5 (1M context), harness: Claude Code.
🤖 Generated with Claude Code