Skip to content

fix: shorten counts from a thousand, not only above it - #445

Merged
xHeaven merged 1 commit into
dev-null-sh:productionfrom
jubianchi:fix/format-count-threshold
Oct 18, 2026
Merged

xHeaven merged 1 commit into
dev-null-sh:productionfrom
jubianchi:fix/format-count-threshold

Conversation

@jubianchi

Copy link
Copy Markdown
Contributor

formatCount compares with a strict greater-than, so 999 reads 999, 1001 reads 1k, and 1000 alone reads 1000: four characters where the star counts and the aside stats expect at most three (#410).

Fix

Count from a thousand (>=), which gives 1k, as the compact formatter already does for every larger number.

Test

tests/Unit/Numbers.test.ts, written first and failing on the 1000 case (actual: '1000', expected: '1k'), covers both sides of the threshold and a few larger values (1.5k, 10k, 1m, 2.3m). It runs with the existing test:unit script.

Verification

  • node --experimental-strip-types --test tests/Unit/Numbers.test.ts: 2 passed
  • vp fmt --check, vp lint, tsc --noEmit --project tests/tsconfig.json: clean

@jubianchi
jubianchi marked this pull request as ready for review October 18, 2026 14:52
formatCount compared with a strict greater-than, so 999 read 999, 1001 read 1k, and 1000 alone read 1000: four characters where the star counts and the aside stats expect at most three. Counting from a thousand gives 1k, as the compact formatter already does for every larger number.

🤖 Generated with Claude Code
@jubianchi
jubianchi force-pushed the fix/format-count-threshold branch from 20b1ef1 to 02d36a0 Compare October 18, 2026 15:39
@xHeaven
xHeaven merged commit 50b08bb into dev-null-sh:production Oct 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants