Merge pull request #44 from madhura68/fix/attach-worktree-writes-branch
fix(attachWorktreeToJob): schrijf branch naar claudeJob.branch in DB
This commit is contained in:
commit
7d217cf443
2 changed files with 14 additions and 8 deletions
|
|
@ -6,7 +6,7 @@ import * as fs from 'node:fs/promises'
|
||||||
vi.mock('../src/prisma.js', () => ({
|
vi.mock('../src/prisma.js', () => ({
|
||||||
prisma: {
|
prisma: {
|
||||||
$executeRaw: vi.fn(),
|
$executeRaw: vi.fn(),
|
||||||
claudeJob: { findFirst: vi.fn(), findUnique: vi.fn() },
|
claudeJob: { findFirst: vi.fn(), findUnique: vi.fn(), update: vi.fn() },
|
||||||
product: { findUnique: vi.fn() },
|
product: { findUnique: vi.fn() },
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
@ -21,7 +21,7 @@ import { resolveRepoRoot, rollbackClaim, attachWorktreeToJob } from '../src/tool
|
||||||
|
|
||||||
const mockPrisma = prisma as unknown as {
|
const mockPrisma = prisma as unknown as {
|
||||||
$executeRaw: ReturnType<typeof vi.fn>
|
$executeRaw: ReturnType<typeof vi.fn>
|
||||||
claudeJob: { findFirst: ReturnType<typeof vi.fn>; findUnique: ReturnType<typeof vi.fn> }
|
claudeJob: { findFirst: ReturnType<typeof vi.fn>; findUnique: ReturnType<typeof vi.fn>; update: ReturnType<typeof vi.fn> }
|
||||||
product: { findUnique: ReturnType<typeof vi.fn> }
|
product: { findUnique: ReturnType<typeof vi.fn> }
|
||||||
}
|
}
|
||||||
const mockCreateWorktree = createWorktreeForJob as ReturnType<typeof vi.fn>
|
const mockCreateWorktree = createWorktreeForJob as ReturnType<typeof vi.fn>
|
||||||
|
|
|
||||||
|
|
@ -202,12 +202,18 @@ export async function attachWorktreeToJob(
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn(`[attachWorktreeToJob] failed to resolve base_sha for ${jobId}:`, err)
|
console.warn(`[attachWorktreeToJob] failed to resolve base_sha for ${jobId}:`, err)
|
||||||
}
|
}
|
||||||
if (baseSha) {
|
// Persist branch + base_sha. update_job_status (prepareDoneUpdate)
|
||||||
await prisma.claudeJob.update({
|
// leest claudeJob.branch om naar de juiste ref te pushen — zonder deze
|
||||||
where: { id: jobId },
|
// update valt 'ie terug op het legacy `feat/job-<8>` patroon en faalt
|
||||||
data: { base_sha: baseSha },
|
// de push met "src refspec ... does not match any" voor sprint/story
|
||||||
})
|
// strategy branches.
|
||||||
}
|
await prisma.claudeJob.update({
|
||||||
|
where: { id: jobId },
|
||||||
|
data: {
|
||||||
|
branch: actualBranch,
|
||||||
|
...(baseSha ? { base_sha: baseSha } : {}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
return { worktree_path: worktreePath, branch_name: actualBranch, reused_branch: reused }
|
return { worktree_path: worktreePath, branch_name: actualBranch, reused_branch: reused }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue