feat: add verify_result+pushed_at to JobState, VerifyResultApi type, SSE payload
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ea67344829
commit
daa1c77498
2 changed files with 13 additions and 4 deletions
|
|
@ -46,6 +46,7 @@ type JobPayload = {
|
|||
status: string
|
||||
branch?: string
|
||||
pushed_at?: string
|
||||
verify_result?: string
|
||||
summary?: string
|
||||
error?: string
|
||||
}
|
||||
|
|
@ -259,7 +260,7 @@ async function prisma_jobs_findActive(userId: string, productId: string) {
|
|||
],
|
||||
},
|
||||
select: {
|
||||
id: true, task_id: true, status: true, branch: true, pushed_at: true, summary: true, error: true,
|
||||
id: true, task_id: true, status: true, branch: true, pushed_at: true, verify_result: true, summary: true, error: true,
|
||||
},
|
||||
orderBy: { created_at: 'asc' },
|
||||
})
|
||||
|
|
@ -269,6 +270,7 @@ async function prisma_jobs_findActive(userId: string, productId: string) {
|
|||
status: jobStatusToApi(j.status),
|
||||
branch: j.branch ?? undefined,
|
||||
pushed_at: j.pushed_at?.toISOString() ?? undefined,
|
||||
verify_result: j.verify_result?.toLowerCase() as import('@/stores/solo-store').VerifyResultApi | undefined,
|
||||
summary: j.summary ?? undefined,
|
||||
error: j.error ?? undefined,
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -4,19 +4,22 @@ import type { ClaudeJobStatusApi } from '@/lib/job-status'
|
|||
|
||||
type TaskStatus = SoloTask['status']
|
||||
|
||||
export type VerifyResultApi = 'aligned' | 'partial' | 'empty' | 'divergent'
|
||||
|
||||
export interface JobState {
|
||||
job_id: string
|
||||
task_id: string
|
||||
status: ClaudeJobStatusApi
|
||||
branch?: string
|
||||
pushed_at?: string | null
|
||||
verify_result?: VerifyResultApi | null
|
||||
summary?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
export type ClaudeJobEvent =
|
||||
| { type: 'claude_job_enqueued'; job_id: string; task_id: string; user_id: string; product_id: string; status: 'queued' }
|
||||
| { type: 'claude_job_status'; job_id: string; task_id: string; user_id: string; product_id: string; status: ClaudeJobStatusApi; branch?: string; pushed_at?: string; summary?: string; error?: string }
|
||||
| { type: 'claude_job_status'; job_id: string; task_id: string; user_id: string; product_id: string; status: ClaudeJobStatusApi; branch?: string; pushed_at?: string; verify_result?: VerifyResultApi; summary?: string; error?: string }
|
||||
|
||||
// Payload-shape gepubliceerd door de Postgres-trigger via pg_notify (ST-801
|
||||
// + ST-804 prereq). Komt het Solo Paneel binnen via de SSE-stream uit
|
||||
|
|
@ -64,6 +67,7 @@ interface SoloStore {
|
|||
optimisticMove: (taskId: string, toStatus: TaskStatus) => TaskStatus | null
|
||||
rollback: (taskId: string, prevStatus: TaskStatus) => void
|
||||
updatePlan: (taskId: string, plan: string | null) => void
|
||||
updateVerifyOnly: (taskId: string, value: boolean) => void
|
||||
|
||||
markPending: (taskId: string) => void
|
||||
clearPending: (taskId: string) => void
|
||||
|
|
@ -104,6 +108,9 @@ export const useSoloStore = create<SoloStore>((set, get) => ({
|
|||
updatePlan: (taskId, plan) =>
|
||||
set((s) => ({ tasks: { ...s.tasks, [taskId]: { ...s.tasks[taskId], implementation_plan: plan } } })),
|
||||
|
||||
updateVerifyOnly: (taskId, value) =>
|
||||
set((s) => ({ tasks: { ...s.tasks, [taskId]: { ...s.tasks[taskId], verify_only: value } } })),
|
||||
|
||||
markPending: (taskId) =>
|
||||
set((s) => {
|
||||
if (s.pendingOps.has(taskId)) return s
|
||||
|
|
@ -147,7 +154,7 @@ export const useSoloStore = create<SoloStore>((set, get) => ({
|
|||
return
|
||||
}
|
||||
if (event.type === 'claude_job_status') {
|
||||
const { status, branch, pushed_at, summary, error } = event
|
||||
const { status, branch, pushed_at, verify_result, summary, error } = event
|
||||
if (status === 'cancelled') {
|
||||
set((s) => {
|
||||
const next = { ...s.claudeJobsByTaskId }
|
||||
|
|
@ -159,7 +166,7 @@ export const useSoloStore = create<SoloStore>((set, get) => ({
|
|||
set((s) => ({
|
||||
claudeJobsByTaskId: {
|
||||
...s.claudeJobsByTaskId,
|
||||
[task_id]: { job_id, task_id, status, branch, pushed_at, summary, error },
|
||||
[task_id]: { job_id, task_id, status, branch, pushed_at, verify_result, summary, error },
|
||||
},
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue