Skip to content

fix: star count shouldn't round down near the next thousand - #2421

Open
theluckystrike wants to merge 1 commit into
CapSoftware:mainfrom
theluckystrike:fix/cap-payer-proof
Open

theluckystrike wants to merge 1 commit into
CapSoftware:mainfrom
theluckystrike:fix/cap-payer-proof

Conversation

@theluckystrike

@theluckystrike theluckystrike commented Oct 5, 2026 •

Copy link
Copy Markdown

The star count on the site rounds down near the top of each thousand: with 16,960 stars it shows "16k" instead of "17k".

formatStarCount calls (count / 1000).toFixed(1), which gives "17.0" for 16,960. When that string ends in ".0", the old code built the label from Math.floor(count / 1000) instead, which drops the rounding and prints 16. So any count from x,950 to x,999 came out one thousand too low.

The fix keeps the toFixed(1) value and just strips a trailing ".0", so 16,960 becomes "17k" while 16,000 stays "16k". That's it.

Tests: I added apps/web/__tests__/unit/github-star-count.test.ts with 7 assertions (0, 999, 16,420, 16,000, 16,049, 16,960, 19,999). The 16,960 and 19,999 cases fail on main ("16k" and "19k") and pass with this change. biome check is clean on both files.

RetriggerConfidence Score: 5/5

The PR appears safe to merge.

Summary

The PR preserves the rounded value when formatting GitHub star counts and adds tests for the affected boundaries.

  • Counts such as 16,960 now display as “17k” rather than “16k”.
  • No actionable issues were identified.

Reviews (1) · Last reviewed commit: "fix: star count shouldn't round down nea..."

This branch has not been deployed

No deployments
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.

1 participant