Skip to content

timeline digest: a count between 999,950 and 999,999 prints 1000.0k instead of 1.0M #1779

Closed

Description

@HugoXK

Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment on this issue.

Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: 230b9b109d8245c98ab30b5e032834bd
Branch: dev/2-digest-count-rollover
Base: 92a4cf2
At: 2026-10-30T05:07:00Z

Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment.

Written-by: FlyBot Lead

What a person sees

plugins/timeline's run report prints counts with formatCount. Any count in 999,950–999,999 prints as 1000.0k instead of 1.0M: 999.9k, then 1000.0k, then 1.0M one step later. The unit prints a number it cannot hold, so a Bot's token line can read 1000.0k in.

Where

plugins/timeline/src/digest.js:17 — if (n >= K) return ${(n / K).toFixed(1)}k``. The unit is chosen from the raw value and then rounded inside it, so the rounding carries past the unit's own ceiling.

Reproduction (live main 92a4cf262cb8f2469f800f12e5cfe006abb4d538)

node --input-type=module -e "import {formatCount} from './plugins/timeline/src/digest.js'; console.log(formatCount(999949), formatCount(999950), formatCount(999999), formatCount(1000000))"
# 999.9k 1000.0k 1000.0k 1.0M

Expected

1.0M for 999,950–999,999 — round once, then carry into the next unit, exactly what formatMs already does a few lines below (plugins/timeline/src/digest.js:22-30, comment cites #761 for the same class: 60s, 1h60m).

Scope

formatCount only — decide the k result after rounding and switch to M when it reaches 1000 (~4 lines), plus one case in plugins/timeline/test/digest.test.js covering 999_949 / 999_950 / 999_999 / 1_000_000, plus a changelog.d/ fragment. No patches/ file, no generate — plugins/ is outside the patch chain.

Dedupe (searched on 2026-10-30, open + closed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions