From c93375a1ea9f0c3c7d29624be97ea7c4b291570d Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Sun, 21 Jun 2026 16:44:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20web-probe=20=E9=99=8D=E5=99=AA=20DOM=20?= =?UTF-8?q?=E8=AF=8A=E6=96=AD=E5=88=86=E7=BB=84=20(#585)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Codex --- scripts/src/hwlab-node-web-observe-runner-source.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/src/hwlab-node-web-observe-runner-source.ts b/scripts/src/hwlab-node-web-observe-runner-source.ts index 8e8a151f..fea29981 100644 --- a/scripts/src/hwlab-node-web-observe-runner-source.ts +++ b/scripts/src/hwlab-node-web-observe-runner-source.ts @@ -1633,14 +1633,15 @@ function groupDomDiagnostics(events) { const groups = new Map(); for (const item of events || []) { const preview = String(item?.preview || "").trim(); + if (!isReportableDomDiagnostic(item, preview)) continue; const normalizedPreview = normalizeDiagnosticPreview(preview); const key = [ - item?.source || "", item?.diagnosticCode || "", normalizedPreview ].join("|"); const existing = groups.get(key) || { source: item?.source || null, + sources: new Set(), diagnosticCode: item?.diagnosticCode || null, textHash: item?.textHash || null, normalizedPreview, @@ -1652,6 +1653,7 @@ function groupDomDiagnostics(events) { traceIds: new Set(), sampleSeqs: [] }; + if (item?.source) existing.sources.add(String(item.source)); existing.count += 1; existing.firstAt = minIso(existing.firstAt, item?.ts || null); existing.lastAt = maxIso(existing.lastAt, item?.ts || null); @@ -1663,6 +1665,7 @@ function groupDomDiagnostics(events) { return Array.from(groups.values()) .map((item) => ({ source: item.source, + sources: Array.from(item.sources).sort(), diagnosticCode: item.diagnosticCode, textHash: item.textHash, normalizedPreview: item.normalizedPreview, @@ -1677,6 +1680,11 @@ function groupDomDiagnostics(events) { .sort((a, b) => (b.count - a.count) || String(a.firstAt || "").localeCompare(String(b.firstAt || ""))); } +function isReportableDomDiagnostic(item, preview) { + if (item?.source === "diagnostic-node" || item?.source === "execution-row") return true; + return /trace_id=|HTTP\s+\d{3}\b|Failed to load resource|ERR_[A-Z_]+|provider-unavailable|AgentRun error|超过\s*\d+\s*ms\s*无新活动|代理暂时无法连接上游|Trace 更新超时|加载失败/iu.test(String(preview || "")); +} + function normalizeDiagnosticPreview(text) { return String(text || "") .replace(/trace_id=[A-Za-z0-9_-]+/gu, "trace_id=:traceId") @@ -1684,6 +1692,7 @@ function normalizeDiagnosticPreview(text) { .replace(/\bses_[A-Za-z0-9_-]+\b/gu, "ses_:sessionId") .replace(/\brun_[A-Za-z0-9_-]+\b/gu, "run_:runId") .replace(/\bcmd_[A-Za-z0-9_-]+\b/gu, "cmd_:commandId") + .replace(/[!!]+$/gu, "") .replace(/\s+/gu, " ") .trim(); }