Skip to content

[core] Two comments still say formatPercent divides by 100 — true until #4590, false after it #4596

Description

@yinlianghui

Observation-class. No runtime behaviour, no failing assertion, nothing a user hits — two prose comments in packages/core/src/utils/** cite formatPercent as the live example of the divide-by-100 route, and that stopped being true when objectui#4590 (PR #4595) landed.

Found while implementing #4590. Not fixed there: packages/core/src/utils/** was outside that card's declared surface — it CONSUMES style: 'percentPoints' rather than editing its home — so this is recorded rather than folded in.

The two sites

packages/core/src/utils/dataset-format.ts, in the formatMeasure percent comment:

Intl's style: 'percent' wants a fraction — so routing through that (the way formatPercent does) would mean dividing by 100 for Intl to multiply straight back

packages/core/src/utils/__tests__/dataset-format.percent-convention.test.ts:40, in the file header:

The obvious way to adopt the locale's convention is Intl's style: 'percent' — the way formatPercent does it — but that style wants a FRACTION

Both were accurate when written. formatPercent now renders through style: 'percentPoints' with no division, so each parenthetical points at a function that no longer does the thing it is being cited for.

Why it is worth a line rather than nothing

The surrounding argument is still correct and still valuable — it is the measured case for why the percentage-points route was chosen, and the tie/extreme pins under it are what keep that route honest. Only the "who does it the other way" example has expired. A reader checking the citation finds the opposite of what it claims, which is the kind of thing that makes a correct comment get distrusted wholesale.

The narrower fix is to change the tense and drop the example: the divide-by-100 route is a real alternative worth arguing against on its own merits, and after #4590 the repo has no caller taking it — which is itself the better sentence.

Not in scope here

The 27,581 / 1,200,013 figure in those comments came from #4576's grid. #4590 re-measured a slightly different grid (0.005 steps to 2,000, precisions 0/1/2 = 1,200,003 forms) and got 27,577. Neither number is wrong; they are different grids. Worth stating the grid alongside the count if these lines are touched anyway, so the two are not read as a discrepancy.


Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions