From 5b7eeef20b07be0045132a6ec3a30f74612e1945 Mon Sep 17 00:00:00 2001 From: prdai Date: Tue, 17 Nov 2026 08:28:35 +0530 Subject: [PATCH] fix(transparency-portal): handle null run ids in run tables Co-authored-by: Codex --- .../src/components/authority/overview-tab.tsx | 2 +- .../transparency-portal/src/components/authority/runs-tab.tsx | 4 ++-- rads/transparency-portal/src/lib/api.ts | 2 +- rads/transparency-portal/src/lib/format.ts | 3 ++- .../src/components/authority/overview-tab.tsx | 2 +- .../transparency-portal/src/components/authority/runs-tab.tsx | 4 ++-- secure/transparency-portal/src/lib/api.ts | 2 +- secure/transparency-portal/src/lib/format.ts | 3 ++- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/rads/transparency-portal/src/components/authority/overview-tab.tsx b/rads/transparency-portal/src/components/authority/overview-tab.tsx index 6f57d725..ed0ff922 100644 --- a/rads/transparency-portal/src/components/authority/overview-tab.tsx +++ b/rads/transparency-portal/src/components/authority/overview-tab.tsx @@ -63,7 +63,7 @@ export function OverviewTab({ events, access }: OverviewTabProps) { {failures.slice(0, 10).map((failure, index) => ( {shortId(failure.algorithmId)} - {shortId(failure.runId)} + {shortId(failure.runId)} {failure.event} diff --git a/rads/transparency-portal/src/components/authority/runs-tab.tsx b/rads/transparency-portal/src/components/authority/runs-tab.tsx index b78954fc..088cf0b1 100644 --- a/rads/transparency-portal/src/components/authority/runs-tab.tsx +++ b/rads/transparency-portal/src/components/authority/runs-tab.tsx @@ -25,7 +25,7 @@ const columns: ColumnDef[] = [ accessorKey: "runId", header: "Run", cell: ({ row }) => ( - + {shortId(row.original.runId)} ), @@ -68,7 +68,7 @@ export function RunsTab({ events }: { events: RunEvent[] }) { if (!needle) return true; return ( event.event.toLowerCase().includes(needle) || - event.runId.toLowerCase().includes(needle) || + (event.runId ?? "").toLowerCase().includes(needle) || event.algorithmId.toLowerCase().includes(needle) ); }) diff --git a/rads/transparency-portal/src/lib/api.ts b/rads/transparency-portal/src/lib/api.ts index 29c9ce4f..af8cd9aa 100644 --- a/rads/transparency-portal/src/lib/api.ts +++ b/rads/transparency-portal/src/lib/api.ts @@ -5,7 +5,7 @@ const PDM_URL = import.meta.env.VITE_PDM_URL ?? "https://pdm.r.secure-rads.org"; export interface RunEvent { algorithmId: string; - runId: string; + runId: string | null; event: string; timestamp: string; receivedAt: string; diff --git a/rads/transparency-portal/src/lib/format.ts b/rads/transparency-portal/src/lib/format.ts index 79ae1122..7f663423 100644 --- a/rads/transparency-portal/src/lib/format.ts +++ b/rads/transparency-portal/src/lib/format.ts @@ -3,7 +3,8 @@ export function formatDateTime(value: string): string { return Number.isNaN(date.getTime()) ? value : date.toLocaleString(); } -export function shortId(value: string, length = 14): string { +export function shortId(value: string | null | undefined, length = 14): string { + if (!value) return "-"; return value.length <= length ? value : `${value.slice(0, length)}...`; } diff --git a/secure/transparency-portal/src/components/authority/overview-tab.tsx b/secure/transparency-portal/src/components/authority/overview-tab.tsx index 6f57d725..ed0ff922 100644 --- a/secure/transparency-portal/src/components/authority/overview-tab.tsx +++ b/secure/transparency-portal/src/components/authority/overview-tab.tsx @@ -63,7 +63,7 @@ export function OverviewTab({ events, access }: OverviewTabProps) { {failures.slice(0, 10).map((failure, index) => ( {shortId(failure.algorithmId)} - {shortId(failure.runId)} + {shortId(failure.runId)} {failure.event} diff --git a/secure/transparency-portal/src/components/authority/runs-tab.tsx b/secure/transparency-portal/src/components/authority/runs-tab.tsx index b78954fc..088cf0b1 100644 --- a/secure/transparency-portal/src/components/authority/runs-tab.tsx +++ b/secure/transparency-portal/src/components/authority/runs-tab.tsx @@ -25,7 +25,7 @@ const columns: ColumnDef[] = [ accessorKey: "runId", header: "Run", cell: ({ row }) => ( - + {shortId(row.original.runId)} ), @@ -68,7 +68,7 @@ export function RunsTab({ events }: { events: RunEvent[] }) { if (!needle) return true; return ( event.event.toLowerCase().includes(needle) || - event.runId.toLowerCase().includes(needle) || + (event.runId ?? "").toLowerCase().includes(needle) || event.algorithmId.toLowerCase().includes(needle) ); }) diff --git a/secure/transparency-portal/src/lib/api.ts b/secure/transparency-portal/src/lib/api.ts index fb828bfc..a79cd3f1 100644 --- a/secure/transparency-portal/src/lib/api.ts +++ b/secure/transparency-portal/src/lib/api.ts @@ -5,7 +5,7 @@ const PDM_URL = import.meta.env.VITE_PDM_URL ?? "https://pdm.sr.secure-rads.org" export interface RunEvent { algorithmId: string; - runId: string; + runId: string | null; event: string; timestamp: string; receivedAt: string; diff --git a/secure/transparency-portal/src/lib/format.ts b/secure/transparency-portal/src/lib/format.ts index 79ae1122..7f663423 100644 --- a/secure/transparency-portal/src/lib/format.ts +++ b/secure/transparency-portal/src/lib/format.ts @@ -3,7 +3,8 @@ export function formatDateTime(value: string): string { return Number.isNaN(date.getTime()) ? value : date.toLocaleString(); } -export function shortId(value: string, length = 14): string { +export function shortId(value: string | null | undefined, length = 14): string { + if (!value) return "-"; return value.length <= length ? value : `${value.slice(0, length)}...`; }