Files
whyrating-engine-legacy/web/app/api/jobs/[jobId]/crash-report/route.ts
Alejandro Gutiérrez cd9639f3b1 Wave 7: Integrate JobDevTools into job detail page (FINAL)
- Task #18: Complete integration of all JobDevTools components
  - Updated job detail page (/jobs/[id]) with full JobDevTools UI
  - Connected SSE stream for real-time structured logs + metrics
  - Added crash-report and retry API routes for Next.js
  - Added format conversion for old/new log formats
  - Added DevTools links to JobsView modal and actions column
  - Wired up CrashReport retry with auto-fix parameters
  - Integrated SessionPanel for fingerprint display
  - Integrated MetricsDashboard for real-time charts

Job DevTools implementation complete: 18/18 tasks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 13:11:19 +00:00

43 lines
1.1 KiB
TypeScript

import { NextRequest, NextResponse } from 'next/server';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
/**
* GET /api/jobs/[jobId]/crash-report
*
* Fetches the crash report for a failed or partial job.
* Returns detailed crash analysis including pattern identification,
* confidence score, suggested fixes, and auto-fix parameters.
*/
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ jobId: string }> }
) {
try {
const { jobId } = await params;
const response = await fetch(`${API_BASE_URL}/jobs/${jobId}/crash-report`, {
headers: {
'Accept': 'application/json',
},
});
const data = await response.json();
if (!response.ok) {
return NextResponse.json(
{ error: data.detail || 'Failed to get crash report' },
{ status: response.status }
);
}
return NextResponse.json(data);
} catch (error) {
console.error('Crash report API error:', error);
return NextResponse.json(
{ error: 'Failed to get crash report' },
{ status: 500 }
);
}
}