File size: 1,670 Bytes
9b4cdbb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import knownIssuesData from "@/metadata/benchmark_known_issues.json"

export interface KnownIssue {
  title: string
  summary: string
  severity: "info" | "warning" | "critical"
  source_url?: string
  published?: string
}

const RAW_ISSUES = (knownIssuesData as { issues?: Record<string, KnownIssue[]> }).issues ?? {}

function normalizeKey(value: string): string {
  return value
    .toLowerCase()
    .trim()
    .replace(/[\s_\-/]+/g, " ")
    .replace(/\s+/g, " ")
}

const NORMALIZED_LOOKUP = new Map<string, KnownIssue[]>()
for (const [rawKey, issues] of Object.entries(RAW_ISSUES)) {
  if (!Array.isArray(issues) || issues.length === 0) continue
  NORMALIZED_LOOKUP.set(normalizeKey(rawKey), issues)
  // Also index a hyphenated variant since some benchmark keys use dashes
  NORMALIZED_LOOKUP.set(normalizeKey(rawKey).replace(/\s+/g, "-"), issues)
}

/**
 * Look up curated known issues for a benchmark by trying any of the supplied
 * names/keys (e.g. evaluation_name, composite_benchmark_key, family_key).
 * Returns the first matching list, or an empty array if nothing is recorded.
 */
export function getKnownIssues(...candidates: Array<string | undefined | null>): KnownIssue[] {
  for (const candidate of candidates) {
    if (!candidate) continue
    const key = normalizeKey(candidate)
    const direct = NORMALIZED_LOOKUP.get(key)
    if (direct) return direct
    // Try collapsed (no spaces/dashes) form too, since some sources mash names together
    const collapsed = key.replace(/\s+/g, "")
    for (const [registered, issues] of NORMALIZED_LOOKUP) {
      if (registered.replace(/\s+/g, "") === collapsed) return issues
    }
  }
  return []
}