fix: map truncated sentinel check id
This commit is contained in:
@@ -19,6 +19,8 @@ sentinel:
|
|||||||
items:
|
items:
|
||||||
- code: WBC-001
|
- code: WBC-001
|
||||||
id: workbench-terminal-api-dom-not-refreshed-in-place
|
id: workbench-terminal-api-dom-not-refreshed-in-place
|
||||||
|
aliases:
|
||||||
|
- workbench-terminal-api-dom-not-refreshed-in-plac
|
||||||
level: error
|
level: error
|
||||||
titleZh: 刷新后终端内容没更新
|
titleZh: 刷新后终端内容没更新
|
||||||
summaryZh: 后台已有新内容,但页面终端区域仍显示旧内容。
|
summaryZh: 后台已有新内容,但页面终端区域仍显示旧内容。
|
||||||
|
|||||||
@@ -1560,7 +1560,7 @@ function mergeVisibleFindings(primary: readonly Record<string, unknown>[], artif
|
|||||||
const merged: Record<string, unknown>[] = [];
|
const merged: Record<string, unknown>[] = [];
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
for (const item of [...primary, ...artifact]) {
|
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) ?? ""}`;
|
const key = id ?? `${JSON.stringify(item).slice(0, 160)}:${stringOrNull(item.severity) ?? stringOrNull(item.level) ?? ""}`;
|
||||||
if (seen.has(key)) continue;
|
if (seen.has(key)) continue;
|
||||||
seen.add(key);
|
seen.add(key);
|
||||||
@@ -1570,6 +1570,15 @@ function mergeVisibleFindings(primary: readonly Record<string, unknown>[], artif
|
|||||||
return merged;
|
return merged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function canonicalFindingIdentity(item: Record<string, unknown>): 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, unknown>): string | null {
|
function findingIdentity(item: Record<string, unknown>): string | null {
|
||||||
return stringOrNull(item.finding_id)
|
return stringOrNull(item.finding_id)
|
||||||
?? stringOrNull(item.findingId)
|
?? stringOrNull(item.findingId)
|
||||||
|
|||||||
Reference in New Issue
Block a user