fix: round compact stat badges to nearest instead of truncating#81
Conversation
f20fc8b to
426de5e
Compare
|
Codex review: needs maintainer review before merge. Reviewed June 13, 2026, 5:06 AM ET / 09:06 UTC. Summary Reproducibility: yes. Current-main source uses integer division in the affected formatter ranges, which deterministically truncates examples such as 10,500 to Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Merge the centralized formatter rounding fix with its boundary tests once maintainers are satisfied with exact-head CI and review state. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source uses integer division in the affected formatter ranges, which deterministically truncates examples such as 10,500 to Is this the best way to solve the issue? Yes. Updating the shared formatter with overflow-safe nearest rounding and boundary tests is the narrow maintainable fix, rather than changing individual badge call sites. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ce87b832a3de. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
426de5e to
d6a73d5
Compare
d6a73d5 to
2c17efc
Compare
|
Addressed the review's two rank-up moves on
On real-behavior proof: |
|
Maintainer verification on exact head
Recommendation: land after exact-head CI is green. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|

Summary
StatValueFormatter.compactrounded counts below 10K, but its 10K-1M and 10M-1B branches used integer division and therefore truncated. This patch applies nearest-value rounding consistently, carries 999,500 to1M, preserves the existing999Mcap, and uses remainder-based arithmetic soInt.maxcannot overflow.The shared formatter covers compact issue, pull request, star, fork, comment, and release download badges.
Tests
Adds seven
StatValueFormatterTestscases covering pass-through values, sub-10K decimals, thousand and million rounding, carry into millions, the oversized cap, andInt.maxoverflow safety.Verification
596f438viapnpm restartfrom this repository checkout.steipete/CodexBar: 14,711 stars. The built RepoBar menu rendered15K; the previous truncating branch would render14K.pnpm check: SwiftFormat clean, SwiftLint clean, 598 tests across 101 suites passed.Risk
Low. The change is isolated to the shared compact-number formatter, has boundary regression coverage, and is reproduced in the exact built macOS app.