fix: expose workbench timing source status

This commit is contained in:
Codex
2026-06-28 11:24:36 +00:00
parent f4d97774cf
commit c80e85f4b4
6 changed files with 172 additions and 31 deletions
+13 -4
View File
@@ -697,13 +697,14 @@ export function renderWebObserveAnalyzeTable(value: Record<string, unknown>): st
webObserveTable(consoleAlertGroups.length > 0 ? ["COUNT", "TYPE", "STATUS", "PATH", "LAST", "TRACES"] : ["TS", "TYPE", "STATUS", "PATH", "TRACE", "TEXT"], consoleAlertRows.length > 0 ? consoleAlertRows : [["-", "-", "-", "-", "-", "-"]]),
"",
"Findings:",
webObserveTable(["KIND", "SEVERITY", "COUNT", "ROOT_CAUSE", "SUMMARY"], findings.length > 0 ? findings.map((item) => [
webObserveTable(["KIND", "SEVERITY", "COUNT", "TIMING", "ROOT_CAUSE", "SUMMARY"], findings.length > 0 ? findings.map((item) => [
webObserveShort(webObserveText(item.kind ?? item.id ?? item.code), 32),
webObserveText(item.severity ?? item.level),
webObserveText(item.count ?? item.sampleCount),
webObserveShort(webObserveFindingTiming(item), 42),
webObserveShort(webObserveText(item.rootCause ?? item.rootCauseStatus), 48),
webObserveShort(webObserveText(item.summary ?? item.message), 96),
]) : [["-", "-", "-", "-", "-"]]),
]) : [["-", "-", "-", "-", "-", "-"]]),
"",
"Archive red findings:",
webObserveTable(["KIND", "COUNT", "SUMMARY"], archiveRedFindings.length > 0 ? archiveRedFindings.map((item) => [
@@ -987,6 +988,14 @@ export function webObserveCell(value: unknown, maxLength = 96): string {
return `${compact.slice(0, Math.max(1, maxLength - 1))}...`;
}
function webObserveFindingTiming(item: Record<string, unknown>): string {
const status = item.timingStatus ?? null;
const source = item.timingSourceOfTruth ?? item.expectedElapsedSource ?? item.evidenceKind ?? null;
const parts = [status, source].filter((value) => value !== null && value !== undefined && value !== "");
if (parts.length === 0) return "-";
return parts.map((value) => webObserveText(value)).join("/");
}
export function webObserveTable(headers: string[], rows: unknown[][]): string {
const stringRows = rows.map((row) => row.map((value) => webObserveCell(value)));
const widths = headers.map((header, index) => Math.max(header.length, ...stringRows.map((row) => row[index]?.length ?? 0)));
@@ -1388,8 +1397,8 @@ export function renderWebObserveAnalyzeResult(result: Record<string, unknown>):
findings.length === 0
? "FINDINGS\n-"
: webObserveTable(
["FINDING", "SEVERITY", "COUNT", "SUMMARY"],
findings.map((item) => [item.id ?? item.kind ?? item.code, item.severity ?? item.level, item.count ?? item.sampleCount, item.summary ?? item.message]),
["FINDING", "SEVERITY", "COUNT", "TIMING", "SUMMARY"],
findings.map((item) => [item.id ?? item.kind ?? item.code, item.severity ?? item.level, item.count ?? item.sampleCount, webObserveFindingTiming(item), item.summary ?? item.message]),
),
"",
"REPORTS",