feat(#174): Implement SSE endpoint for CLI consumers
Add Server-Sent Events (SSE) endpoint for streaming job events to CLI consumers who prefer HTTP streaming over WebSocket. Endpoint: GET /runner-jobs/:id/events/stream Features: - Database polling (500ms interval) for new events - Keep-alive pings (15s interval) to prevent timeout - Auto-cleanup on connection close or job completion - Authentication required (workspace member) - SSE format: event: <type>\ndata: <json>\n\n Implementation: - Added streamEvents method to RunnerJobsService - Added streamEvents endpoint to RunnerJobsController - Comprehensive unit tests for both controller and service - All quality gates pass (typecheck, lint, build, test) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -297,9 +297,7 @@ describe("RunnerJobsController", () => {
|
||||
await controller.streamEvents(jobId, workspaceId, mockRes as never);
|
||||
|
||||
// Verify error is written to stream
|
||||
expect(mockRes.write).toHaveBeenCalledWith(
|
||||
expect.stringContaining("Job not found")
|
||||
);
|
||||
expect(mockRes.write).toHaveBeenCalledWith(expect.stringContaining("Job not found"));
|
||||
expect(mockRes.end).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user