From edb40cbf20db6b42d4e201f4f89e6d7a318e5e1b Mon Sep 17 00:00:00 2001 From: Charles Howard <96023061+charlesrhoward@users.noreply.github.com> Date: Mon, 18 May 2026 17:38:56 -0400 Subject: [PATCH 1/2] docs: address PR #43 review findings on ai models table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Generator now sets an explicit limit and errors on suspected truncation instead of silently returning a partial snapshot. - formatPrice falls back to exponential notation below $0.001 so very cheap models no longer render as the broken string "$". - Footer denominator uses live models.length, not the snapshot-time count. - Drops the Supabase project URL from the snapshot — it is not consumed by the component and there is no reason to embed it in committed JSON. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/gen-models-table.ts | 13 ++++++++++++- src/components/ai-models-table.tsx | 9 ++++++--- src/data/ai-models.json | 1 - 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/gen-models-table.ts b/scripts/gen-models-table.ts index 5d1d4f0..7e82705 100644 --- a/scripts/gen-models-table.ts +++ b/scripts/gen-models-table.ts @@ -56,12 +56,15 @@ type Row = { recommendation_bucket: string | null; }; +const PAGE_SIZE = 10_000; + async function main() { const url = new URL(`${SUPABASE_URL}/rest/v1/ai_models`); url.searchParams.set('select', SELECT); url.searchParams.set('is_hidden', 'eq.false'); url.searchParams.set('is_available', 'eq.true'); url.searchParams.set('order', 'provider.asc,name.asc'); + url.searchParams.set('limit', String(PAGE_SIZE)); const res = await fetch(url, { headers: { @@ -76,8 +79,16 @@ async function main() { const rows = (await res.json()) as Row[]; + if (rows.length === 0) { + throw new Error('No rows returned — check RLS policies or filters.'); + } + if (rows.length >= PAGE_SIZE) { + throw new Error( + `Received ${rows.length} rows — at or above PAGE_SIZE (${PAGE_SIZE}). Snapshot may be truncated; raise PAGE_SIZE or add pagination.`, + ); + } + const snapshot = { - source: `${SUPABASE_URL}/rest/v1/ai_models`, fetched_at: new Date().toISOString(), count: rows.length, models: rows, diff --git a/src/components/ai-models-table.tsx b/src/components/ai-models-table.tsx index 6bdbcc9..11c7440 100644 --- a/src/components/ai-models-table.tsx +++ b/src/components/ai-models-table.tsx @@ -21,7 +21,6 @@ type Model = { }; type Snapshot = { - source: string; fetched_at: string; count: number; models: Model[]; @@ -39,8 +38,12 @@ function formatContext(value: number | null): string { function formatPrice(value: number | null): string { if (value == null) return '—'; const perMtok = value * 1_000_000; + if (perMtok === 0) return '$0'; if (perMtok >= 1) return `$${perMtok.toFixed(2)}`; - return `$${perMtok.toFixed(3).replace(/0+$/, '').replace(/\.$/, '')}`; + if (perMtok >= 0.001) { + return `$${perMtok.toFixed(3).replace(/0+$/, '').replace(/\.$/, '')}`; + } + return `$${perMtok.toExponential(1)}`; } function formatFetched(iso: string): string { @@ -133,7 +136,7 @@ export function AiModelsTable() { />

- Showing {filtered.length} of {DATA.count} models. Snapshot fetched{' '} + Showing {filtered.length} of {DATA.models.length} models. Snapshot fetched{' '} {formatFetched(DATA.fetched_at)}. Pricing is per million tokens.

diff --git a/src/data/ai-models.json b/src/data/ai-models.json index 1ba8e62..0b6fab4 100644 --- a/src/data/ai-models.json +++ b/src/data/ai-models.json @@ -1,5 +1,4 @@ { - "source": "https://enxvgkxsrpbtqlaeotjz.supabase.co/rest/v1/ai_models", "fetched_at": "2026-05-18T21:17:53.304Z", "count": 84, "models": [ From e8fd191b1c12294652167c6bce685967ec965a64 Mon Sep 17 00:00:00 2001 From: Charles Howard <96023061+charlesrhoward@users.noreply.github.com> Date: Mon, 18 May 2026 17:59:02 -0400 Subject: [PATCH 2/2] docs: drop redundant count field from ai-models snapshot The component reads DATA.models.length now, so count was dead data that could silently drift out of sync on manual JSON edits. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/gen-models-table.ts | 1 - src/components/ai-models-table.tsx | 1 - src/data/ai-models.json | 1 - 3 files changed, 3 deletions(-) diff --git a/scripts/gen-models-table.ts b/scripts/gen-models-table.ts index 7e82705..a26340a 100644 --- a/scripts/gen-models-table.ts +++ b/scripts/gen-models-table.ts @@ -90,7 +90,6 @@ async function main() { const snapshot = { fetched_at: new Date().toISOString(), - count: rows.length, models: rows, }; diff --git a/src/components/ai-models-table.tsx b/src/components/ai-models-table.tsx index 11c7440..351acb7 100644 --- a/src/components/ai-models-table.tsx +++ b/src/components/ai-models-table.tsx @@ -22,7 +22,6 @@ type Model = { type Snapshot = { fetched_at: string; - count: number; models: Model[]; }; diff --git a/src/data/ai-models.json b/src/data/ai-models.json index 0b6fab4..96e1363 100644 --- a/src/data/ai-models.json +++ b/src/data/ai-models.json @@ -1,6 +1,5 @@ { "fetched_at": "2026-05-18T21:17:53.304Z", - "count": 84, "models": [ { "id": "alibaba/qwen3-max-thinking",