From 8be2b0656402596e365c8e826c127ac6297157af Mon Sep 17 00:00:00 2001 From: Yaojia Wang Date: Sun, 12 Jul 2026 19:03:53 +0200 Subject: [PATCH] fix(projects): worktree-create sent repoPath but the server reads path (400) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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'. --- public/projects.ts | Bin 36480 -> 36476 bytes test/worktree-form.test.ts | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/projects.ts b/public/projects.ts index 54b82c7e5e933eb2665dcf428c541ac426d80e27..d72fc3c66b27b351848980b0c8f696a4b841f442 100644 GIT binary patch delta 16 XcmZpe%k*as(*~I^#)8d?Veu9KIKKuC delta 20 bcmew}hpAyM(*~I^)}qvc{D94}Veu9KSBeLu diff --git a/test/worktree-form.test.ts b/test/worktree-form.test.ts index bf79eee..27f617e 100644 --- a/test/worktree-form.test.ts +++ b/test/worktree-form.test.ts @@ -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' }), }), ) })