Skip to content

πŸͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(experiments): the results grid shows a skeleton, not "null", while item I/O loads (#17359)

Nikita Kabardin7e16bab511c3
diff --git a/packages/shared/src/server/repositories/experiments.ts b/packages/shared/src/server/repositories/experiments.ts
index 1c70ec08b8..d76fd22204 100644
--- a/packages/shared/src/server/repositories/experiments.ts
+++ b/packages/shared/src/server/repositories/experiments.ts
@@ -1500,6 +1500,16 @@ export const getExperimentItemsBatchIO = async (props: {
const isBaseline =
baseExperimentId && row.experiment_id === baseExperimentId;
+ // The stored text is passed through verbatim, deliberately. A payload that
+ // is the JSON literal `null` and a payload that is the four-character
+ // STRING "null" are byte-identical here: the native experiment path writes
+ // both through stringifyValue, which returns a string unchanged, while the
+ // dataset-run-item path JSON-encodes (so there a string arrives quoted).
+ // One column, two encodings, no way to tell them apart β€” so guessing would
+ // erase a real value, and in the fallback below it would go further and
+ // substitute a DIFFERENT run's value in its place. Absent payloads are
+ // handled where they are unambiguous, in the cell.
+
// Use baseline value if available, otherwise first non-null
if (row.input !== null && (isBaseline || item.input === null)) {
item.input = row.input;
diff --git a/web/src/__tests__/server/repositories/experiment-items-repository.servertest.ts b/web/src/__tests__/server/repositories/experiment-items-repository.servertest.ts
index f00b303755..5e15f5144c 100644
--- a/web/src/__tests__/server/repositories/experiment-items-repository.servertest.ts
+++ b/web/src/__tests__/server/repositories/experiment-items-repository.servertest.ts
@@ -1627,5 +1627,68 @@ describe("Clickhouse Experiment Items Repository Test", () => {
),
).toBe(true);
});
+
+ it("passes a payload of the four characters null through untouched", async () => {
+ // A native experiment writes I/O through stringifyValue, which returns a
+ // string unchanged β€” so an expected output that legitimately IS the
+ // string "null" is byte-identical to a serialized JSON null. Guessing
+ // would erase the real value, and the baseline fallback below would then
+ // reach for ANOTHER run's value and show that instead. So the text is
+ // passed through, and the baseline still wins.
+ const baselineExpId = randomUUID();
+ const compExpId = randomUUID();
+ const datasetId = randomUUID();
+ const itemId = randomUUID();
+
+ const root1Id = randomUUID();
+ const root2Id = randomUUID();
+
+ await createEventsCh([
+ createExperimentEvent({
+ project_id: projectId,
+ trace_id: randomUUID(),
+ span_id: root1Id,
+ experimentId: baselineExpId,
+ experimentName: "baseline-exp",
+ datasetId,
+ itemId,
+ experimentItemRootSpanId: root1Id,
+ input: "null",
+ output: "null",
+ experiment_item_expected_output: "null",
+ start_time: Date.now() * 1000,
+ }),
+ createExperimentEvent({
+ project_id: projectId,
+ trace_id: randomUUID(),
+ span_id: root2Id,
+ experimentId: compExpId,
+ experimentName: "comp-exp",
+ datasetId,
+ itemId,
+ experimentItemRootSpanId: root2Id,
+ input: "a real input",
+ output: "a real output",
+ experiment_item_expected_output: "a real expected output",
+ start_time: Date.now() * 1000,
+ }),
+ ]);
+
+ const result = await getExperimentItemsBatchIO({
+ projectId,
+ itemIds: [itemId],
+ baseExperimentId: baselineExpId,
+ compExperimentIds: [compExpId],
+ });
+
+ expect(result[0]).toMatchObject({
+ itemId,
+ input: "null",
+ expectedOutput: "null",
+ });
+ expect(
+ result[0].outputs.find((o) => o.experimentId === baselineExpId)?.output,
+ ).toBe("null");
+ });
});
});
diff --git a/web/src/components/design-system/table/columns/createIOTableColumn.stories.tsx b/web/src/components/design-system/table/columns/createIOTableColumn.stories.tsx
index a3d73ef34a..f9cb53ec8b 100644
--- a/web/src/components/design-system/table/columns/createIOTableColumn.stories.tsx
+++ b/web/src/components/design-system/table/columns/createIOTableColumn.stories.tsx
@@ -272,7 +272,11 @@ export const TestCustomFalsyHandling = meta.story({
play: async ({ canvas }) => {
await expect(canvas.queryByText("false")).toBeInTheDocument();
await expect(canvas.getAllByText("false")).toHaveLength(1);
+ // "fallback" hands the hyphen over as content, so it renders as given;
+ // "omitted" hands over nothing and gets the shared empty treatment.
await expect(canvas.getByText("-")).toBeInTheDocument();
+ await expect(canvas.getByText("β€”")).toBeInTheDocument();
+ await expect(canvas.getByText("No value")).toBeInTheDocument();
},
});
diff --git a/web/src/components/design-system/table/columns/createIOTableColumn.tsx b/web/src/components/design-system/table/columns/createIOTableColumn.tsx
index 230b13f87d..fb58bdc628 100644
--- a/web/src/components/design-system/table/columns/createIOTableColumn.tsx
+++ b/web/src/components/design-system/table/columns/createIOTableColumn.tsx
@@ -71,7 +71,6 @@ export function createIOTableColumn<TData extends RowData, TValue = unknown>({
cell = value;
}
- if (cell === undefined) return null;
if (
typeof cell === "object" &&
cell !== null &&
@@ -81,6 +80,9 @@ export function createIOTableColumn<TData extends RowData, TValue = unknown>({
return loadingCell;
}
+ // An empty `cell` is passed through rather than short-circuited to a
+ // blank: the cell owns what "empty" looks like, so every table that uses
+ // it shows the same placeholder.
return renderMediaReference ? (
<IOTableCell
{...cellProps}
diff --git a/web/src/components/design-system/table/columns/createIdTableColumn.tsx b/web/src/components/design-system/table/columns/createIdTableColumn.tsx
index 1f6b1fedd7..ff1f513e79 100644
--- a/web/src/components/design-system/table/columns/createIdTableColumn.tsx
+++ b/web/src/components/design-system/table/columns/createIdTableColumn.tsx
@@ -2,6 +2,7 @@
import { type CellContext, type RowData } from "@tanstack/react-table";
import { IdTableCell } from "@/src/components/design-system/table/components/IdTableCell/IdTableCell";
+import { EmptyValue } from "@/src/components/design-system/table/components/EmptyValue/EmptyValue";
import { Skeleton } from "@/src/components/ui/skeleton";
import {
createTableColumn,
@@ -10,6 +11,14 @@ import {
export function createIdTableColumn<TData extends RowData>(
options: TableColumnOptions<TData, string> & {
+ /**
+ * A word to show instead of the shared empty treatment, e.g. "Unknown".
+ * An empty string keeps the cell deliberately blank.
+ */
+ /**
+ * A word to show instead of the shared empty treatment, e.g. "Unknown".
+ * An empty string keeps the cell deliberately blank.
+ */
emptyValue?: string;
getValue?: (
value: string | null | undefined,
@@ -26,7 +35,10 @@ export function createIdTableColumn<TData extends RowData>(
const resolvedValue = getValue ? getValue(value, context) : value;
const displayValue = resolvedValue || emptyValue;
- return displayValue ? <IdTableCell value={displayValue} /> : null;
+ // Not routed through IdTableCell: a placeholder is not an id, so it must
+ // not arrive with an id's affordances (monospace, click-to-copy).
+ if (!displayValue) return emptyValue === "" ? null : <EmptyValue />;
+ return <IdTableCell value={displayValue} />;
},
});
}
diff --git a/web/src/components/design-system/table/columns/createNumberTableColumn.tsx b/web/src/components/design-system/table/columns/createNumberTableColumn.tsx
index 3ac258ec29..7d5964045f 100644
--- a/web/src/components/design-system/table/columns/createNumberTableColumn.tsx
+++ b/web/src/components/design-system/table/columns/createNumberTableColumn.tsx
@@ -1,6 +1,7 @@
/* eslint-disable boundaries/dependencies */
import { type CellContext, type RowData } from "@tanstack/react-table";
+import { EmptyValue } from "@/src/components/design-system/table/components/EmptyValue/EmptyValue";
import { Skeleton } from "@/src/components/ui/skeleton";
import { numberFormatter } from "@/src/utils/numbers";
import {
@@ -17,6 +18,10 @@ export function createNumberTableColumn<
getValue,
...options
}: TableColumnOptions<TData, TValue> & {
+ /**
+ * A word to show instead of the shared empty treatment, e.g. "Unknown".
+ * An empty string keeps the cell deliberately blank.
+ */
emptyValue?: string;
formatter?: (
value: TValue,
@@ -34,7 +39,8 @@ export function createNumberTableColumn<
loadingCell,
renderCell: (value, context) => {
if (!getValue) {
- if (value === null || value === undefined) return emptyValue ?? null;
+ if (value === null || value === undefined)
+ return emptyValue ?? <EmptyValue />;
return (
<span>{formatter?.(value, context) ?? numberFormatter(value)}</span>
);
@@ -42,7 +48,7 @@ export function createNumberTableColumn<
const resolvedValue = getValue(value, context);
- if (resolvedValue === undefined) return emptyValue ?? null;
+ if (resolvedValue === undefined) return emptyValue ?? <EmptyValue />;
if (
typeof resolvedValue !== "number" &&
typeof resolvedValue !== "bigint"
diff --git a/web/src/components/design-system/table/columns/createStatusTableColumn.tsx b/web/src/components/design-system/table/columns/createStatusTableColumn.tsx
index 60548c67ee..45c1155306 100644
--- a/web/src/components/design-system/table/columns/createStatusTableColumn.tsx
+++ b/web/src/components/design-system/table/columns/createStatusTableColumn.tsx
@@ -1,6 +1,7 @@
/* eslint-disable boundaries/dependencies */
import { type CellContext, type RowData } from "@tanstack/react-table";
+import { EmptyValue } from "@/src/components/design-system/table/components/EmptyValue/EmptyValue";
import { Skeleton } from "@/src/components/ui/skeleton";
import {
type Status,
@@ -27,6 +28,10 @@ export function createStatusTableColumn<
context: CellContext<TData, TValue | null | undefined>,
) => StatusCell;
isLive?: boolean;
+ /**
+ * A word to show instead of the shared empty treatment, e.g. "Unknown".
+ * An empty string keeps the cell deliberately blank.
+ */
emptyValue?: string;
}) {
const loadingCell = <Skeleton className="h-5 w-16 shrink-0 rounded-sm" />;
@@ -37,7 +42,7 @@ export function createStatusTableColumn<
renderCell: (value, context) => {
const status = getStatus(value, context);
- if (status === undefined) return emptyValue ?? null;
+ if (status === undefined) return emptyValue ?? <EmptyValue />;
if (typeof status !== "string") return loadingCell;
return <StatusBadge type={status} isLive={isLive} />;
diff --git a/web/src/components/design-system/table/columns/createUserTableColumn.tsx b/web/src/components/design-system/table/columns/createUserTableColumn.tsx
index 0a8c2061fe..7b1ef20141 100644
--- a/web/src/components/design-system/table/columns/createUserTableColumn.tsx
+++ b/web/src/components/design-system/table/columns/createUserTableColumn.tsx
@@ -2,6 +2,7 @@
import { type CellContext, type RowData } from "@tanstack/react-table";
import { Avatar } from "@/src/components/design-system/Avatar/Avatar";
+import { EMPTY_VALUE_PLACEHOLDER } from "@/src/components/design-system/table/constants";
import { Skeleton } from "@/src/components/ui/skeleton";
import {
createTableColumn,
@@ -27,7 +28,11 @@ export function createUserTableColumn<
...options
}: TableColumnOptions<TData, TValue> &
UserTableColumnPresentation & {
- emptyValue: string;
+ /**
+ * A word for a user whose identity is unknown, e.g. "Unknown". Defaults to
+ * the shared empty placeholder.
+ */
+ emptyValue?: string;
/**
* Return undefined when the row has no associated user. Return a user with
* an empty object when a user exists but their identity is unknown.
@@ -61,7 +66,8 @@ export function createUserTableColumn<
if (cell.type === "loading") return loadingCell;
const { name, email, image, id } = cell.user;
- const label = name ?? email ?? id ?? emptyValue;
+ const label =
+ name ?? email ?? id ?? emptyValue ?? EMPTY_VALUE_PLACEHOLDER;
if (variant === "text") {
return (
<span className="block truncate" title={label}>
diff --git a/web/src/components/design-system/table/components/EmptyValue/EmptyValue.tsx b/web/src/components/design-system/table/components/EmptyValue/EmptyValue.tsx
new file mode 100644
index 0000000000..070cba2d1c
--- /dev/null
+++ b/web/src/components/design-system/table/components/EmptyValue/EmptyValue.tsx
@@ -0,0 +1,18 @@
+import {
+ EMPTY_VALUE_LABEL,
+ EMPTY_VALUE_PLACEHOLDER,
+} from "@/src/components/design-system/table/constants";
+
+/**
+ * A value that arrived and is empty. One treatment for every table, so an
+ * empty cell never reads as a cell that failed.
+ *
+ * The em dash alone reaches a screen reader as punctuation, so the meaning
+ * travels in a visually-hidden word beside it.
+ */
+export const EmptyValue = () => (
+ <span className="text-muted-foreground">
+ <span aria-hidden="true">{EMPTY_VALUE_PLACEHOLDER}</span>
+ <span className="sr-only">{EMPTY_VALUE_LABEL}</span>
+ </span>
+);
diff --git a/web/src/components/design-system/table/components/IOTableCell/IOTableCell.clienttest.tsx b/web/src/components/design-system/table/components/IOTableCell/IOTableCell.clienttest.tsx
new file mode 100644
index 0000000000..3a68879366
--- /dev/null
+++ b/web/src/components/design-system/table/components/IOTableCell/IOTableCell.clienttest.tsx
@@ -0,0 +1,63 @@
+import { render, screen } from "@testing-library/react";
+import { IOTableCell } from "./IOTableCell";
+
+// The JSON viewer underneath reads the app's markdown preference. Stubbed
+// rather than imported: a design-system file must not reach into `src/features`.
+vi.mock("@/src/features/theming/useMarkdownContext", () => ({
+ useMarkdownContext: () => ({
+ isMarkdownEnabled: false,
+ setIsMarkdownEnabled: () => {},
+ }),
+}));
+
+const renderCell = (props: Partial<Parameters<typeof IOTableCell>[0]> = {}) =>
+ render(
+ <IOTableCell
+ data={undefined}
+ renderMediaReference={() => null}
+ {...props}
+ />,
+ );
+
+describe("IOTableCell", () => {
+ it("reads an empty payload as empty, not as the word null", () => {
+ // A payload that carries no value must not read as one β€” `null` is what a
+ // reader takes for data. It gets the em dash, plus the word behind it: a
+ // dash alone reaches a screen reader as punctuation.
+ //
+ // The expand-on-hover affordance has to be gone too, not just the body:
+ // the card it opens renders the payload itself, so it would show `null`
+ // on hover. Asserted through the trigger's own class, because the card
+ // only mounts its content once a real hover has opened it.
+ for (const data of [null, undefined, ""]) {
+ const { container, unmount } = renderCell({
+ data,
+ enableExpandOnHover: true,
+ });
+ expect(screen.getByText("β€”")).toBeInTheDocument();
+ expect(screen.getByText("No value")).toBeInTheDocument();
+ expect(screen.queryByText("null")).not.toBeInTheDocument();
+ expect(container.querySelector(".group\\/io-cell")).toBeNull();
+ unmount();
+ }
+ });
+
+ it("keeps the expand affordance when there is something to expand", () => {
+ const { container } = renderCell({
+ data: { context: null },
+ enableExpandOnHover: true,
+ });
+ expect(container.querySelector(".group\\/io-cell")).not.toBeNull();
+ });
+
+ it("keeps a null nested inside a payload", () => {
+ renderCell({ data: { context: null } });
+ expect(screen.getByText("null")).toBeInTheDocument();
+ expect(screen.queryByText("β€”")).not.toBeInTheDocument();
+ });
+
+ it("shows a skeleton, never the empty placeholder, while loading", () => {
+ renderCell({ data: undefined, isLoading: true });
+ expect(screen.queryByText("β€”")).not.toBeInTheDocument();
+ });
+});
diff --git a/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx b/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx
index 7e0dd57384..5cd00f893a 100644
--- a/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx
+++ b/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx
@@ -17,6 +17,7 @@ import {
HoverCardTrigger,
} from "@/src/components/ui/hover-card";
import { decodeUnicodeEscapesOnly } from "@/src/utils/unicode";
+import { EmptyValue } from "@/src/components/design-system/table/components/EmptyValue/EmptyValue";
export type IOTableCellVariant = "default" | "input" | "output";
type IOTableCellSize = "default" | "compact";
@@ -144,14 +145,31 @@ export const IOTableCell = memo(function IOTableCell({
stringifiedJson && stringifiedJson.length > IO_TABLE_CHAR_LIMIT;
const singleLineText = stringifiedJson
? decodeUnicodeEscapesOnly(stringifiedJson, true)
- : stringifiedJson;
+ : "";
// The multi-line branches scroll inside the cell, so their scrollport is
// marked `scrollbar-visible`: a region that scrolls without ever painting a
// scrollbar is indistinguishable from one whose content was cut off, and
// nobody reaches for the wheel on content they read as truncated.
let content: ReactNode;
- if (singleLine) {
+ if (!stringifiedJson) {
+ // The payload arrived and is empty. Handing that to the JSON viewer renders
+ // the word `null` (or a bare pair of quotes), which a reader takes for a
+ // value, and a blank cell says nothing at all β€” so it gets the shared
+ // empty treatment. A payload that is only PARTLY empty is untouched: a
+ // `null` nested in a document is content and still renders as `null`.
+ content = (
+ <div
+ className={cn(
+ "h-full w-full self-stretch rounded-sm",
+ paddingClassName,
+ variantClassName,
+ )}
+ >
+ <EmptyValue />
+ </div>
+ );
+ } else if (singleLine) {
content = (
<div
className={cn(
@@ -175,12 +193,7 @@ export const IOTableCell = memo(function IOTableCell({
)
}
>
- {singleLineText
- ? renderStringWithMediaReferences(
- singleLineText,
- renderMediaReference,
- )
- : null}
+ {renderStringWithMediaReferences(singleLineText, renderMediaReference)}
</div>
);
} else if (shouldTruncate) {
@@ -211,11 +224,7 @@ export const IOTableCell = memo(function IOTableCell({
} else {
content = (
<JSONView
- json={
- stringifiedJson
- ? decodeUnicodeEscapesOnly(stringifiedJson, true)
- : data
- }
+ json={decodeUnicodeEscapesOnly(stringifiedJson, true)}
className={cn(
"h-full w-full self-stretch overflow-hidden rounded-sm",
variantClassName,
@@ -230,7 +239,10 @@ export const IOTableCell = memo(function IOTableCell({
);
}
- if (!enableExpandOnHover) {
+ // The expand card renders `data` itself, so an empty payload would come back
+ // as `null` on hover even though the cell body shows the empty treatment.
+ // Nothing to expand, no card.
+ if (!enableExpandOnHover || !stringifiedJson) {
return content;
}
diff --git a/web/src/components/design-system/table/constants.ts b/web/src/components/design-system/table/constants.ts
new file mode 100644
index 0000000000..f5070ad398
--- /dev/null
+++ b/web/src/components/design-system/table/constants.ts
@@ -0,0 +1,15 @@
+/**
+ * What a settled, empty cell shows.
+ *
+ * An em dash says "there is nothing here". A blank cell says nothing at all:
+ * it reads the same as a column that failed to load, a value still on its way,
+ * or a bug. This is only for a value that has ARRIVED and is empty β€” a pending
+ * cell renders a skeleton, never this.
+ *
+ * Pair it with a visually-hidden word wherever it stands alone, because an em
+ * dash on its own reaches a screen reader as punctuation.
+ */
+export const EMPTY_VALUE_PLACEHOLDER = "β€”";
+
+/** What the em dash means, for assistive technology. */
+export const EMPTY_VALUE_LABEL = "No value";
diff --git a/web/src/components/table/use-cases/observations.tsx b/web/src/components/table/use-cases/observations.tsx
index f9834562ec..c80ca70cfc 100644
--- a/web/src/components/table/use-cases/observations.tsx
+++ b/web/src/components/table/use-cases/observations.tsx
@@ -57,6 +57,7 @@ import {
} from "@/src/utils/observationCost";
import { useOrderByState } from "@/src/features/orderBy/hooks/useOrderByState";
import { useRowHeightLocalStorage } from "@/src/components/table/data-table-row-height-switch";
+import { EmptyValue } from "@/src/components/design-system/table/components/EmptyValue/EmptyValue";
import { ConnectedIOTableCell } from "@/src/components/table/ConnectedIOTableCell";
import { useTableDateRange } from "@/src/hooks/useTableDateRange";
import { usePeekTableState } from "@/src/components/table/peek/contexts/PeekTableStateContext";
@@ -893,7 +894,11 @@ export default function ObservationsTable({
return (
<span>
- {timeToFirstToken ? formatIntervalSeconds(timeToFirstToken) : "-"}
+ {timeToFirstToken ? (
+ formatIntervalSeconds(timeToFirstToken)
+ ) : (
+ <EmptyValue />
+ )}
</span>
);
},
@@ -1141,7 +1146,6 @@ export default function ObservationsTable({
id: "inputCost",
header: "Input Cost",
size: 120,
- emptyValue: "-",
formatter: (value, { row }) =>
formatObservationCost(value, row.original.type),
enableHiding: true,
@@ -1153,7 +1157,6 @@ export default function ObservationsTable({
id: "outputCost",
header: "Output Cost",
size: 120,
- emptyValue: "-",
formatter: (value, { row }) =>
formatObservationCost(value, row.original.type),
enableHiding: true,
diff --git a/web/src/components/table/use-cases/traces.tsx b/web/src/components/table/use-cases/traces.tsx
index 228bbfb369..c8a92d65ab 100644
--- a/web/src/components/table/use-cases/traces.tsx
+++ b/web/src/components/table/use-cases/traces.tsx
@@ -53,6 +53,7 @@ import {
DEFAULT_SIDEBAR_IMPLICIT_ENVIRONMENT_CONFIG,
} from "@langfuse/shared";
import { useRowHeightLocalStorage } from "@/src/components/table/data-table-row-height-switch";
+import { EmptyValue } from "@/src/components/design-system/table/components/EmptyValue/EmptyValue";
import { ConnectedIOTableCell } from "@/src/components/table/ConnectedIOTableCell";
import { useTableDateRange } from "@/src/hooks/useTableDateRange";
import { useLiveTableDateRange } from "@/src/hooks/useLiveTableDateRange";
@@ -847,7 +848,7 @@ function TracesTableInternal({
{cost ? (
<span>{usdFormatter(cost.toNumber())}</span>
) : (
- <span>-</span>
+ <EmptyValue />
)}
<InfoIcon className="h-3 w-3" />
</div>
@@ -1023,7 +1024,6 @@ function TracesTableInternal({
enableHiding: true,
enableSorting,
isLive: false,
- emptyValue: "-",
getStatus: (level, { row }) =>
isMetricPending(row.original.id)
? { type: "loading" }
@@ -1109,7 +1109,6 @@ function TracesTableInternal({
id: "inputCost",
header: "Input Cost",
size: 100,
- emptyValue: "-",
formatter: (value) => usdFormatter(value),
getValue: (value, { row }) => {
if (isMetricPending(row.original.id)) return { type: "loading" };
@@ -1124,7 +1123,6 @@ function TracesTableInternal({
id: "outputCost",
header: "Output Cost",
size: 100,
- emptyValue: "-",
formatter: (value) => usdFormatter(value),
getValue: (value, { row }) => {
if (isMetricPending(row.original.id)) return { type: "loading" };
diff --git a/web/src/features/datasets/components/DatasetAggregateTableCell.tsx b/web/src/features/datasets/components/DatasetAggregateTableCell.tsx
index a20e10c5d0..e1715ef478 100644
--- a/web/src/features/datasets/components/DatasetAggregateTableCell.tsx
+++ b/web/src/features/datasets/components/DatasetAggregateTableCell.tsx
@@ -176,7 +176,7 @@ const DatasetAggregateCellContent = ({
<ConnectedIOTableCell isLoading variant="output" />
) : (
<ConnectedIOTableCell
- data={data.output ?? "null"}
+ data={data.output ?? null}
variant="output"
enableExpandOnHover
/>
diff --git a/web/src/features/datasets/components/DatasetRunItemsByItemTable.tsx b/web/src/features/datasets/components/DatasetRunItemsByItemTable.tsx
index 2652886a36..06c9f793de 100644
--- a/web/src/features/datasets/components/DatasetRunItemsByItemTable.tsx
+++ b/web/src/features/datasets/components/DatasetRunItemsByItemTable.tsx
@@ -73,7 +73,6 @@ export function DatasetRunItemsByItemTable(props: {
header: "Run Name",
size: 150,
isPinnedLeft: true,
- emptyValue: "-",
}),
createDateTableColumn<DatasetRunItemByItemRowData>({
accessorKey: "runAt",
diff --git a/web/src/features/evals/components/evaluator-table.tsx b/web/src/features/evals/components/evaluator-table.tsx
index b1a329d776..8d87d7e1a1 100644
--- a/web/src/features/evals/components/evaluator-table.tsx
+++ b/web/src/features/evals/components/evaluator-table.tsx
@@ -224,7 +224,6 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
header: "Total Cost (7d)",
enableSorting: false,
size: 120,
- emptyValue: "–",
formatter: (value) => usdFormatter(value, 2, 4),
getValue: (value, { row }) => {
if (row.original.isCostLoading) return { type: "loading" };
diff --git a/web/src/features/evals/v2/components/Rules/RulesTable/RulesTable.tsx b/web/src/features/evals/v2/components/Rules/RulesTable/RulesTable.tsx
index b41935961b..0bcc1276bc 100644
--- a/web/src/features/evals/v2/components/Rules/RulesTable/RulesTable.tsx
+++ b/web/src/features/evals/v2/components/Rules/RulesTable/RulesTable.tsx
@@ -313,7 +313,6 @@ export function RulesTable({
header: "Total cost (7d)",
size: 140,
enableHiding: true,
- emptyValue: "β€”",
formatter: (value) => usdFormatter(value, 2, 4),
getValue: (value) => {
if (costs.isPending) return { type: "loading" };
diff --git a/web/src/features/evals/v2/pages/EvaluatorsPage.tsx b/web/src/features/evals/v2/pages/EvaluatorsPage.tsx
index 9dc2104822..5f5326676c 100644
--- a/web/src/features/evals/v2/pages/EvaluatorsPage.tsx
+++ b/web/src/features/evals/v2/pages/EvaluatorsPage.tsx
@@ -443,7 +443,6 @@ export default function EvaluatorsPage() {
header: "Total cost (7d)",
size: 140,
enableHiding: true,
- emptyValue: "β€”",
formatter: (value) => usdFormatter(value, 2, 4),
getValue: (value) => {
if (costs.isPending && hasExecutionReadAccess) {
diff --git a/web/src/features/events/components/EventsTable.tsx b/web/src/features/events/components/EventsTable.tsx
index ee62965e89..de462f9631 100644
--- a/web/src/features/events/components/EventsTable.tsx
+++ b/web/src/features/events/components/EventsTable.tsx
@@ -1,5 +1,6 @@
import { eventsSearchRegistry } from "../config/eventsSearchRegistry";
import { useEventsSearchBar } from "@/src/features/search-bar/hooks/useEventsSearchBar";
+import { EmptyValue } from "@/src/components/design-system/table/components/EmptyValue/EmptyValue";
import { DataTable } from "@/src/components/table/data-table";
import { DataTableToolbar } from "@/src/components/table/data-table-toolbar";
import {
@@ -1345,7 +1346,6 @@ export default function ObservationsEventsTable({
defaultHidden: true,
enableSorting,
formatter: (value) => usdFormatter(value),
- emptyValue: "-",
}),
createTextTableColumn<EventsTableRow>({
accessorFn: (row) =>
@@ -1390,7 +1390,11 @@ export default function ObservationsEventsTable({
return (
<span>
- {timeToFirstToken ? formatIntervalSeconds(timeToFirstToken) : "-"}
+ {timeToFirstToken ? (
+ formatIntervalSeconds(timeToFirstToken)
+ ) : (
+ <EmptyValue />
+ )}
</span>
);
},
diff --git a/web/src/features/experiments/components/table/ExperimentGridCell.tsx b/web/src/features/experiments/components/table/ExperimentGridCell.tsx
index 38b29e6742..38120f6df2 100644
--- a/web/src/features/experiments/components/table/ExperimentGridCell.tsx
+++ b/web/src/features/experiments/components/table/ExperimentGridCell.tsx
@@ -2,6 +2,8 @@
selected (`getExperimentColorStyles`) β€” so it arrives as a class rather than
as a variant, the same way `DiffLabel` takes one. */
/* eslint-disable @repo/no-style-props */
+import { EmptyValue } from "@/src/components/design-system/table/components/EmptyValue/EmptyValue";
+import { EMPTY_VALUE_PLACEHOLDER } from "@/src/components/design-system/table/constants";
import { ConnectedIOTableCell } from "@/src/components/table/ConnectedIOTableCell";
import { Badge } from "@/src/components/ui/badge";
import {
@@ -239,15 +241,17 @@ const ScoreMetadataPeek = ({
* quote the same value the cell shows.
*/
const scoreValueOf = (aggregate?: AggregatedScoreData | null): string => {
- if (!aggregate) return "-";
+ if (!aggregate) return EMPTY_VALUE_PLACEHOLDER;
if (aggregate.type === "CATEGORICAL") {
if (aggregate.valueCounts && aggregate.valueCounts.length > 0) {
return [...aggregate.valueCounts].sort((a, b) => b.count - a.count)[0]
.value;
}
- return aggregate.values?.[0] ?? "-";
+ return aggregate.values?.[0] ?? EMPTY_VALUE_PLACEHOLDER;
}
- return aggregate.average !== undefined ? aggregate.average.toFixed(2) : "-";
+ return aggregate.average !== undefined
+ ? aggregate.average.toFixed(2)
+ : EMPTY_VALUE_PLACEHOLDER;
};
/**
@@ -340,8 +344,10 @@ const ScoreItem = ({
clipped value reads as data, so the move wraps under it instead. */}
<div className="flex min-w-0 flex-wrap items-center justify-end gap-x-1 gap-y-0.5">
<span className="flex max-w-full shrink-0 items-center gap-1">
- {displayValue === "-" ? (
- <span className="text-muted-foreground text-xs">-</span>
+ {displayValue === EMPTY_VALUE_PLACEHOLDER ? (
+ <span className="text-xs">
+ <EmptyValue />
+ </span>
) : (
<Badge
variant="secondary"
diff --git a/web/src/features/experiments/components/table/ExperimentGridView.tsx b/web/src/features/experiments/components/table/ExperimentGridView.tsx
index 85f3155892..8db2ca2523 100644
--- a/web/src/features/experiments/components/table/ExperimentGridView.tsx
+++ b/web/src/features/experiments/components/table/ExperimentGridView.tsx
@@ -41,6 +41,12 @@ type ExperimentGridViewProps = {
singleLine: boolean;
rows: ExperimentItemsTableRow[];
isLoading: boolean;
+ /**
+ * Whether the item I/O query is still in flight. Separate from `isLoading`:
+ * the rows arrive from one query and their I/O from a second, so a cell that
+ * read row-loading would show an empty payload as if it were the answer.
+ */
+ ioLoading: boolean;
rowHeight: RowHeight;
/** Whether any item in view has an expected output worth a column. */
showExpectedOutput: boolean;
@@ -75,6 +81,7 @@ export const ExperimentGridView = ({
singleLine,
rows,
isLoading,
+ ioLoading,
rowHeight,
showExpectedOutput,
observationScoreOrder,
@@ -165,6 +172,7 @@ export const ExperimentGridView = ({
projectId={projectId}
itemId={row.original.itemId}
output={outputData?.output}
+ isLoading={ioLoading}
level={expData.level}
startTime={expData.startTime}
totalCost={expData.totalCost}
@@ -211,6 +219,7 @@ export const ExperimentGridView = ({
allExperimentIds,
experimentNames,
baselineExperimentId,
+ ioLoading,
projectId,
observationScoreOrder,
traceScoreOrder,
@@ -231,7 +240,7 @@ export const ExperimentGridView = ({
accessorKey: "input",
header: "Input",
size: 200,
- getCell: (value) => (isLoading ? { type: "loading" } : (value ?? null)),
+ getCell: (value) => (ioLoading ? { type: "loading" } : (value ?? null)),
singleLine,
}),
// Gated: an empty expected output used to render as two literal quote
@@ -243,7 +252,7 @@ export const ExperimentGridView = ({
header: "Expected Output",
size: 200,
getCell: (value) =>
- isLoading ? { type: "loading" } : value || undefined,
+ ioLoading ? { type: "loading" } : value || undefined,
singleLine,
variant: "output",
}),
@@ -253,7 +262,7 @@ export const ExperimentGridView = ({
],
[
experimentColumns,
- isLoading,
+ ioLoading,
selectActionColumn,
showExpectedOutput,
singleLine,
diff --git a/web/src/features/experiments/components/table/ExperimentItemsTable.tsx b/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
index 312c9f7025..c7f87f61fd 100644
--- a/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
+++ b/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
@@ -74,6 +74,7 @@ import {
type ExperimentOutputData,
getExperimentColorStyles,
} from "./types";
+import { EmptyValue } from "@/src/components/design-system/table/components/EmptyValue/EmptyValue";
import { ConnectedIOTableCell } from "@/src/components/table/ConnectedIOTableCell";
import { Badge } from "@/src/components/ui/badge";
import { type DataTablePeekViewProps } from "@/src/components/table/peek";
@@ -315,7 +316,7 @@ const StackedExperimentCell = ({
{content}
</>
) : (
- <span className="text-muted-foreground">β€”</span>
+ <EmptyValue />
)}
</div>
);
@@ -501,7 +502,9 @@ const StackedOutputCell = ({
}
/>
) : (
- <span className="text-muted-foreground px-2 py-1">β€”</span>
+ <span className="px-2 py-1">
+ <EmptyValue />
+ </span>
)}
</div>
);
@@ -785,7 +788,7 @@ export default function ExperimentItemsTable({
);
// Use the custom hook for experiment items data fetching
- const { items, totalCount, dataUpdatedAt, ioLoading } =
+ const { items, totalCount, dataUpdatedAt, ioLoading, isTotalCountLoading } =
useExperimentItemsTableData({
projectId,
baseExperimentId: baselineId,
@@ -1168,8 +1171,7 @@ export default function ExperimentItemsTable({
const scoresData = exp[scoreField] ?? {};
const value = scoresData[scoreKey];
- if (!value)
- return <span className="text-muted-foreground">-</span>;
+ if (!value) return <EmptyValue />;
const mockRow = {
getValue: (key: string) =>
@@ -1926,10 +1928,13 @@ export default function ExperimentItemsTable({
const pagination = useMemo(
() => ({
totalCount: totalCount ?? null,
+ // Without this the footer prints "of 1" for as long as the count query
+ // is in flight behind rows that are already on screen.
+ isTotalCountLoading,
onChange: setPaginationState,
state: paginationState,
}),
- [paginationState, setPaginationState, totalCount],
+ [isTotalCountLoading, paginationState, setPaginationState, totalCount],
);
// Compute selected observation IDs for batch evaluation
@@ -2175,6 +2180,7 @@ export default function ExperimentItemsTable({
singleLine={ioSingleLine}
rows={rows}
isLoading={items.status === "loading" || isViewLoading}
+ ioLoading={ioLoading}
rowHeight={rowHeight}
showExpectedOutput={showExpectedOutput}
pagination={pagination}
diff --git a/web/src/features/experiments/hooks/useExperimentItemsTableData.ts b/web/src/features/experiments/hooks/useExperimentItemsTableData.ts
index 862d72168b..0b85eae0d3 100644
--- a/web/src/features/experiments/hooks/useExperimentItemsTableData.ts
+++ b/web/src/features/experiments/hooks/useExperimentItemsTableData.ts
@@ -191,10 +191,20 @@ export function useExperimentItemsTableData({
const dataUpdatedAt = itemsQuery.dataUpdatedAt;
+ // Readiness comes from the query settling, never from `isLoading`: a query
+ // that has not started is neither loading nor errored, so `isLoading` is
+ // already false while its empty data would read as the answer. The payload
+ // check keeps the flag false when there is genuinely nothing to fetch.
+ const ioLoading =
+ batchIOPayload !== null && !batchIOQuery.isSuccess && !batchIOQuery.isError;
+ const isTotalCountLoading =
+ hasSelectedRuns && !totalCountQuery.isSuccess && !totalCountQuery.isError;
+
return {
items: joinedData,
dataUpdatedAt,
totalCount,
- ioLoading: batchIOQuery.isLoading,
+ ioLoading,
+ isTotalCountLoading,
};
}
diff --git a/web/src/features/rbac/components/MembershipInvitesPage.tsx b/web/src/features/rbac/components/MembershipInvitesPage.tsx
index c93e47e08c..2137c2d755 100644
--- a/web/src/features/rbac/components/MembershipInvitesPage.tsx
+++ b/web/src/features/rbac/components/MembershipInvitesPage.tsx
@@ -118,7 +118,6 @@ export function MembershipInvitesPage({
accessorKey: "invitedByUser",
header: "Invited By",
variant: "avatar",
- emptyValue: "-",
}),
{
accessorKey: "meta",
diff --git a/web/src/utils/observationCost.ts b/web/src/utils/observationCost.ts
index b723d38a54..77a5eec7b4 100644
--- a/web/src/utils/observationCost.ts
+++ b/web/src/utils/observationCost.ts
@@ -2,7 +2,12 @@ import { isGenerationLike, type ObservationType } from "@langfuse/shared";
import { usdFormatter } from "@/src/utils/numbers";
-export const MISSING_OBSERVATION_COST_PLACEHOLDER = "-";
+/**
+ * Matches EMPTY_VALUE_PLACEHOLDER in the design-system table constants. Held
+ * as a literal rather than imported: this module is a string formatter and
+ * must not depend on the component tree.
+ */
+export const MISSING_OBSERVATION_COST_PLACEHOLDER = "β€”";
/**
* Types that ingestion can attach usage/cost to (CreateGenerationBody),