From 92439f842453931fb3d7df3c86bbe7c8e1aa485a Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Sat, 20 Dec 2025 16:49:31 +0000 Subject: [PATCH] Fix for incorrect display of invocation cost --- apps/webapp/app/components/code/TSQLResultsTable.tsx | 12 +++++++++++- apps/webapp/app/v3/querySchemas.ts | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/webapp/app/components/code/TSQLResultsTable.tsx b/apps/webapp/app/components/code/TSQLResultsTable.tsx index 085aa9f0a..95ee0d47f 100644 --- a/apps/webapp/app/components/code/TSQLResultsTable.tsx +++ b/apps/webapp/app/components/code/TSQLResultsTable.tsx @@ -129,6 +129,12 @@ function CellValue({ return {formatCurrencyAccurate(value / 100)}; } return {String(value)}; + case "costInDollars": + if (typeof value === "number") { + // Value is already in dollars, no conversion needed + return {formatCurrencyAccurate(value)}; + } + return {String(value)}; case "machine": { const preset = MachinePresetName.safeParse(value); if (preset.success) { @@ -201,7 +207,11 @@ function CellValue({ */ function isRightAlignedColumn(column: OutputColumnMetadata): boolean { // Check for custom render types that display numeric values - if (column.customRenderType === "duration" || column.customRenderType === "cost") { + if ( + column.customRenderType === "duration" || + column.customRenderType === "cost" || + column.customRenderType === "costInDollars" + ) { return true; } diff --git a/apps/webapp/app/v3/querySchemas.ts b/apps/webapp/app/v3/querySchemas.ts index e62c5cfc7..9bdb9b698 100644 --- a/apps/webapp/app/v3/querySchemas.ts +++ b/apps/webapp/app/v3/querySchemas.ts @@ -220,7 +220,7 @@ export const runsSchema: TableSchema = { name: "compute_cost", ...column("Float64", { description: "Compute cost in dollars", - customRenderType: "cost", + customRenderType: "costInDollars", example: "0.000676", }), expression: "cost_in_cents / 100.0", @@ -229,7 +229,7 @@ export const runsSchema: TableSchema = { name: "invocation_cost", ...column("Float64", { description: "Invocation cost in dollars", - customRenderType: "cost", + customRenderType: "costInDollars", example: "0.000025", }), expression: "base_cost_in_cents / 100.0",