From fe54d9f35254dc37714a90dbb0959164c54d7a00 Mon Sep 17 00:00:00 2001 From: iamtoruk Date: Fri, 10 Jul 2026 18:56:48 -0700 Subject: [PATCH] =?UTF-8?q?fix(app):=20Models=20=E2=80=94=20unpriced=20=3D?= =?UTF-8?q?=20no=20cost=20AND=20no=20savings=20(stop=20dimming=20Codex=20+?= =?UTF-8?q?=20local=20rows)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Critical review fix: the unpriced predicate misclassified every Codex row (all have credits) and every local saved-only model, hiding real cost/savings. Now unpriced = costUSD===0 && savingsUSD===0. Fixtures made realistic (codex priced, local saved-only priced, genuine proxy dimmed); proxy token cols show "—"; sub-1M tokens use the wireframe's "0.4M" style. Implemented by Codex gpt-5.5 (high); committed by Fable (git blocked in Codex sandbox). --- app/renderer/sections/Models.test.tsx | 51 ++++++++++++++++++++++++--- app/renderer/sections/Models.tsx | 10 +++--- 2 files changed, 52 insertions(+), 9 deletions(-) diff --git a/app/renderer/sections/Models.test.tsx b/app/renderer/sections/Models.test.tsx index cb5fb566..02eed528 100644 --- a/app/renderer/sections/Models.test.tsx +++ b/app/renderer/sections/Models.test.tsx @@ -34,8 +34,8 @@ const rows: ModelReportRow[] = [ credits: null, }, { - provider: 'openai', - providerDisplayName: 'OpenAI', + provider: 'codex', + providerDisplayName: 'Codex', model: 'gpt-5.5-codex', modelDisplayName: 'GPT-5.5 Codex', category: null, @@ -50,6 +50,23 @@ const rows: ModelReportRow[] = [ costUSD: 137.9, savingsUSD: 35.1, savingsBaselineModel: 'GPT-5.5 Codex', + credits: 173, + }, + { + provider: 'local', + providerDisplayName: 'Local', + model: 'llama-local', + modelDisplayName: 'Llama Local', + category: null, + inputTokens: 750_000, + outputTokens: 400_000, + cacheWriteTokens: 0, + cacheReadTokens: 0, + totalTokens: 1_150_000, + calls: 82, + costUSD: 0, + savingsUSD: 12.34, + savingsBaselineModel: 'Claude Opus 4.8', credits: null, }, { @@ -111,14 +128,38 @@ describe('Models', () => { expect(dots[1]).toHaveAttribute('style', expect.stringContaining('var(--cyan)')) }) - it('renders unpriced proxy rows as dim with alias affordance and cost dashes', async () => { - getModels.mockResolvedValue(rows) + it('renders codex rows with credits and real cost as priced', async () => { + getModels.mockResolvedValue([rows[1]]) + + render() + + expect(await screen.findByText('GPT-5.5 Codex')).not.toHaveClass('dim') + expect(screen.getByText('$137.90')).not.toHaveClass('dim') + expect(screen.getByText('$35.10')).toHaveClass('pos') + expect(screen.queryByText('add alias ›')).not.toBeInTheDocument() + }) + + it('renders local saved-only rows as priced with real savings', async () => { + getModels.mockResolvedValue([rows[2]]) + + render() + + expect(await screen.findByText('Llama Local')).not.toHaveClass('dim') + expect(screen.getByText('0.8M')).toBeInTheDocument() + expect(screen.getByText('0.4M')).toBeInTheDocument() + expect(screen.getByText('$0.00')).not.toHaveClass('dim') + expect(screen.getByText('$12.34')).toHaveClass('pos') + expect(screen.queryByText('add alias ›')).not.toBeInTheDocument() + }) + + it('renders unpriced proxy rows as dim with alias affordance and dashes', async () => { + getModels.mockResolvedValue([rows[3]]) render() expect(await screen.findByText('my-proxy-model')).toHaveClass('dim') expect(screen.getByText('add alias ›')).toHaveClass('alias') - expect(screen.getAllByText('—')).toHaveLength(2) + expect(screen.getAllByText('—')).toHaveLength(5) expect(screen.queryByText('$0.00')).not.toBeInTheDocument() }) diff --git a/app/renderer/sections/Models.tsx b/app/renderer/sections/Models.tsx index 20e7bf23..01e03689 100644 --- a/app/renderer/sections/Models.tsx +++ b/app/renderer/sections/Models.tsx @@ -24,6 +24,7 @@ function fmtInt(n: number): string { function fmtCompact(n: number): string { if (n === 0) return '0' + if (n < 1_000_000) return `${(n / 1_000_000).toFixed(1)}M` return new Intl.NumberFormat('en-US', { notation: 'compact', maximumFractionDigits: n >= 10_000_000 ? 1 : 2, @@ -115,8 +116,9 @@ function ModelsTable({ rows, byTask }: { rows: ModelReportRow[]; byTask: boolean } function ModelTableRow({ row, byTask }: { row: ModelReportRow; byTask: boolean }) { - const unpriced = (row.costUSD === 0 && row.calls > 0) || row.credits !== null + const unpriced = row.costUSD === 0 && row.savingsUSD === 0 const cellClass = unpriced ? 'dim' : undefined + const tokenValue = (value: number) => (unpriced ? '—' : fmtCompact(value)) const dotStyle = { display: 'inline-block', background: seriesColorForModel(row.modelDisplayName || row.model), @@ -142,9 +144,9 @@ function ModelTableRow({ row, byTask }: { row: ModelReportRow; byTask: boolean } ) : null} {fmtInt(row.calls)} - {fmtCompact(row.inputTokens)} - {fmtCompact(row.outputTokens)} - {fmtCompact(row.cacheReadTokens)} + {tokenValue(row.inputTokens)} + {tokenValue(row.outputTokens)} + {tokenValue(row.cacheReadTokens)} {unpriced ? '—' : fmtUsd(row.costUSD)} 0 ? 'pos' : undefined}>{unpriced ? '—' : fmtUsd(row.savingsUSD)}