Repository navigation
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
|
Heads-up: this fix is necessary but not sufficient for the plain-subdirectory case. In v2.1.2 the project card pencil, the card menu item and the titlebar new-tab handler all open the draft with I confirmed it locally: with |
hcalt500
left a comment
There was a problem hiding this comment.
Thanks for the fix. The core change is directionally right: resolveSessionDirectory now returns the draft's selected directory for main, so a plain subdirectory session lands where it was opened (#51191), while explicit worktrees still resolve to the worktree and New worktree still uses the project directory.
Two things should be settled before this leaves draft, plus one testing gap.
1. This changes the behavior that #49668 deliberately introduced
#49668 (3355c93e, merged 2026-09-18, "fix(app): create local sessions in project root") made Local resolve to the project's canonical root, and covered this exact flow: open a draft at a worktree, switch New worktree -> Local, submit, expect the project root.
On this branch select("main") only updates selectedWorktree; it does not reset the draft's directory (new-session/workspace/controller.ts, select). With main now returning input.directory, that same flow submits to the worktree instead of the project root. In other words, the new a worktree directory row in new-session.spec.ts asserts the opposite of #49668's contract and will keep passing after the regression.
The old test file was renamed during later refactors, so I could not find a surviving copy of that case. Please either:
- call out the intentional behavior change from #49668 and add the replacement regression test (New worktree -> Local -> expected destination), or
- keep #49668 semantics and make switching to Local reset the draft directory to the project root / store a separate local destination.
Right now the PR description only mentions the nested-folder bug, not this behavioral flip.
2. Entry-point testing gap
The earlier comment says the project card, card menu and titlebar all pass project.worktree, so the draft never carries the subdirectory. That does not match this base:
home/projects/add.tsregisters each picked directory throughcontext.projects.open(item).projects.openstores{ worktree: directory, expanded: true }for that exact directory (runtime/server/registry.tsx).home/model.ts(openProjectNewSession),home/projects/view.tsx(menu item and new-session button at lines 765 and 803) andtitlebar.tsxall pass that localproject.worktree.
For a project added as a subdirectory, those paths should already carry the subdirectory. But all three new tests call openDraft directly, so nothing verifies the Home entry path. Could you add one Home-entry e2e (open the subdirectory project from Home -> new session -> submit -> assert location.directory) before changing those call sites? If it fails, the failing entry point is the thing to fix; if it passes, changing them is unnecessary.
3. Rebase
Still a draft, head a3c0fad9 (2026-10-20), base d30e990c. Current dev is 69269e4e; please rebase and rerun the e2e suite before marking ready.
…worktree A draft opened inside an existing worktree and switched to Local resolves to the project root again; other folders, such as repository subdirectories, keep their own location. Cover the worktree row and the New worktree -> Local flow. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
a3c0fad to
8f51627
Compare
|
Thanks for the review. Pushed
|
Issue for this PR
Fixes #51191
Addresses the plain-subdirectory report in #51992.
Type of change
What does this PR do?
Keep the draft's selected directory when creating a local session. The composer currently replaces it with the project's canonical directory, so selecting a folder inside a Git repository creates the session at the repository root.
Local sessions use the draft's directory, with one exception that preserves #49668: a draft opened inside an existing worktree and switched to Local still resolves to the project root. New worktrees still use the canonical project directory; explicitly selected worktrees are unchanged.
select("main")does not reset the draft's directory, so the worktree case is decided at submit time by checking whether the draft's directory is one of the project's worktrees.Behavior by scenario
A =
dev, B = this PR before the review fix, C = this PR now.repo/packages/app), Localrepo(#51191)repo/packages/apprepo/packages/appreporeporeporeporeporeporeporeporeporepoScenario 7 is out of scope. The Add project flow stores the server project, whose
worktreeis the canonical root, so the picked subdirectory is lost before a draft opens (addProjects->projects.add->location.get;openProjectNewSessionand the titlebar passproject.worktree). Fixing it means persisting the picked folder per project, which is a separate change. It is not covered by a test here.How did you verify your code works?
dev(67139d6827).new-session.spec.tspasses locally against the dev server (36 passed, no retries). The rest of the e2e suite has not been re-run since the rebase; CI on this PR is waiting for workflow approval.Screenshots / recordings
No visual layout changes. Browser verification status is recorded above.
Checklist