fix(tui): floor pricing coverage so 100% means genuinely complete

This commit is contained in:
iamtoruk 2026-08-10 04:46:39 -07:00
parent f72b8ad11a
commit 61f5e7c24f
2 changed files with 11 additions and 1 deletions

View file

@ -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 }

View file

@ -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')