From b3a7714d3dedb6600321910b69f56096eac596cf Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Tue, 23 Jun 2026 18:50:20 +0800 Subject: [PATCH] fix(web-probe): show analyze blocker details (#747) Co-authored-by: Codex --- scripts/src/hwlab-node-impl.ts | 38 ++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/scripts/src/hwlab-node-impl.ts b/scripts/src/hwlab-node-impl.ts index 3752a272..1059e17e 100644 --- a/scripts/src/hwlab-node-impl.ts +++ b/scripts/src/hwlab-node-impl.ts @@ -8776,15 +8776,32 @@ function runNodeWebProbeObserveAnalyze(options: NodeWebProbeObserveOptions, spec ].join("\n"); const result = runTransWorkspaceStdinScript(options.node, spec.workspace, script, options.commandTimeoutSeconds); const analysis = parseJsonObject(result.stdout); + const analysisOk = result.exitCode === 0 && analysis?.ok === true; + const analysisFailure = analysisOk + ? null + : { + reason: analysis === null ? "analyzer-output-not-json" : "analyzer-reported-not-ok", + exitCode: result.exitCode, + timedOut: result.timedOut, + parsedJson: analysis !== null, + stdoutBytes: result.stdout.length, + stderrBytes: result.stderr.length, + stdoutTail: result.stdout.trim().slice(-1200), + stderrTail: result.stderr.trim().slice(-1200), + workspace: spec.workspace, + observerId: webObserveIdFromOptions(options), + valuesRedacted: true, + }; return withWebObserveAnalyzeRendered({ - ok: result.exitCode === 0 && analysis?.ok === true, - status: result.exitCode === 0 && analysis?.ok === true ? "analyzed" : "blocked", + ok: analysisOk, + status: analysisOk ? "analyzed" : "blocked", command: webObserveCommandLabel("analyze", options), id: webObserveIdFromOptions(options), node: options.node, lane: options.lane, workspace: spec.workspace, analysis, + failure: analysisFailure, alertThresholds, result: analysis === null ? compactCommandResultWithStdoutTail(result) : compactCommandResult(result), valuesRedacted: true, @@ -9693,6 +9710,7 @@ function renderWebObserveCommandResult(result: Record): Record< function renderWebObserveAnalyzeResult(result: Record): Record { const analysis = record(result.analysis); + const failure = record(result.failure); const counts = record(analysis.counts); const sampleMetrics = record(analysis.sampleMetrics); const runtimeAlerts = record(analysis.runtimeAlerts); @@ -9706,11 +9724,27 @@ function renderWebObserveAnalyzeResult(result: Record): Record< const sseStreams = webObserveArray(analysis.pagePerformanceSseStreams).slice(0, 8).map((item) => record(item)); const findings = webObserveArray(analysis.findings).slice(0, 8).map((item) => record(item)); const id = result.id ?? "-"; + const blockerRows = String(result.status ?? "") === "blocked" + ? [ + ["reason", failure.reason], + ["exitCode", failure.exitCode], + ["timedOut", failure.timedOut], + ["parsedJson", failure.parsedJson], + ["stdoutBytes", failure.stdoutBytes], + ["stderrBytes", failure.stderrBytes], + ["stdoutTail", String(failure.stdoutTail ?? "").replace(/\s+/g, " ").slice(0, 220)], + ["stderrTail", String(failure.stderrTail ?? "").replace(/\s+/g, " ").slice(0, 220)], + ["workspace", failure.workspace], + ] + : []; const renderedText = [ webObserveTable( ["OBSERVER", "NODE", "LANE", "STATUS", "REPORT_JSON", "REPORT_MD"], [[id, result.node, result.lane, result.status, analysis.reportJsonSha256, analysis.reportMdSha256]], ), + ...(blockerRows.length > 0 + ? ["", webObserveTable(["ANALYZE_BLOCKER", "VALUE"], blockerRows)] + : []), "", webObserveTable( ["SAMPLES", "CONTROL", "NETWORK", "CONSOLE", "ARTIFACTS", "ROUNDS", "ROWS"],