Merge branch 'fix/298-async-dashboard' into develop
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
|||||||
FederationConnectionStatus,
|
FederationConnectionStatus,
|
||||||
type ConnectionDetails,
|
type ConnectionDetails,
|
||||||
} from "@/lib/api/federation";
|
} from "@/lib/api/federation";
|
||||||
import { sendFederatedQuery } from "@/lib/api/federation-queries";
|
import { sendFederatedQuery, pollForQueryResponse } from "@/lib/api/federation-queries";
|
||||||
import type { Task, Event } from "@mosaic/shared";
|
import type { Task, Event } from "@mosaic/shared";
|
||||||
|
|
||||||
export default function AggregatedDashboardPage(): React.JSX.Element {
|
export default function AggregatedDashboardPage(): React.JSX.Element {
|
||||||
@@ -50,18 +50,19 @@ export default function AggregatedDashboardPage(): React.JSX.Element {
|
|||||||
try {
|
try {
|
||||||
// Query tasks
|
// Query tasks
|
||||||
if (connection.remoteCapabilities.supportsQuery) {
|
if (connection.remoteCapabilities.supportsQuery) {
|
||||||
const taskResponse = await sendFederatedQuery(connection.id, "tasks.list", {
|
const taskQueryMessage = await sendFederatedQuery(connection.id, "get tasks", {
|
||||||
limit: 10,
|
limit: 10,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait a bit for the query to be processed and response received
|
// Poll for the response instead of using setTimeout
|
||||||
// In production, this would use WebSocket or polling
|
const taskResponse = await pollForQueryResponse(taskQueryMessage.id, {
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
pollInterval: 500,
|
||||||
|
timeout: 30000,
|
||||||
|
});
|
||||||
|
|
||||||
// For MVP, we'll use mock data since query processing is async
|
|
||||||
// In production, we'd poll for the response or use WebSocket
|
|
||||||
if (taskResponse.response) {
|
if (taskResponse.response) {
|
||||||
const responseTasks = (taskResponse.response as { data?: Task[] }).data ?? [];
|
const responseData = taskResponse.response as { type?: string; data?: Task[] };
|
||||||
|
const responseTasks = responseData.data ?? [];
|
||||||
const federatedTasks = responseTasks.map((task) => ({
|
const federatedTasks = responseTasks.map((task) => ({
|
||||||
task,
|
task,
|
||||||
provenance: {
|
provenance: {
|
||||||
@@ -76,14 +77,19 @@ export default function AggregatedDashboardPage(): React.JSX.Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Query events
|
// Query events
|
||||||
const eventResponse = await sendFederatedQuery(connection.id, "events.list", {
|
const eventQueryMessage = await sendFederatedQuery(connection.id, "get events", {
|
||||||
limit: 10,
|
limit: 10,
|
||||||
});
|
});
|
||||||
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
// Poll for the response
|
||||||
|
const eventResponse = await pollForQueryResponse(eventQueryMessage.id, {
|
||||||
|
pollInterval: 500,
|
||||||
|
timeout: 30000,
|
||||||
|
});
|
||||||
|
|
||||||
if (eventResponse.response) {
|
if (eventResponse.response) {
|
||||||
const responseEvents = (eventResponse.response as { data?: Event[] }).data ?? [];
|
const responseData = eventResponse.response as { type?: string; data?: Event[] };
|
||||||
|
const responseEvents = responseData.data ?? [];
|
||||||
const federatedEvents = responseEvents.map((event) => ({
|
const federatedEvents = responseEvents.map((event) => ({
|
||||||
event,
|
event,
|
||||||
provenance: {
|
provenance: {
|
||||||
|
|||||||
@@ -88,3 +88,45 @@ export async function fetchQueryMessages(
|
|||||||
export async function fetchQueryMessage(messageId: string): Promise<QueryMessageDetails> {
|
export async function fetchQueryMessage(messageId: string): Promise<QueryMessageDetails> {
|
||||||
return apiGet<QueryMessageDetails>(`/api/v1/federation/queries/${messageId}`);
|
return apiGet<QueryMessageDetails>(`/api/v1/federation/queries/${messageId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Poll for query response with timeout
|
||||||
|
* @param messageId - The message ID to poll for
|
||||||
|
* @param options - Polling options
|
||||||
|
* @returns The query message details when delivered or failed
|
||||||
|
* @throws Error if timeout is reached or message fails
|
||||||
|
*/
|
||||||
|
export async function pollForQueryResponse(
|
||||||
|
messageId: string,
|
||||||
|
options?: {
|
||||||
|
pollInterval?: number; // milliseconds between polls (default: 500)
|
||||||
|
timeout?: number; // maximum time to wait in milliseconds (default: 30000)
|
||||||
|
}
|
||||||
|
): Promise<QueryMessageDetails> {
|
||||||
|
const pollInterval = options?.pollInterval ?? 500;
|
||||||
|
const timeout = options?.timeout ?? 30000;
|
||||||
|
const startTime = Date.now();
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
|
while (true) {
|
||||||
|
// Check if timeout has been reached
|
||||||
|
if (Date.now() - startTime > timeout) {
|
||||||
|
throw new Error(`Query timeout after ${String(timeout)}ms`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch the message
|
||||||
|
const message = await fetchQueryMessage(messageId);
|
||||||
|
|
||||||
|
// Check if the message is complete
|
||||||
|
if (message.status === FederationMessageStatus.DELIVERED) {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message.status === FederationMessageStatus.FAILED) {
|
||||||
|
throw new Error(message.error ?? "Query failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait before polling again
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/federation/federation.module.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:47:41
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-federation-federation.module.ts_20260203-2247_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/federation/federation.module.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 2
|
||||||
|
**Generated:** 2026-02-03 22:47:54
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-federation-federation.module.ts_20260203-2247_2_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/federation/query.service.spec.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:46:22
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-federation-query.service.spec.ts_20260203-2246_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/federation/query.service.spec.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:47:14
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-federation-query.service.spec.ts_20260203-2247_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/federation/query.service.spec.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 2
|
||||||
|
**Generated:** 2026-02-03 22:47:24
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-federation-query.service.spec.ts_20260203-2247_2_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/federation/query.service.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:46:38
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-federation-query.service.ts_20260203-2246_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/federation/query.service.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 2
|
||||||
|
**Generated:** 2026-02-03 22:46:45
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-federation-query.service.ts_20260203-2246_2_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/federation/query.service.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:47:00
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-federation-query.service.ts_20260203-2247_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/federation/query.service.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:48:17
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-federation-query.service.ts_20260203-2248_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/lib/db-context.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:42:16
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-lib-db-context.ts_20260203-2242_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/lib/db-context.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 2
|
||||||
|
**Generated:** 2026-02-03 22:42:24
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-lib-db-context.ts_20260203-2242_2_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/lib/db-context.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 3
|
||||||
|
**Generated:** 2026-02-03 22:42:38
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-lib-db-context.ts_20260203-2242_3_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/lib/db-context.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 4
|
||||||
|
**Generated:** 2026-02-03 22:42:44
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-lib-db-context.ts_20260203-2242_4_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/prisma/prisma.service.spec.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:41:42
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-prisma-prisma.service.spec.ts_20260203-2241_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/api/src/prisma/prisma.service.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:42:02
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-api-src-prisma-prisma.service.ts_20260203-2242_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/web/src/app/(authenticated)/federation/dashboard/page.tsx
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:50:08
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-web-src-app-(authenticated)-federation-dashboard-page.tsx_20260203-2250_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/web/src/app/(authenticated)/federation/dashboard/page.tsx
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 2
|
||||||
|
**Generated:** 2026-02-03 22:50:22
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-web-src-app-(authenticated)-federation-dashboard-page.tsx_20260203-2250_2_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/web/src/lib/api/federation-queries.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:50:04
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-web-src-lib-api-federation-queries.ts_20260203-2250_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/jwoltje/src/mosaic-stack/apps/web/src/lib/api/federation-queries.ts
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-02-03 22:51:17
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/jwoltje/src/mosaic-stack/docs/reports/qa-automation/pending/home-jwoltje-src-mosaic-stack-apps-web-src-lib-api-federation-queries.ts_20260203-2251_1_remediation_needed.md"
|
||||||
|
```
|
||||||
85
docs/scratchpads/298-async-dashboard.md
Normal file
85
docs/scratchpads/298-async-dashboard.md
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# Issue #298: Fix async response handling in dashboard
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
|
||||||
|
Replace setTimeout hacks with proper async response handling for federated queries in the dashboard.
|
||||||
|
|
||||||
|
## Current State
|
||||||
|
|
||||||
|
- Dashboard uses `setTimeout(resolve, 1000)` to wait for query responses (lines 59, 83)
|
||||||
|
- Race conditions possible
|
||||||
|
- Unreliable data loading
|
||||||
|
- Poor UX with arbitrary delays
|
||||||
|
|
||||||
|
## Approach
|
||||||
|
|
||||||
|
Implement polling mechanism to check query message status:
|
||||||
|
|
||||||
|
1. Send query and get message ID
|
||||||
|
2. Poll for message status until DELIVERED or FAILED
|
||||||
|
3. Extract response data when available
|
||||||
|
4. Handle timeouts gracefully
|
||||||
|
|
||||||
|
## Implementation Plan
|
||||||
|
|
||||||
|
- [x] Create scratchpad
|
||||||
|
- [x] Add polling utility function
|
||||||
|
- [x] Update dashboard to use polling instead of setTimeout
|
||||||
|
- [x] Add proper loading states (via polling)
|
||||||
|
- [x] Add error handling (polling throws on failure)
|
||||||
|
- [x] Add timeout handling (30s timeout)
|
||||||
|
- [ ] Test with actual federation connection (requires live system)
|
||||||
|
|
||||||
|
## Changes Made
|
||||||
|
|
||||||
|
### apps/web/src/lib/api/federation-queries.ts
|
||||||
|
|
||||||
|
Added `pollForQueryResponse()` function:
|
||||||
|
|
||||||
|
- Polls every 500ms for message status
|
||||||
|
- Timeout after 30 seconds
|
||||||
|
- Returns message when DELIVERED
|
||||||
|
- Throws error when FAILED or timeout reached
|
||||||
|
- Configurable poll interval and timeout
|
||||||
|
|
||||||
|
### apps/web/src/app/(authenticated)/federation/dashboard/page.tsx
|
||||||
|
|
||||||
|
Replaced setTimeout hacks with polling:
|
||||||
|
|
||||||
|
- Line 57-59: Removed setTimeout, added pollForQueryResponse
|
||||||
|
- Line 83: Removed setTimeout, added pollForQueryResponse
|
||||||
|
- Updated query strings to match new format ("get tasks", "get events")
|
||||||
|
- Improved response data parsing to handle new response format
|
||||||
|
- Error handling via try/catch (polling throws on failure)
|
||||||
|
|
||||||
|
## Testing Notes
|
||||||
|
|
||||||
|
- Polling function handles PENDING → DELIVERED transition
|
||||||
|
- Polling function handles PENDING → FAILED transition
|
||||||
|
- Timeout prevents infinite waiting
|
||||||
|
- Errors are properly propagated to dashboard error handling
|
||||||
|
|
||||||
|
## Changes to Make
|
||||||
|
|
||||||
|
### apps/web/src/lib/api/federation-queries.ts
|
||||||
|
|
||||||
|
Add polling function:
|
||||||
|
|
||||||
|
- `pollForQueryResponse(messageId: string): Promise<QueryResponse>`
|
||||||
|
- Poll every 500ms, timeout after 30 seconds
|
||||||
|
- Check message status until DELIVERED or FAILED
|
||||||
|
|
||||||
|
### apps/web/src/app/(authenticated)/federation/dashboard/page.tsx
|
||||||
|
|
||||||
|
- Remove setTimeout hacks
|
||||||
|
- Use polling function to wait for responses
|
||||||
|
- Add proper loading states per connection
|
||||||
|
- Add better error messages
|
||||||
|
- Add timeout handling
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- Message status: PENDING → DELIVERED or FAILED
|
||||||
|
- Poll interval: 500ms
|
||||||
|
- Timeout: 30 seconds
|
||||||
|
- Need to handle both successful and failed queries
|
||||||
Reference in New Issue
Block a user