component assesment and fixes done

This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-11-30 16:09:31 +02:00
parent a172b21aac
commit ce9760fcbe
22 changed files with 681 additions and 1844 deletions
@@ -30,7 +30,6 @@ class ISSEEventStreamer(ABC):
@abstractmethod
def send_heartbeat(self, flight_id: str) -> bool:
"""Sends heartbeat/keepalive to all clients subscribed to flight."""
pass
@abstractmethod
@@ -39,19 +38,22 @@ class ISSEEventStreamer(ABC):
@abstractmethod
def get_active_connections(self, flight_id: str) -> int:
"""Returns count of active SSE connections for a flight."""
pass
```
## Component Description
### Responsibilities
- Server-Sent Events broadcaster for real-time results
- Stream per-frame processing results to clients
- Send refinement updates asynchronously
- Request user input when processing blocked
- Handle client connections and reconnections
- Event replay from last received event
- Real-time communication with clients.
- Buffering events for disconnected clients.
### Callers
- **F02.1 Flight Lifecycle Manager**: Calls `create_stream` (delegated from F01).
- **F02.2 Flight Processing Engine**: Calls `send_user_input_request`, `send_search_progress`.
- **F14 Result Manager**: Calls `send_frame_result`, `send_refinement`.
### Consistency Fix
- Previously listed F11 as caller. **Correction**: F11 returns request objects to F02.2. **F02.2 is the sole caller** for user input requests and search status updates. F11 has no dependencies on F15.
### Scope
- SSE protocol implementation
@@ -64,7 +66,7 @@ class ISSEEventStreamer(ABC):
### `create_stream(flight_id: str, client_id: str) -> StreamConnection`
**Description**: Creates SSE connection for a client.
**Description**: Establishes a server-sent events connection.
**Called By**: F01 REST API (GET /stream endpoint)
@@ -124,7 +126,7 @@ StreamConnection:
**Description**: Sends search_expanded event.
**Called By**: F11 Failure Recovery Coordinator
**Called By**: F02.2 Flight Processing Engine (via F11 status return)
**Event Format**:
```json
@@ -144,7 +146,7 @@ StreamConnection:
**Description**: Sends user_input_needed event.
**Called By**: F11 Failure Recovery Coordinator
**Called By**: F02.2 Flight Processing Engine (via F11 request object)
**Event Format**:
```json
@@ -182,11 +184,11 @@ StreamConnection:
### `send_heartbeat(flight_id: str) -> bool`
**Description**: Sends heartbeat/keepalive ping to all clients subscribed to a flight. Keeps connections alive and helps detect stale connections.
**Description**: Sends heartbeat/keepalive to all clients subscribed to flight.
**Called By**:
- Background heartbeat task (every 30 seconds)
- F02 Flight Processor (periodically during processing)
- F02.2 Flight Processing Engine (periodically during processing)
**Event Format**:
```
@@ -217,7 +219,7 @@ StreamConnection:
**Description**: Returns count of active SSE connections for a flight.
**Called By**:
- F02 Flight Processor (monitoring)
- F02.2 Flight Processing Engine (monitoring)
- Admin tools
**Test Cases**:
@@ -287,4 +289,3 @@ class SSEEvent(BaseModel):
id: Optional[str]
data: Dict[str, Any]
```