fix(app): gate worktree creation to Git projects - #46930
Open
Hona wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new E2E spec uses an invalid toBeEnabled({ enabled: ... }) matcher option, which will fail type-checking and/or test execution.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR tightens Git-only UX around worktree creation by requiring explicit Git project metadata before enabling “New worktree” flows, while keeping non-Git review diffs and existing-directory moves functional.
Changes:
- Gate worktree creation UI/actions on
project.vcs === "git"(session menu + summary suggestion). - Stop inferring Git capability from branch presence when deciding whether to expose new-session worktree controls.
- Add/adjust regression coverage for Git vs non-Git behavior across desktop/mobile.
File summaries
| File | Description |
|---|---|
| packages/app/src/session/timeline/session-workspace-menu.tsx | Disables “New worktree” menu item unless the project is Git. |
| packages/app/src/session/timeline/message-timeline.tsx | Hides the “Move to worktree” suggestion unless the project is Git. |
| packages/app/src/new-session/workspace/controller.ts | Requires projectVcs === "git" to treat the project as Git-capable (removes branch-based inference). |
| packages/app/src/new-session/workspace/controller.test.ts | Updates unit tests to reflect stricter Git detection and new worktree selection fallback handling. |
| packages/app/src/new-session/view.tsx | Preserves branch label display for non-Git projects while keeping Git-only actions gated elsewhere. |
| packages/app/e2e/regression/session-worktree-capabilities.spec.ts | Adds E2E coverage to ensure creation is gated but existing moves remain available (contains a matcher misuse noted in review comments). |
| packages/app/e2e/regression/new-session-workspace-branch.spec.ts | Extends E2E coverage to confirm non-Git projects don’t show the worktree-selection UI even if branches exist. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+62
to
+65
| const create = page.getByRole("menuitem", { name: "New worktree", exact: true }) | ||
| await expect(create).toBeVisible() | ||
| await expect.soft(create).toBeEnabled({ enabled: vcs === "git" }) | ||
| await info.attach("destinations", { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
upstream/v2)