Skip to content

fix(overview): pin number grouping to en-US so output is locale-indep…#609

Merged
iamtoruk merged 1 commit into
getagentseal:mainfrom
NihalJain:fix/overview-locale-number-grouping
Jul 5, 2026
Merged

fix(overview): pin number grouping to en-US so output is locale-indep…#609
iamtoruk merged 1 commit into
getagentseal:mainfrom
NihalJain:fix/overview-locale-number-grouping

Conversation

@NihalJain

@NihalJain NihalJain commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

…endent

codeburn overview formatted token/call/session counts with a bare toLocaleString(), which groups digits according to the host's locale. On an Indian-locale machine (en-IN) a value like 2,002,000,000 renders as 2,00,20,00,000, so the rendered summary — and its snapshot test — differed by machine. (formatCost already avoided this via an explicit thousands regex.)

Pin formatTokens to 'en-US' and route the remaining count columns through a new formatCount helper that does the same, so the overview output is byte-identical everywhere.

Verify: npm test -- overview (previously failed on non-US locales; the "thousands separators" case now passes regardless of $LANG / ICU default).

Summary

Testing

  • I have tested this locally against real data (not just unit tests)
  • npm test passes
  • npm run build succeeds

For new providers only:

  • I installed the tool and generated real sessions by using it
  • npm run dev -- today shows correct costs and session counts for this provider
  • npm run dev -- models --provider <name> shows correct model names and pricing
  • Screenshot or terminal output attached below proving it works with real data

…endent

`codeburn overview` formatted token/call/session counts with a bare
`toLocaleString()`, which groups digits according to the host's locale. On an
Indian-locale machine (en-IN) a value like 2,002,000,000 renders as
2,00,20,00,000, so the rendered summary — and its snapshot test — differed by
machine. (formatCost already avoided this via an explicit thousands regex.)

Pin `formatTokens` to 'en-US' and route the remaining count columns through a
new `formatCount` helper that does the same, so the overview output is
byte-identical everywhere.

Verify: `npm test -- overview` (previously failed on non-US locales; the
"thousands separators" case now passes regardless of $LANG / ICU default).

@iamtoruk iamtoruk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified: reproduced the failure on main under an en-IN locale (grouping renders 2,00,20,00,000), confirmed this branch fixes it, and re-ran the overview tests after merging current main into the branch locally. All call sites in overview.ts are covered. The same bare toLocaleString() pattern exists in six other files; that sweep is follow-up material, not this PR's scope.

@iamtoruk iamtoruk merged commit 58152ab into getagentseal:main Jul 5, 2026
3 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