diff --git a/scripts/src/hwlab-node.ts b/scripts/src/hwlab-node.ts index a07ae40a..1241f733 100644 --- a/scripts/src/hwlab-node.ts +++ b/scripts/src/hwlab-node.ts @@ -9285,7 +9285,7 @@ function compactWebProbeResult(report: Record | null): Record | null): Record[] { + if (!Array.isArray(value)) return []; + return value.map(record).map((sample) => { + const traceFetch = record(sample.traceFetch); + const attempts = Array.isArray(traceFetch.attempts) ? traceFetch.attempts : []; + return { + index: sample.index ?? null, + sampledAt: sample.sampledAt ?? null, + messageCount: sample.messageCount ?? null, + agentStatus: sample.agentStatus ?? null, + tracePresent: sample.tracePresent === true, + traceStatus: sample.traceStatus ?? null, + rowCount: sample.rowCount ?? null, + emptyLabel: sample.emptyLabel ?? null, + latestRowPreview: sample.latestRowPreview ?? null, + conversationId: sample.conversationId ?? null, + sessionId: sample.sessionId ?? null, + traceId: sample.traceId ?? null, + traceFetch: { + ok: traceFetch.ok === true, + httpStatus: traceFetch.httpStatus ?? null, + eventCount: traceFetch.eventCount ?? null, + degradedReason: traceFetch.degradedReason ?? null, + attempts: attempts.length, + latestEventPreview: traceFetch.latestEventPreview ?? null, + }, + }; + }); +} + function compactWebProbeActions(value: unknown): Record[] { if (!Array.isArray(value)) return []; return value.map(record).map((action) => {