PBI-47: schema, pause_context Zod, resumePausedSprintRunAction, PAUSED-banner UI (#137)
Scrum4Me-side counterpart of scrum4me-mcp@f7f5a48 (PBI-9 + PBI-47):
- prisma migration: ClaudeJob.{base_sha,head_sha} + SprintRun.pause_context
- lib/pause-context.ts: Zod schema + parsePauseContext + pauseReasonLabel
helper; single source of truth for the JSON pause_context shape produced
by the mcp sprint-run flow (MERGE_CONFLICT pause)
- actions/sprint-runs.ts: resumePausedSprintRunAction — separate from the
existing FAILED-resume flow, requires SprintRun.status === PAUSED, closes
the linked ClaudeQuestion, clears pause_context, sets RUNNING/QUEUED based
on whether a claim is still active
- components/sprint/sprint-run-controls.tsx: PAUSED banner with reason label,
PR link, conflict-files list (max 5 + "+N more"), Resume button with
confirm() guard
- app/(app)/products/[id]/sprint/page.tsx: load pause_context from active
SprintRun and pass through to SprintRunControls
All MD3 tokens (warning-container, on-warning-container, primary). No raw
Tailwind utility colours.
Tests: 532 passing across 72 files (Scrum4Me side).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
77617e89ac
commit
d3e79021c1
6 changed files with 173 additions and 2 deletions
30
lib/pause-context.ts
Normal file
30
lib/pause-context.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { z } from 'zod'
|
||||
|
||||
export const PauseReasonSchema = z.enum(['MERGE_CONFLICT'])
|
||||
export type PauseReason = z.infer<typeof PauseReasonSchema>
|
||||
|
||||
export const PauseContextSchema = z.object({
|
||||
pause_reason: PauseReasonSchema,
|
||||
pr_url: z.string().url(),
|
||||
pr_head_sha: z.string().min(7),
|
||||
conflict_files: z.array(z.string()).default([]),
|
||||
claude_question_id: z.string().min(1),
|
||||
resume_instructions: z.string().min(1),
|
||||
paused_at: z.string().datetime(),
|
||||
})
|
||||
|
||||
export type PauseContext = z.infer<typeof PauseContextSchema>
|
||||
|
||||
export function parsePauseContext(raw: unknown): PauseContext | null {
|
||||
if (raw === null || raw === undefined) return null
|
||||
const parsed = PauseContextSchema.safeParse(raw)
|
||||
return parsed.success ? parsed.data : null
|
||||
}
|
||||
|
||||
const PAUSE_REASON_LABELS: Record<PauseReason, string> = {
|
||||
MERGE_CONFLICT: 'Merge-conflict op PR',
|
||||
}
|
||||
|
||||
export function pauseReasonLabel(reason: PauseReason): string {
|
||||
return PAUSE_REASON_LABELS[reason] ?? reason
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue