fix(projects): worktree-create sent repoPath but the server reads path (400)
The 'New worktree' form POSTed { repoPath, branch } to /projects/worktree, but
server.ts:706 and the documented contract (FEATURE_WALKAWAY_WORKBENCH FR-B3.1)
read body.path — so every browser worktree-create returned 400 'path and branch
are required' and git worktree add never ran. Send 'path' instead. The existing
worktree-form test had locked in the wrong key (asserted repoPath), which is why
it stayed green while the feature was broken; corrected to assert 'path'.
This commit is contained in:
@@ -230,7 +230,7 @@ describe('renderNewWorktreeForm', () => {
|
||||
expect(errorEl.style.display).not.toBe('none')
|
||||
})
|
||||
|
||||
it('POSTs to /projects/worktree with repoPath and branch on valid input', async () => {
|
||||
it('POSTs to /projects/worktree with path and branch on valid input', async () => {
|
||||
const mockFetch = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({ ok: true, path: '/home/user/my-repo-worktrees/feat', branch: 'feat' }),
|
||||
@@ -249,7 +249,9 @@ describe('renderNewWorktreeForm', () => {
|
||||
'/projects/worktree',
|
||||
expect.objectContaining({
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ repoPath: '/home/user/my-repo', branch: 'feat' }),
|
||||
// regression: the server (server.ts) + the docs contract read body.path,
|
||||
// NOT body.repoPath — sending repoPath 400'd every browser worktree-create.
|
||||
body: JSON.stringify({ path: '/home/user/my-repo', branch: 'feat' }),
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user