From 61f5e7c24fefde149f5c50194d168550a9aa1ce2 Mon Sep 17 00:00:00 2001 From: iamtoruk Date: Mon, 10 Aug 2026 04:46:39 -0700 Subject: [PATCH] fix(tui): floor pricing coverage so 100% means genuinely complete --- src/dashboard.tsx | 6 +++++- tests/workflow-panel.test.ts | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/dashboard.tsx b/src/dashboard.tsx index abf302ca..b8926e78 100644 --- a/src/dashboard.tsx +++ b/src/dashboard.tsx @@ -752,7 +752,11 @@ function formatReworkValue(file: ReworkedFile | null): string { } function formatCoverageValue(coverage: number): string { - return `${Math.round(coverage * 100)}%` + // Floor, never round: 99.6% coverage with unpriced calls outstanding must + // not render as the "100%" the panel reserves for genuinely complete + // pricing (observed live: 107 unpriced calls rendering as 100% while the + // model panel warned about them on the same screen). + return `${Math.floor(coverage * 100)}%` } export type WorkflowRow = { label: string; value: string } diff --git a/tests/workflow-panel.test.ts b/tests/workflow-panel.test.ts index 868a6f3e..9b5460cc 100644 --- a/tests/workflow-panel.test.ts +++ b/tests/workflow-panel.test.ts @@ -34,6 +34,12 @@ describe('buildWorkflowRows', () => { expect(buildWorkflowRows(data({ coverage: 1 }))[3]).toEqual({ label: 'Coverage', value: '100%' }) }) + it('floors near-complete coverage so 100% is reserved for genuinely complete pricing', () => { + // Observed live: 99.59% (107 unpriced calls) rendered as 100% while the + // model panel warned about the unpriced model on the same screen. + expect(buildWorkflowRows(data({ coverage: 0.9959 }))[3]).toEqual({ label: 'Coverage', value: '99%' }) + }) + it('formats the first-edit median as seconds under a minute and whole minutes above', () => { expect(buildWorkflowRows(data({ medianTimeToFirstEditMs: 45_000 }))[1]!.value).toBe('45s') expect(buildWorkflowRows(data({ medianTimeToFirstEditMs: 60_000 }))[1]!.value).toBe('1m')