# UI Improvement: Parallel Data Provider Status & Error Reporting

## 1. Problem Statement
Currently, the Fundamental Analysis page shows a generic "Fetching Data..." loading state. The detailed status and errors from individual data providers (Tushare, YFinance, AlphaVantage) are aggregated into a single status in the API Gateway. 

This causes two issues:
1. **Ambiguity**: Users cannot see which provider is working, finished, or failed.
2. **Hidden Errors**: If one provider fails (e.g., database error) but the overall task is still "in progress" (or generic failed), the specific error details are lost or not displayed prominently.

## 2. Goal
Update the API and UI to reflect the parallel nature of data fetching. The UI should display a "control panel" style view where each Data Provider has its own status card, showing:
- Provider Name (e.g., "Tushare")
- Current Status (Queued, In Progress, Completed, Failed)
- Progress Details (e.g., "Fetching data...", "Persisting...", "Error: 500 Internal Server Error")

## 3. Proposed Changes

### 3.1 Backend (API Gateway)
**Endpoint**: `GET /v1/tasks/{request_id}`

**Current Behavior**: Returns a single `TaskProgress` object (the first one found).

**New Behavior**: Returns a list of all tasks associated with the `request_id`.

**Response Schema Change**:
```json
// BEFORE
{
  "request_id": "uuid",
  "task_name": "tushare:600519.SS",
  "status": "in_progress",
  ...
}

// AFTER
[
  {
    "request_id": "uuid",
    "task_name": "tushare:600519.SS",
    "status": "failed",
    "details": "Error: 500 ...",
    ...
  },
  {
    "request_id": "uuid",
    "task_name": "yfinance:600519.SS",
    "status": "completed",
    ...
  }
]
```

### 3.2 Frontend

#### Types
Update `TaskProgress` handling to support array responses.

#### Logic (`useReportEngine` & `useTaskProgress`)
- **Aggregation Logic**: 
  - The overall "Phase Status" (Fetching vs Complete) depends on *all* provider tasks.
  - **Fetching**: If *any* task is `queued` or `in_progress`.
  - **Complete**: When *all* tasks are `completed` or `failed`.
- **Error Handling**: Do not fail the whole report if one provider fails. Allow partial success.

#### UI (`RawDataViewer` & `FinancialTable`)
Replace the single loader with a grid layout:

```tsx
// Conceptual Layout
<div className="grid grid-cols-3 gap-4">
  <ProviderStatusCard name="Tushare" task={tushareTask} />
  <ProviderStatusCard name="YFinance" task={yfinanceTask} />
  <ProviderStatusCard name="AlphaVantage" task={avTask} />
</div>
```

**Card States**:
- **Waiting**: Gray / Spinner
- **Success**: Green Checkmark + "Data retrieved"
- **Error**: Red X + Error Message (expanded or tooltip)

## 4. Implementation Steps
1. **Backend**: Modify `services/api-gateway/src/api.rs` to return `Vec<TaskProgress>`.
2. **Frontend**: 
   - Update `TaskProgress` type definition.
   - Update `useTaskProgress` fetcher.
   - Update `useReportEngine` polling logic to handle array.
   - Create `ProviderStatusCard` component.
   - Update `RawDataViewer` to render the grid.

