Repository navigation
Add parent worktree selection when creating workspace - #15420
AmethystLiang merged 4 commits into
Conversation
📝 WalkthroughWalkthroughThe change adds parent-worktree selection to the workspace composer. It validates repository, host, project, and workspace lineage boundaries during creation. Local and remote creation paths persist and return applicable lineage records. Renderer creation resolves stale parents, retries missing-parent failures without attachment, and merges results through shared helpers. Runtime and RPC payloads record manual parent provenance. Lineage refreshes preserve concurrent local changes. The change also extracts creation execution logic and updates related tests and selected-row styling. Merge Risk: 🔵 Low · up to The PR adds parent-worktree selection and sidebar lineage persistence, but a no-match search can clear an existing parent and a retained selection may cross the active folder boundary. These are bounded correctness issues requiring explicit owner follow-up before or after merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description clearly explains the problem, solution, scope, implementation areas, and automated testing. However, it omits required template sections and information, including the linked issue, visual proof or an explicit N/A explanation, manual testing and platform coverage, AI disclosure, review, agent skill boundary, notes, and checklist items. Resolution Add the missing template sections. Provide a linked issue using Full details: Docstring CoverageExplanation Docstring coverage is 16.28% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 86 functions across 49 files. (5 skipped: 5 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (3)
src/renderer/src/components/new-workspace/ComposerParentWorktreePicker.test.tsx (1)
308-324: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the host/project boundary filter.
storeState.projectHostSetupsstays empty in every test, sosharesWorktreeLineageBoundaryalways comparesundefinedhost and project ids. The filter that excludes a candidate running on a different host or project is never exercised. Add one case that seeds a project host setup and a candidate with a differenthostIdorprojectId, then assert the candidate is excluded.src/renderer/src/store/slices/worktrees-create-parent-pick.test.ts (1)
44-52: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueName the options argument index instead of writing to a bare position.
args[25] = { parentWorktreeId }couples both helpers to the exact arity ofcreateWorktree. If a positional parameter is added before the options object, the assignment silently targets the wrong slot whenever the neighbouring parameter type also accepts an object. Extract a shared constant (or a small helper inworktrees-slice-test-harness.ts) so both call sites and future create tests refer to one named index.♻️ Suggested shape
+// Index of the trailing options object in the positional createWorktree signature. +const CREATE_OPTIONS_ARG_INDEX = 25 + function createWithParentPick( store: ReturnType<typeof createTestStore>, parentWorktreeId: string ) { const createWorktree = store.getState().createWorktree const args: Parameters<typeof createWorktree> = ['repo1', 'feature', 'origin/main'] - args[25] = { parentWorktreeId } + args[CREATE_OPTIONS_ARG_INDEX] = { parentWorktreeId } return createWorktree(...args) }Also applies to: 241-246
src/renderer/src/store/slices/worktrees/create/worktree-create-payload.ts (1)
109-132: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winReuse the existing schema-derived type.
Export
WorktreeCreateParamsfromsrc/main/runtime/rpc/methods/worktree-create-args.tsand use it as the return type ofbuildRuntimeWorktreeCreateParamsinstead ofRecord<string, unknown>.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a123768e-0606-4b4a-ba2a-8cb311db178e
📒 Files selected for processing (37)
src/main/ipc/worktree-create-lineage.test.tssrc/main/ipc/worktree-remote.tssrc/main/ipc/worktrees.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/worktree-create-args.test.tssrc/main/runtime/rpc/methods/worktree-create-args.tssrc/main/runtime/rpc/methods/worktree-schemas.tssrc/renderer/src/assets/main.csssrc/renderer/src/components/NewWorkspaceComposerCard.test.tsxsrc/renderer/src/components/NewWorkspaceComposerCard.tsxsrc/renderer/src/components/new-workspace/ComposerParentWorktreePicker.test.tsxsrc/renderer/src/components/new-workspace/ComposerParentWorktreePicker.tsxsrc/renderer/src/components/right-sidebar/folder-workspace-attached-worktrees.tssrc/renderer/src/hooks/useComposerState.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/pending-worktree-creation.tssrc/renderer/src/lib/worktree-creation-flow-agent-trust-preflight.test.tssrc/renderer/src/lib/worktree-creation-flow-execute.tssrc/renderer/src/lib/worktree-creation-flow.tssrc/renderer/src/runtime/runtime-compatibility-test-fixture.tssrc/renderer/src/store/slices/worktree-helpers.tssrc/renderer/src/store/slices/worktrees-create-parent-pick.test.tssrc/renderer/src/store/slices/worktrees-fetch-remote-lineage.test.tssrc/renderer/src/store/slices/worktrees/create/create-worktree.tssrc/renderer/src/store/slices/worktrees/create/created-worktree-state-merge.tssrc/renderer/src/store/slices/worktrees/create/worktree-create-parent-pick.tssrc/renderer/src/store/slices/worktrees/create/worktree-create-payload.tssrc/renderer/src/store/slices/worktrees/listing/fetch-worktrees.tssrc/renderer/src/store/slices/worktrees/listing/runtime-worktree-rpc-errors.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-lineage-actions.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-lineage-host-merge.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-lineage-refresh.tssrc/renderer/src/web/web-preload-api-workspace-catalog.test.tssrc/renderer/src/web/web-preload-api.tssrc/shared/resolved-worktree-lineage.test.tssrc/shared/resolved-worktree-lineage.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
@coderabbitai Fixing. Will be in the next commit |
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
Enable users to pick a parent workspace in the composer's Advanced drawer, organizing newly created worktrees hierarchically in the sidebar. The backend validates lineage relationships and gracefully retries without the parent if it becomes unavailable during creation.
- Record app-picked parents as manual actions, not CLI-flag equivalents, ensuring the same user action carries consistent cleanup semantics across hosts - Gracefully retry without parent if the selection goes stale, warn the user instead of failing - Refactor create into modules: parent resolution, payload building, state merge
- New parent worktree picker filtered by execution host and project - Preserve concurrent local writes to lineage by comparing per-record state instead of key-set membership
7420562 to
7933b1a
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d5a625ab-fdbe-444a-9ebc-329ac43a0d7d
📒 Files selected for processing (38)
src/main/ipc/worktree-create-lineage.test.tssrc/main/ipc/worktree-remote.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/rpc/methods/worktree-create-args.test.tssrc/main/runtime/rpc/methods/worktree-create-args.tssrc/main/runtime/rpc/methods/worktree-create-schemas.tssrc/renderer/src/assets/main.csssrc/renderer/src/components/NewWorkspaceComposerCard.set-location.test.tsxsrc/renderer/src/components/NewWorkspaceComposerCard.test.tsxsrc/renderer/src/components/NewWorkspaceComposerCard.tsxsrc/renderer/src/components/new-workspace/ComposerParentWorktreePicker.test.tsxsrc/renderer/src/components/new-workspace/ComposerParentWorktreePicker.tsxsrc/renderer/src/components/new-workspace/NewWorkspaceComposerAdvancedSection.tsxsrc/renderer/src/components/new-workspace/new-workspace-composer-card-props.tssrc/renderer/src/components/right-sidebar/folder-workspace-attached-worktrees.tssrc/renderer/src/lib/pending-worktree-creation.tssrc/renderer/src/lib/worktree-creation-flow-agent-trust-preflight.test.tssrc/renderer/src/lib/worktree-creation-flow-execute.tssrc/renderer/src/lib/worktree-creation-flow.tssrc/renderer/src/runtime/runtime-compatibility-test-fixture.tssrc/renderer/src/store/slices/worktree-helpers.tssrc/renderer/src/store/slices/worktrees-create-parent-pick.test.tssrc/renderer/src/store/slices/worktrees-fetch-remote-lineage.test.tssrc/renderer/src/store/slices/worktrees/create/create-worktree.tssrc/renderer/src/store/slices/worktrees/create/created-worktree-state-merge.tssrc/renderer/src/store/slices/worktrees/create/worktree-create-parent-pick.tssrc/renderer/src/store/slices/worktrees/create/worktree-create-payload.tssrc/renderer/src/store/slices/worktrees/listing/fetch-worktrees.tssrc/renderer/src/store/slices/worktrees/listing/runtime-worktree-rpc-errors.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-lineage-actions.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-lineage-host-merge.tssrc/renderer/src/store/slices/worktrees/metadata/worktree-lineage-refresh.tssrc/renderer/src/web/preload-api/web-runtime-calls.tssrc/renderer/src/web/preload-api/web-worktrees-api.tssrc/renderer/src/web/web-preload-api-workspace-catalog.test.tssrc/shared/resolved-worktree-lineage.test.tssrc/shared/resolved-worktree-lineage.ts
🚧 Files skipped from review as they are similar to previous changes (28)
- src/renderer/src/lib/worktree-creation-flow-agent-trust-preflight.test.ts
- src/renderer/src/components/NewWorkspaceComposerCard.test.tsx
- src/renderer/src/lib/pending-worktree-creation.ts
- src/main/runtime/rpc/methods/worktree-create-args.ts
- src/renderer/src/components/right-sidebar/folder-workspace-attached-worktrees.ts
- src/renderer/src/store/slices/worktrees/listing/runtime-worktree-rpc-errors.ts
- src/main/runtime/rpc/methods/worktree-create-args.test.ts
- src/renderer/src/web/web-preload-api-workspace-catalog.test.ts
- src/main/ipc/worktree-create-lineage.test.ts
- src/renderer/src/store/slices/worktrees/create/created-worktree-state-merge.ts
- src/renderer/src/store/slices/worktrees/listing/fetch-worktrees.ts
- src/renderer/src/runtime/runtime-compatibility-test-fixture.ts
- src/renderer/src/store/slices/worktrees/create/worktree-create-payload.ts
- src/main/runtime/orca-runtime.ts
- src/shared/resolved-worktree-lineage.ts
- src/renderer/src/store/slices/worktrees-create-parent-pick.test.ts
- src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-actions.ts
- src/renderer/src/components/new-workspace/ComposerParentWorktreePicker.test.tsx
- src/renderer/src/assets/main.css
- src/renderer/src/store/slices/worktree-helpers.ts
- src/renderer/src/store/slices/worktrees/create/worktree-create-parent-pick.ts
- src/renderer/src/lib/worktree-creation-flow-execute.ts
- src/shared/resolved-worktree-lineage.test.ts
- src/main/runtime/orca-runtime.test.ts
- src/main/ipc/worktree-remote.ts
- src/renderer/src/lib/worktree-creation-flow.ts
- src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-refresh.ts
- src/renderer/src/store/slices/worktrees/create/create-worktree.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
- Rename "Parent workspace" label to "Parent worktree" - Filter candidates by execution host and project to prevent nesting across hosts - Wire parentWorktreeId through composer state and creation request pipeline - Update translations and add new copy for nesting-related messages
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/components/new-workspace/ComposerParentWorktreePicker.tsx (1)
295-301: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDo not clear on a no-match Enter. A nonempty query with zero matches clamps
activeIndexto0, so Enter callsonSelect(null)and clears an existing parent. Return without selecting when the query has no matches.Also applies to: 328-334
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: aa79b3da-5559-4900-aaac-64fdacd51fcb
📒 Files selected for processing (23)
src/renderer/src/components/NewWorkspaceComposerCard.test.tsxsrc/renderer/src/components/NewWorkspaceComposerCard.tsxsrc/renderer/src/components/new-workspace/ComposerParentWorktreePicker.test.tsxsrc/renderer/src/components/new-workspace/ComposerParentWorktreePicker.tsxsrc/renderer/src/components/new-workspace/NewWorkspaceComposerAdvancedSection.tsxsrc/renderer/src/components/new-workspace/new-workspace-composer-card-props.tssrc/renderer/src/hooks/composer-state/composer-card-contract.tssrc/renderer/src/hooks/composer-state/composer-card-props.tssrc/renderer/src/hooks/composer-state/composer-store-actions.tssrc/renderer/src/hooks/composer-state/composer-submit-orchestration.tssrc/renderer/src/hooks/composer-state/full-creation-execution.test.tssrc/renderer/src/hooks/composer-state/full-creation-execution.tssrc/renderer/src/hooks/composer-state/identity-model.tssrc/renderer/src/hooks/composer-state/quick-creation-execution.tssrc/renderer/src/hooks/composer-state/quick-creation-request.test.tssrc/renderer/src/hooks/composer-state/quick-creation-request.tssrc/renderer/src/hooks/composer-state/workspace-identity-state.tssrc/renderer/src/hooks/useComposerState.integration.test.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.json
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Addresses PR #15420 review feedback: parent worktree strings mixed 工作区 (workspace) and 工作树 (worktree) terminology.
…ale (#16954) * feat: select parent worktree for nesting when creating workspace Enable users to pick a parent workspace in the composer's Advanced drawer, organizing newly created worktrees hierarchically in the sidebar. The backend validates lineage relationships and gracefully retries without the parent if it becomes unavailable during creation. * feat: select parent worktree for nesting when creating workspace - Record app-picked parents as manual actions, not CLI-flag equivalents, ensuring the same user action carries consistent cleanup semantics across hosts - Gracefully retry without parent if the selection goes stale, warn the user instead of failing - Refactor create into modules: parent resolution, payload building, state merge * Allow selecting parent worktree when creating workspace - New parent worktree picker filtered by execution host and project - Preserve concurrent local writes to lineage by comparing per-record state instead of key-set membership * Allow selecting parent worktree when creating workspace - Rename "Parent workspace" label to "Parent worktree" - Filter candidates by execution host and project to prevent nesting across hosts - Wire parentWorktreeId through composer state and creation request pipeline - Update translations and add new copy for nesting-related messages * fix(i18n): use 工作树 consistently for parent worktree strings in zh locale Addresses PR #15420 review feedback: parent worktree strings mixed 工作区 (workspace) and 工作树 (worktree) terminology.
* feat: select parent worktree for nesting when creating workspace Enable users to pick a parent workspace in the composer's Advanced drawer, organizing newly created worktrees hierarchically in the sidebar. The backend validates lineage relationships and gracefully retries without the parent if it becomes unavailable during creation. * feat: select parent worktree for nesting when creating workspace - Record app-picked parents as manual actions, not CLI-flag equivalents, ensuring the same user action carries consistent cleanup semantics across hosts - Gracefully retry without parent if the selection goes stale, warn the user instead of failing - Refactor create into modules: parent resolution, payload building, state merge * Allow selecting parent worktree when creating workspace - New parent worktree picker filtered by execution host and project - Preserve concurrent local writes to lineage by comparing per-record state instead of key-set membership * Allow selecting parent worktree when creating workspace - Rename "Parent workspace" label to "Parent worktree" - Filter candidates by execution host and project to prevent nesting across hosts - Wire parentWorktreeId through composer state and creation request pipeline - Update translations and add new copy for nesting-related messages (cherry picked from commit 2ac23c2)
…ale (stablyai#16954) * feat: select parent worktree for nesting when creating workspace Enable users to pick a parent workspace in the composer's Advanced drawer, organizing newly created worktrees hierarchically in the sidebar. The backend validates lineage relationships and gracefully retries without the parent if it becomes unavailable during creation. * feat: select parent worktree for nesting when creating workspace - Record app-picked parents as manual actions, not CLI-flag equivalents, ensuring the same user action carries consistent cleanup semantics across hosts - Gracefully retry without parent if the selection goes stale, warn the user instead of failing - Refactor create into modules: parent resolution, payload building, state merge * Allow selecting parent worktree when creating workspace - New parent worktree picker filtered by execution host and project - Preserve concurrent local writes to lineage by comparing per-record state instead of key-set membership * Allow selecting parent worktree when creating workspace - Rename "Parent workspace" label to "Parent worktree" - Filter candidates by execution host and project to prevent nesting across hosts - Wire parentWorktreeId through composer state and creation request pipeline - Update translations and add new copy for nesting-related messages * fix(i18n): use 工作树 consistently for parent worktree strings in zh locale Addresses PR stablyai#15420 review feedback: parent worktree strings mixed 工作区 (workspace) and 工作树 (worktree) terminology. (cherry picked from commit 6f3c5cc)
* feat: select parent worktree for nesting when creating workspace Enable users to pick a parent workspace in the composer's Advanced drawer, organizing newly created worktrees hierarchically in the sidebar. The backend validates lineage relationships and gracefully retries without the parent if it becomes unavailable during creation. * feat: select parent worktree for nesting when creating workspace - Record app-picked parents as manual actions, not CLI-flag equivalents, ensuring the same user action carries consistent cleanup semantics across hosts - Gracefully retry without parent if the selection goes stale, warn the user instead of failing - Refactor create into modules: parent resolution, payload building, state merge * Allow selecting parent worktree when creating workspace - New parent worktree picker filtered by execution host and project - Preserve concurrent local writes to lineage by comparing per-record state instead of key-set membership * Allow selecting parent worktree when creating workspace - Rename "Parent workspace" label to "Parent worktree" - Filter candidates by execution host and project to prevent nesting across hosts - Wire parentWorktreeId through composer state and creation request pipeline - Update translations and add new copy for nesting-related messages
…ale (stablyai#16954) * feat: select parent worktree for nesting when creating workspace Enable users to pick a parent workspace in the composer's Advanced drawer, organizing newly created worktrees hierarchically in the sidebar. The backend validates lineage relationships and gracefully retries without the parent if it becomes unavailable during creation. * feat: select parent worktree for nesting when creating workspace - Record app-picked parents as manual actions, not CLI-flag equivalents, ensuring the same user action carries consistent cleanup semantics across hosts - Gracefully retry without parent if the selection goes stale, warn the user instead of failing - Refactor create into modules: parent resolution, payload building, state merge * Allow selecting parent worktree when creating workspace - New parent worktree picker filtered by execution host and project - Preserve concurrent local writes to lineage by comparing per-record state instead of key-set membership * Allow selecting parent worktree when creating workspace - Rename "Parent workspace" label to "Parent worktree" - Filter candidates by execution host and project to prevent nesting across hosts - Wire parentWorktreeId through composer state and creation request pipeline - Update translations and add new copy for nesting-related messages * fix(i18n): use 工作树 consistently for parent worktree strings in zh locale Addresses PR stablyai#15420 review feedback: parent worktree strings mixed 工作区 (workspace) and 工作树 (worktree) terminology.
Problem
Users couldn't organize newly created worktrees hierarchically in the sidebar, limiting their ability to manage workspaces by parent-child relationships.
Solution
Added a parent workspace picker in the composer's Advanced drawer that allows selecting any active worktree from the same repo as the parent for sidebar nesting. The feature:
Changes
UI Components
ComposerParentWorktreePickerwith search, virtualization, and keyboard navigationNewWorkspaceComposerCardto expose parent selection in Advanced drawerBackend
recordWorkspaceLineageForCreatedWorktreeandassertAttachableParentWorkspacefor adoption pathworktree-createinto payload builders and parent-pick handlingState & RPC
parentWorkspaceOrigin: 'manual'on app-selected picks so host records correct provenance (not CLI flag)WorktreeCreateParentPicktype for resolver logicCreateWorktreeCallOptionstype to includeparentWorktreeIdTests
Testing