From 67c943928b8fe41392ef3dbb2575e19e7301f099 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 2 Jul 2026 00:29:28 +0000 Subject: [PATCH] fix: map truncated sentinel check id --- config/hwlab-web-probe-sentinel/check-catalog.yaml | 2 ++ scripts/src/hwlab-node-web-sentinel-service.ts | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config/hwlab-web-probe-sentinel/check-catalog.yaml b/config/hwlab-web-probe-sentinel/check-catalog.yaml index cf07de75..a64f5888 100644 --- a/config/hwlab-web-probe-sentinel/check-catalog.yaml +++ b/config/hwlab-web-probe-sentinel/check-catalog.yaml @@ -19,6 +19,8 @@ sentinel: items: - code: WBC-001 id: workbench-terminal-api-dom-not-refreshed-in-place + aliases: + - workbench-terminal-api-dom-not-refreshed-in-plac level: error titleZh: 刷新后终端内容没更新 summaryZh: 后台已有新内容,但页面终端区域仍显示旧内容。 diff --git a/scripts/src/hwlab-node-web-sentinel-service.ts b/scripts/src/hwlab-node-web-sentinel-service.ts index 189d41ba..7d99a7e1 100644 --- a/scripts/src/hwlab-node-web-sentinel-service.ts +++ b/scripts/src/hwlab-node-web-sentinel-service.ts @@ -1560,7 +1560,7 @@ function mergeVisibleFindings(primary: readonly Record[], artif const merged: Record[] = []; const seen = new Set(); for (const item of [...primary, ...artifact]) { - const id = findingIdentity(item); + const id = canonicalFindingIdentity(item); const key = id ?? `${JSON.stringify(item).slice(0, 160)}:${stringOrNull(item.severity) ?? stringOrNull(item.level) ?? ""}`; if (seen.has(key)) continue; seen.add(key); @@ -1570,6 +1570,15 @@ function mergeVisibleFindings(primary: readonly Record[], artif return merged; } +function canonicalFindingIdentity(item: Record): string | null { + const check = record(item.check); + return stringOrNull(item.checkCode) + ?? stringOrNull(check.code) + ?? stringOrNull(item.checkId) + ?? stringOrNull(check.id) + ?? findingIdentity(item); +} + function findingIdentity(item: Record): string | null { return stringOrNull(item.finding_id) ?? stringOrNull(item.findingId)