diff --git a/packages/dashboard/app/components/command-center/areas/__tests__/areas.test.tsx b/packages/dashboard/app/components/command-center/areas/__tests__/areas.test.tsx index 019f0b4b19..90f22472b2 100644 --- a/packages/dashboard/app/components/command-center/areas/__tests__/areas.test.tsx +++ b/packages/dashboard/app/components/command-center/areas/__tests__/areas.test.tsx @@ -86,6 +86,8 @@ describe("Command Center cost formatting", () => { expect(formatCost(12.5, false)).toBe("$12.50"); expect(formatCost(0, false)).toBe("$0.00"); expect(formatCost(0, true)).toBe("—"); + expect(formatCost(0.004, true)).toBe("—"); + expect(formatCost(0.01, true)).toBe("$0.01+"); expect(formatCost(null, true)).toBe("—"); }); }); diff --git a/packages/dashboard/app/components/command-center/areas/areaShared.ts b/packages/dashboard/app/components/command-center/areas/areaShared.ts index 44b721029a..6a16da8049 100644 --- a/packages/dashboard/app/components/command-center/areas/areaShared.ts +++ b/packages/dashboard/app/components/command-center/areas/areaShared.ts @@ -53,9 +53,12 @@ export function formatDurationMs(ms: number | null): string { * * FNXC:CommandCenterCost 2026-07-10-23:35: * A zero subtotal is exact only when every contribution is priced. Mixed pricing with a zero known subtotal must remain `—`, because `$0.00+` suggests a meaningful lower bound while all positive cost may belong to unpriced usage. + * + * FNXC:CommandCenterCost 2026-07-10-23:39: + * Apply the mixed-zero rule at displayed cent precision so a positive sub-cent subtotal cannot leak through as `$0.00+`. A partial subtotal becomes meaningful only when it rounds to at least one visible cent. */ export function formatCost(usd: number | null, unavailable: boolean): string { - if (usd === null || !Number.isFinite(usd) || (unavailable && usd === 0)) { + if (usd === null || !Number.isFinite(usd) || (unavailable && Math.round(usd * 100) === 0)) { return "—"; } const formatted = `$${usd.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;