PBI-50 F1: SPRINT_BATCH execution-strategy + cross-repo blocker + branch-resume
Schema-migratie + Scrum4Me-side wiring voor de nieuwe SPRINT_IMPLEMENTATION-flow: - prisma: PrStrategy ADD VALUE 'SPRINT_BATCH'; ClaudeJobKind ADD VALUE 'SPRINT_IMPLEMENTATION'; nieuwe enum SprintTaskExecutionStatus; ClaudeJob.lease_until + status_lease_until index; SprintRun.previous_run_id (self-relation SprintRunChain) voor branch-hergebruik bij resume; nieuwe sprint_task_executions tabel met frozen plan_snapshot + verify_required_snapshot per task in scope. - actions/sprint-runs.ts startSprintRunCore: nieuwe blocker-type 'task_cross_repo' voor SPRINT_BATCH (pre-flight rejecteert sprints met cross-repo task_url). Bij SPRINT_BATCH: één SPRINT_IMPLEMENTATION ClaudeJob (geen per-task loop). - actions/sprint-runs.ts resumePausedSprintRunAction: SPRINT_BATCH-pad met remaining-execution-check; bij onafgemaakt werk → nieuwe SprintRun met previous_run_id + run.branch hergebruikt + nieuwe SPRINT_IMPLEMENTATION-job. Oude SprintRun → CANCELLED. Bestaande PBI-49 P0 scope-DONE pad ongewijzigd. - actions/products.ts updatePrStrategyAction: accepteert SPRINT_BATCH. - components/products/pr-strategy-select.tsx: drie opties met helptekst, gebruikt @prisma/client PrStrategy ipv lokaal type. - components/sprint/sprint-run-controls.tsx: BLOCKER_LABELS + blockerHref voor task_cross_repo. Migratie applied op Neon. Type-check + 532 tests groen. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e6dcc91383
commit
d41e01f2e6
6 changed files with 292 additions and 68 deletions
|
|
@ -399,14 +399,14 @@ export async function updateAutoPrAction(id: string, auto_pr: boolean) {
|
|||
|
||||
export async function updatePrStrategyAction(
|
||||
id: string,
|
||||
pr_strategy: 'SPRINT' | 'STORY',
|
||||
pr_strategy: 'SPRINT' | 'STORY' | 'SPRINT_BATCH',
|
||||
) {
|
||||
const session = await getSession()
|
||||
if (!session.userId) return { error: 'Niet ingelogd' }
|
||||
if (session.isDemo) return { error: 'Niet beschikbaar in demo-modus' }
|
||||
|
||||
const parsed = z
|
||||
.object({ pr_strategy: z.enum(['SPRINT', 'STORY']) })
|
||||
.object({ pr_strategy: z.enum(['SPRINT', 'STORY', 'SPRINT_BATCH']) })
|
||||
.safeParse({ pr_strategy })
|
||||
if (!parsed.success) return { error: 'Ongeldige waarde voor pr_strategy' }
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,11 @@ async function getSession() {
|
|||
return getIronSession<SessionData>(await cookies(), sessionOptions)
|
||||
}
|
||||
|
||||
export type PreFlightBlockerType = 'task_no_plan' | 'open_question' | 'pbi_blocked'
|
||||
export type PreFlightBlockerType =
|
||||
| 'task_no_plan'
|
||||
| 'open_question'
|
||||
| 'pbi_blocked'
|
||||
| 'task_cross_repo'
|
||||
|
||||
export interface PreFlightBlocker {
|
||||
type: PreFlightBlockerType
|
||||
|
|
@ -122,6 +126,23 @@ async function startSprintRunCore(
|
|||
}
|
||||
}
|
||||
|
||||
// PBI-50: SPRINT_BATCH cross-repo blocker. Eén product-worktree =
|
||||
// alle tasks moeten in product.repo_url werken; task.repo_url-override
|
||||
// is incompatibel met deze flow.
|
||||
if (sprint.product.pr_strategy === 'SPRINT_BATCH') {
|
||||
for (const s of stories) {
|
||||
for (const t of s.tasks) {
|
||||
if (t.repo_url && t.repo_url !== sprint.product.repo_url) {
|
||||
blockers.push({
|
||||
type: 'task_cross_repo',
|
||||
id: t.id,
|
||||
label: `${t.code}: ${t.title}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (blockers.length > 0) {
|
||||
return { ok: false, error: 'PRE_FLIGHT_BLOCKED', blockers }
|
||||
}
|
||||
|
|
@ -147,6 +168,26 @@ async function startSprintRunCore(
|
|||
)
|
||||
.flatMap((s) => s.tasks)
|
||||
|
||||
// PBI-50: SPRINT_BATCH levert één SPRINT_IMPLEMENTATION-job die alle
|
||||
// tasks in één claude-sessie afhandelt. SprintTaskExecution-rows worden
|
||||
// server-side bij claim aangemaakt zodat order/base_sha consistent zijn
|
||||
// met de worktree-state op claim-tijd.
|
||||
if (sprint.product.pr_strategy === 'SPRINT_BATCH') {
|
||||
await tx.claudeJob.create({
|
||||
data: {
|
||||
user_id,
|
||||
product_id: sprint.product_id,
|
||||
task_id: null,
|
||||
idea_id: null,
|
||||
sprint_run_id: sprintRun.id,
|
||||
kind: 'SPRINT_IMPLEMENTATION',
|
||||
status: 'QUEUED',
|
||||
},
|
||||
})
|
||||
return { ok: true, sprint_run_id: sprintRun.id, jobs_count: 1 }
|
||||
}
|
||||
|
||||
// STORY / SPRINT (per-task): bestaand pad.
|
||||
for (const t of orderedTasks) {
|
||||
await tx.claudeJob.create({
|
||||
data: {
|
||||
|
|
@ -263,10 +304,18 @@ export async function resumePausedSprintRunAction(
|
|||
|
||||
const sprint_run_id = parsed.data.sprint_run_id
|
||||
|
||||
const userId = session.userId
|
||||
const result = await prisma.$transaction(async (tx) => {
|
||||
const run = await tx.sprintRun.findUnique({
|
||||
where: { id: sprint_run_id },
|
||||
select: { id: true, status: true, sprint_id: true, pause_context: true },
|
||||
select: {
|
||||
id: true,
|
||||
status: true,
|
||||
sprint_id: true,
|
||||
pr_strategy: true,
|
||||
branch: true,
|
||||
pause_context: true,
|
||||
},
|
||||
})
|
||||
if (!run) return { ok: false as const, error: 'SPRINT_RUN_NOT_FOUND', code: 404 }
|
||||
if (run.status !== 'PAUSED')
|
||||
|
|
@ -280,6 +329,57 @@ export async function resumePausedSprintRunAction(
|
|||
})
|
||||
}
|
||||
|
||||
// PBI-50: SPRINT_BATCH resume-pad — als de SprintRun hangt aan een
|
||||
// SPRINT_IMPLEMENTATION-job en er nog onafgemaakte SprintTaskExecution-rows
|
||||
// zijn (PENDING/RUNNING), maak NIEUWE SprintRun met previous_run_id +
|
||||
// hergebruikte branch + nieuwe SPRINT_IMPLEMENTATION-job. Oude SprintRun
|
||||
// gaat naar CANCELLED.
|
||||
const sprintJob = await tx.claudeJob.findFirst({
|
||||
where: { sprint_run_id, kind: 'SPRINT_IMPLEMENTATION' },
|
||||
select: { id: true, product_id: true },
|
||||
})
|
||||
if (sprintJob) {
|
||||
const remaining = await tx.sprintTaskExecution.count({
|
||||
where: {
|
||||
sprint_job_id: sprintJob.id,
|
||||
status: { in: ['PENDING', 'RUNNING'] },
|
||||
},
|
||||
})
|
||||
if (remaining > 0) {
|
||||
const newRun = await tx.sprintRun.create({
|
||||
data: {
|
||||
sprint_id: run.sprint_id,
|
||||
started_by_id: userId,
|
||||
status: 'QUEUED',
|
||||
pr_strategy: run.pr_strategy,
|
||||
branch: run.branch,
|
||||
previous_run_id: run.id,
|
||||
started_at: new Date(),
|
||||
},
|
||||
})
|
||||
await tx.claudeJob.create({
|
||||
data: {
|
||||
user_id: userId,
|
||||
product_id: sprintJob.product_id,
|
||||
task_id: null,
|
||||
idea_id: null,
|
||||
sprint_run_id: newRun.id,
|
||||
kind: 'SPRINT_IMPLEMENTATION',
|
||||
status: 'QUEUED',
|
||||
},
|
||||
})
|
||||
await tx.sprintRun.update({
|
||||
where: { id: sprint_run_id },
|
||||
data: {
|
||||
status: 'CANCELLED',
|
||||
pause_context: Prisma.JsonNull,
|
||||
finished_at: new Date(),
|
||||
},
|
||||
})
|
||||
return { ok: true as const, sprint_id: run.sprint_id, finalStatus: 'QUEUED' as const }
|
||||
}
|
||||
}
|
||||
|
||||
const activeClaims = await tx.claudeJob.count({
|
||||
where: { sprint_run_id, status: { in: ['CLAIMED', 'RUNNING'] } },
|
||||
})
|
||||
|
|
@ -287,11 +387,10 @@ export async function resumePausedSprintRunAction(
|
|||
where: { sprint_run_id, status: 'QUEUED' },
|
||||
})
|
||||
|
||||
// PBI-49 P0: a STORY auto-merge MERGE_CONFLICT lands AFTER all tasks are
|
||||
// already DONE (storyBecameDone fires the conflict). Going back to QUEUED
|
||||
// would hang the SprintRun forever — there is no QUEUED job to claim.
|
||||
// When the scope is fully complete, transition straight to DONE; the
|
||||
// dev resolved the conflict manually and the PR is theirs to merge.
|
||||
// PBI-49 P0: een STORY auto-merge MERGE_CONFLICT komt NA dat alle tasks
|
||||
// al DONE zijn. Terug naar QUEUED zou de SprintRun voor altijd laten
|
||||
// hangen — geen QUEUED job. Bij volledige scope-completion transitie
|
||||
// direct naar DONE; de dev heeft het conflict opgelost, de PR is van hen.
|
||||
let nextStatus: 'RUNNING' | 'QUEUED' | 'DONE'
|
||||
let finishedAt: Date | undefined
|
||||
if (activeClaims === 0 && queuedJobs === 0) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import { useState, useTransition } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import type { PrStrategy } from '@prisma/client'
|
||||
import { updatePrStrategyAction } from '@/actions/products'
|
||||
import {
|
||||
Select,
|
||||
|
|
@ -10,29 +11,33 @@ import {
|
|||
SelectTrigger,
|
||||
} from '@/components/ui/select'
|
||||
|
||||
type PrStrategy = 'SPRINT' | 'STORY'
|
||||
|
||||
interface PrStrategySelectProps {
|
||||
productId: string
|
||||
initialValue: PrStrategy
|
||||
}
|
||||
|
||||
const STRATEGY_LABELS: Record<PrStrategy, string> = {
|
||||
SPRINT: 'Per sprint — één PR voor de hele sprint, klaar voor review aan eind',
|
||||
STORY: 'Per story — auto-merge na CI groen, één PR per story',
|
||||
SPRINT:
|
||||
'Per sprint — één PR voor de hele sprint, klaar voor review aan eind. Per task een eigen claude-sessie.',
|
||||
STORY:
|
||||
'Per story — auto-merge na CI groen, één PR per story. Per task een eigen claude-sessie.',
|
||||
SPRINT_BATCH:
|
||||
'Sprint batch — één claude-sessie voor de hele sprint, sneller en behoudt context. Vereist alle tasks in de product-hoofdrepo.',
|
||||
}
|
||||
|
||||
const VALID_VALUES: ReadonlyArray<PrStrategy> = ['SPRINT', 'STORY', 'SPRINT_BATCH']
|
||||
|
||||
export function PrStrategySelect({ productId, initialValue }: PrStrategySelectProps) {
|
||||
const [value, setValue] = useState<PrStrategy>(initialValue)
|
||||
const [isPending, startTransition] = useTransition()
|
||||
|
||||
function handleChange(next: string | null) {
|
||||
if (next !== 'SPRINT' && next !== 'STORY') return
|
||||
if (!next || !VALID_VALUES.includes(next as PrStrategy)) return
|
||||
if (next === value) return
|
||||
const previous = value
|
||||
setValue(next)
|
||||
setValue(next as PrStrategy)
|
||||
startTransition(async () => {
|
||||
const result = await updatePrStrategyAction(productId, next)
|
||||
const result = await updatePrStrategyAction(productId, next as PrStrategy)
|
||||
if ('error' in result && result.error) {
|
||||
setValue(previous)
|
||||
toast.error(typeof result.error === 'string' ? result.error : 'Opslaan mislukt')
|
||||
|
|
@ -49,6 +54,7 @@ export function PrStrategySelect({ productId, initialValue }: PrStrategySelectPr
|
|||
<SelectContent>
|
||||
<SelectItem value="SPRINT">{STRATEGY_LABELS.SPRINT}</SelectItem>
|
||||
<SelectItem value="STORY">{STRATEGY_LABELS.STORY}</SelectItem>
|
||||
<SelectItem value="SPRINT_BATCH">{STRATEGY_LABELS.SPRINT_BATCH}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ const BLOCKER_LABELS: Record<PreFlightBlocker['type'], string> = {
|
|||
task_no_plan: 'Task zonder implementation plan',
|
||||
open_question: 'Openstaande vraag aan jou',
|
||||
pbi_blocked: 'PBI is geblokkeerd of gefaald',
|
||||
task_cross_repo: 'Task met afwijkende repo (niet toegestaan in SPRINT_BATCH)',
|
||||
}
|
||||
|
||||
function blockerHref(productId: string, blocker: PreFlightBlocker): string {
|
||||
|
|
@ -54,6 +55,8 @@ function blockerHref(productId: string, blocker: PreFlightBlocker): string {
|
|||
return `/products/${productId}/sprint`
|
||||
case 'pbi_blocked':
|
||||
return `/products/${productId}`
|
||||
case 'task_cross_repo':
|
||||
return `/products/${productId}/sprint?editTask=${blocker.id}`
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
-- PBI-50: SPRINT_IMPLEMENTATION single-session sprint runner
|
||||
-- Adds:
|
||||
-- - PrStrategy.SPRINT_BATCH (third option)
|
||||
-- - ClaudeJobKind.SPRINT_IMPLEMENTATION (fifth kind)
|
||||
-- - SprintTaskExecutionStatus enum
|
||||
-- - ClaudeJob.lease_until (for heartbeat-driven stale detection)
|
||||
-- - SprintRun.previous_run_id (for branch reuse on resume)
|
||||
-- - sprint_task_executions table (frozen scope-snapshot per claim)
|
||||
|
||||
-- AlterEnum: PrStrategy ADD VALUE (Postgres requires this outside transaction;
|
||||
-- Prisma migrate handles it)
|
||||
ALTER TYPE "PrStrategy" ADD VALUE 'SPRINT_BATCH';
|
||||
|
||||
-- AlterEnum: ClaudeJobKind ADD VALUE
|
||||
ALTER TYPE "ClaudeJobKind" ADD VALUE 'SPRINT_IMPLEMENTATION';
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "SprintTaskExecutionStatus" AS ENUM ('PENDING', 'RUNNING', 'DONE', 'FAILED', 'SKIPPED');
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "claude_jobs" ADD COLUMN "lease_until" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "sprint_runs" ADD COLUMN "previous_run_id" TEXT;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "sprint_task_executions" (
|
||||
"id" TEXT NOT NULL,
|
||||
"sprint_job_id" TEXT NOT NULL,
|
||||
"task_id" TEXT NOT NULL,
|
||||
"order" INTEGER NOT NULL,
|
||||
"plan_snapshot" TEXT NOT NULL,
|
||||
"verify_required_snapshot" "VerifyRequired" NOT NULL,
|
||||
"verify_only_snapshot" BOOLEAN NOT NULL DEFAULT false,
|
||||
"base_sha" TEXT,
|
||||
"head_sha" TEXT,
|
||||
"status" "SprintTaskExecutionStatus" NOT NULL DEFAULT 'PENDING',
|
||||
"verify_result" "VerifyResult",
|
||||
"verify_summary" TEXT,
|
||||
"skip_reason" TEXT,
|
||||
"started_at" TIMESTAMP(3),
|
||||
"finished_at" TIMESTAMP(3),
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "sprint_task_executions_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "sprint_task_executions_sprint_job_id_order_idx" ON "sprint_task_executions"("sprint_job_id", "order");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "sprint_task_executions_sprint_job_id_task_id_key" ON "sprint_task_executions"("sprint_job_id", "task_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "claude_jobs_status_lease_until_idx" ON "claude_jobs"("status", "lease_until");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "sprint_runs_previous_run_id_key" ON "sprint_runs"("previous_run_id");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "sprint_runs" ADD CONSTRAINT "sprint_runs_previous_run_id_fkey" FOREIGN KEY ("previous_run_id") REFERENCES "sprint_runs"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "sprint_task_executions" ADD CONSTRAINT "sprint_task_executions_sprint_job_id_fkey" FOREIGN KEY ("sprint_job_id") REFERENCES "claude_jobs"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "sprint_task_executions" ADD CONSTRAINT "sprint_task_executions_task_id_fkey" FOREIGN KEY ("task_id") REFERENCES "tasks"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
|
@ -92,6 +92,7 @@ enum SprintRunStatus {
|
|||
enum PrStrategy {
|
||||
SPRINT
|
||||
STORY
|
||||
SPRINT_BATCH
|
||||
}
|
||||
|
||||
enum IdeaStatus {
|
||||
|
|
@ -110,6 +111,15 @@ enum ClaudeJobKind {
|
|||
IDEA_GRILL
|
||||
IDEA_MAKE_PLAN
|
||||
PLAN_CHAT
|
||||
SPRINT_IMPLEMENTATION
|
||||
}
|
||||
|
||||
enum SprintTaskExecutionStatus {
|
||||
PENDING
|
||||
RUNNING
|
||||
DONE
|
||||
FAILED
|
||||
SKIPPED
|
||||
}
|
||||
|
||||
enum IdeaLogType {
|
||||
|
|
@ -304,24 +314,27 @@ model Sprint {
|
|||
}
|
||||
|
||||
model SprintRun {
|
||||
id String @id @default(cuid())
|
||||
sprint Sprint @relation(fields: [sprint_id], references: [id], onDelete: Cascade)
|
||||
sprint_id String
|
||||
started_by User @relation("SprintRunStartedBy", fields: [started_by_id], references: [id])
|
||||
started_by_id String
|
||||
status SprintRunStatus @default(QUEUED)
|
||||
pr_strategy PrStrategy
|
||||
branch String?
|
||||
pr_url String?
|
||||
started_at DateTime?
|
||||
finished_at DateTime?
|
||||
failure_reason String?
|
||||
failed_task Task? @relation("SprintRunFailedTask", fields: [failed_task_id], references: [id], onDelete: SetNull)
|
||||
failed_task_id String?
|
||||
pause_context Json?
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
jobs ClaudeJob[]
|
||||
id String @id @default(cuid())
|
||||
sprint Sprint @relation(fields: [sprint_id], references: [id], onDelete: Cascade)
|
||||
sprint_id String
|
||||
started_by User @relation("SprintRunStartedBy", fields: [started_by_id], references: [id])
|
||||
started_by_id String
|
||||
status SprintRunStatus @default(QUEUED)
|
||||
pr_strategy PrStrategy
|
||||
branch String?
|
||||
pr_url String?
|
||||
started_at DateTime?
|
||||
finished_at DateTime?
|
||||
failure_reason String?
|
||||
failed_task Task? @relation("SprintRunFailedTask", fields: [failed_task_id], references: [id], onDelete: SetNull)
|
||||
failed_task_id String?
|
||||
pause_context Json?
|
||||
previous_run_id String? @unique
|
||||
previous_run SprintRun? @relation("SprintRunChain", fields: [previous_run_id], references: [id], onDelete: SetNull)
|
||||
next_run SprintRun? @relation("SprintRunChain")
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
jobs ClaudeJob[]
|
||||
|
||||
@@index([sprint_id, status])
|
||||
@@index([started_by_id, status])
|
||||
|
|
@ -329,32 +342,33 @@ model SprintRun {
|
|||
}
|
||||
|
||||
model Task {
|
||||
id String @id @default(cuid())
|
||||
story Story @relation(fields: [story_id], references: [id], onDelete: Cascade)
|
||||
story_id String
|
||||
product Product @relation(fields: [product_id], references: [id], onDelete: Cascade)
|
||||
product_id String
|
||||
sprint Sprint? @relation(fields: [sprint_id], references: [id])
|
||||
sprint_id String?
|
||||
code String @db.VarChar(30)
|
||||
title String
|
||||
description String?
|
||||
implementation_plan String?
|
||||
priority Int
|
||||
sort_order Float
|
||||
status TaskStatus @default(TO_DO)
|
||||
verify_only Boolean @default(false)
|
||||
verify_required VerifyRequired @default(ALIGNED_OR_PARTIAL)
|
||||
id String @id @default(cuid())
|
||||
story Story @relation(fields: [story_id], references: [id], onDelete: Cascade)
|
||||
story_id String
|
||||
product Product @relation(fields: [product_id], references: [id], onDelete: Cascade)
|
||||
product_id String
|
||||
sprint Sprint? @relation(fields: [sprint_id], references: [id])
|
||||
sprint_id String?
|
||||
code String @db.VarChar(30)
|
||||
title String
|
||||
description String?
|
||||
implementation_plan String?
|
||||
priority Int
|
||||
sort_order Float
|
||||
status TaskStatus @default(TO_DO)
|
||||
verify_only Boolean @default(false)
|
||||
verify_required VerifyRequired @default(ALIGNED_OR_PARTIAL)
|
||||
// Override product.repo_url for branch/worktree/push purposes. Set when
|
||||
// a task targets a different repo than its parent product (e.g. an
|
||||
// MCP-server task tracked under the main product's PBI). Falls back to
|
||||
// product.repo_url when null.
|
||||
repo_url String?
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
claude_questions ClaudeQuestion[]
|
||||
claude_jobs ClaudeJob[]
|
||||
sprint_run_failures SprintRun[] @relation("SprintRunFailedTask")
|
||||
repo_url String?
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
claude_questions ClaudeQuestion[]
|
||||
claude_jobs ClaudeJob[]
|
||||
sprint_run_failures SprintRun[] @relation("SprintRunFailedTask")
|
||||
sprint_task_executions SprintTaskExecution[]
|
||||
|
||||
@@unique([product_id, code])
|
||||
@@index([story_id, priority, sort_order])
|
||||
|
|
@ -364,20 +378,20 @@ model Task {
|
|||
}
|
||||
|
||||
model ClaudeJob {
|
||||
id String @id @default(cuid())
|
||||
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
||||
id String @id @default(cuid())
|
||||
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
||||
user_id String
|
||||
product Product @relation(fields: [product_id], references: [id], onDelete: Cascade)
|
||||
product Product @relation(fields: [product_id], references: [id], onDelete: Cascade)
|
||||
product_id String
|
||||
task Task? @relation(fields: [task_id], references: [id], onDelete: Cascade)
|
||||
task Task? @relation(fields: [task_id], references: [id], onDelete: Cascade)
|
||||
task_id String?
|
||||
idea Idea? @relation(fields: [idea_id], references: [id], onDelete: Cascade)
|
||||
idea Idea? @relation(fields: [idea_id], references: [id], onDelete: Cascade)
|
||||
idea_id String?
|
||||
sprint_run SprintRun? @relation(fields: [sprint_run_id], references: [id], onDelete: SetNull)
|
||||
sprint_run SprintRun? @relation(fields: [sprint_run_id], references: [id], onDelete: SetNull)
|
||||
sprint_run_id String?
|
||||
kind ClaudeJobKind @default(TASK_IMPLEMENTATION)
|
||||
status ClaudeJobStatus @default(QUEUED)
|
||||
claimed_by_token ApiToken? @relation(fields: [claimed_by_token_id], references: [id], onDelete: SetNull)
|
||||
kind ClaudeJobKind @default(TASK_IMPLEMENTATION)
|
||||
status ClaudeJobStatus @default(QUEUED)
|
||||
claimed_by_token ApiToken? @relation(fields: [claimed_by_token_id], references: [id], onDelete: SetNull)
|
||||
claimed_by_token_id String?
|
||||
claimed_at DateTime?
|
||||
started_at DateTime?
|
||||
|
|
@ -396,9 +410,11 @@ model ClaudeJob {
|
|||
pr_url String?
|
||||
summary String?
|
||||
error String?
|
||||
retry_count Int @default(0)
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
retry_count Int @default(0)
|
||||
lease_until DateTime?
|
||||
task_executions SprintTaskExecution[] @relation("SprintJobExecutions")
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
|
||||
@@index([user_id, status])
|
||||
@@index([task_id, status])
|
||||
|
|
@ -406,9 +422,41 @@ model ClaudeJob {
|
|||
@@index([sprint_run_id, status])
|
||||
@@index([status, claimed_at])
|
||||
@@index([status, finished_at])
|
||||
@@index([status, lease_until])
|
||||
@@map("claude_jobs")
|
||||
}
|
||||
|
||||
// PBI-50: frozen scope-snapshot per SPRINT_IMPLEMENTATION-claim. Bij claim
|
||||
// wordt voor elke TO_DO-task in scope één PENDING-record gemaakt met
|
||||
// implementation_plan + verify_required gesnapshot. Worker en gate werken
|
||||
// uitsluitend op deze rows; latere wijzigingen aan Task hebben geen
|
||||
// invloed op de lopende batch.
|
||||
model SprintTaskExecution {
|
||||
id String @id @default(cuid())
|
||||
sprint_job ClaudeJob @relation("SprintJobExecutions", fields: [sprint_job_id], references: [id], onDelete: Cascade)
|
||||
sprint_job_id String
|
||||
task Task @relation(fields: [task_id], references: [id], onDelete: Cascade)
|
||||
task_id String
|
||||
order Int
|
||||
plan_snapshot String @db.Text
|
||||
verify_required_snapshot VerifyRequired
|
||||
verify_only_snapshot Boolean @default(false)
|
||||
base_sha String?
|
||||
head_sha String?
|
||||
status SprintTaskExecutionStatus @default(PENDING)
|
||||
verify_result VerifyResult?
|
||||
verify_summary String? @db.Text
|
||||
skip_reason String? @db.Text
|
||||
started_at DateTime?
|
||||
finished_at DateTime?
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
|
||||
@@unique([sprint_job_id, task_id])
|
||||
@@index([sprint_job_id, order])
|
||||
@@map("sprint_task_executions")
|
||||
}
|
||||
|
||||
model ModelPrice {
|
||||
id String @id @default(cuid())
|
||||
model_id String @unique
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue