fix: dedupe sentinel artifact findings by id

This commit is contained in:
Codex
2026-07-01 09:45:46 +00:00
parent ed7225bb9a
commit 044331eaeb
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -333,7 +333,7 @@ function mergeSentinelReportFindings(primary: readonly Record<string, unknown>[]
const seen = new Set<string>();
for (const item of [...primary, ...artifact]) {
const id = sentinelReportFindingIdentity(item);
const key = `${id ?? JSON.stringify(item).slice(0, 160)}:${stringAtNullable(item, "severity") ?? stringAtNullable(item, "level") ?? ""}`;
const key = id ?? `${JSON.stringify(item).slice(0, 160)}:${stringAtNullable(item, "severity") ?? stringAtNullable(item, "level") ?? ""}`;
if (seen.has(key)) continue;
seen.add(key);
merged.push(item);
@@ -1536,7 +1536,8 @@ function mergeVisibleFindings(primary: readonly Record<string, unknown>[], artif
const merged: Record<string, unknown>[] = [];
const seen = new Set<string>();
for (const item of [...primary, ...artifact]) {
const key = `${findingIdentity(item) ?? JSON.stringify(item).slice(0, 160)}:${stringOrNull(item.severity) ?? stringOrNull(item.level) ?? ""}`;
const id = findingIdentity(item);
const key = id ?? `${JSON.stringify(item).slice(0, 160)}:${stringOrNull(item.severity) ?? stringOrNull(item.level) ?? ""}`;
if (seen.has(key)) continue;
seen.add(key);
merged.push(item);