fix(web-probe): show analyze blocker details (#747)

Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
Lyon
2026-06-23 18:50:20 +08:00
committed by GitHub
parent 5a64905054
commit b3a7714d3d
+36 -2
View File
@@ -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<string, unknown>): Record<
function renderWebObserveAnalyzeResult(result: Record<string, unknown>): Record<string, unknown> {
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<string, unknown>): 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"],