fix(app): pin locale for formatMinutes so unit (linux) isn't runner-dependent - #237
alltomatos wants to merge 3 commits into
Conversation
…pendent
formatMinutes() called mins.toLocaleString() with no locale, so its
output silently depended on the process's default locale. Every other
formatter on the stats page (numFmt, compactFmt, the session date/time
formatters) already threads through language.intl() explicitly --
formatMinutes was the one holdout.
Its unit test hardcoded the pt-BR-style output ("60.327 min", period as
thousands separator) that this fork's default locale produces locally,
but GitHub's ubuntu-latest runners default to a locale that renders it
as "60,327 min" -- so unit (linux) fails on every PR regardless of what
it touches (confirmed failing on dev's own latest commits too, e.g.
https://github.com/alltomatos/opencode/actions/runs/34911995346).
Now formatMinutes accepts an explicit locale (passed as language.intl()
from stats.tsx, matching the rest of the file), and the test pins
"pt-BR" so it's deterministic on any runner.
Closes #236
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015KrFrdVEmx7apnofWUViJw
…placeholder text) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015KrFrdVEmx7apnofWUViJw
…der text) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015KrFrdVEmx7apnofWUViJw
|
Confirmed this fix works: Generated by Claude Code |
|
Generated by Claude Code |
…ependent `unit (linux)` was red on this PR's head, but not because of anything this PR touches: formatMinutes() called mins.toLocaleString() with no explicit locale, so its output silently depended on the process's default locale. This fork's local/dev environment produces "60.327 min" (period as thousands separator); GitHub's ubuntu-latest runner default locale produces "60,327 min" instead, failing the hardcoded unit test. This is the same root cause already diagnosed and fixed on dev directly by PR #237 (fix/stats-format-minutes-locale, closes #236) — ported verbatim here since #237 hasn't merged yet, so this PR's CI doesn't have to wait on it. Will no-op once dev carries #237. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SHQKcGH7ayRe8UHJ9CAPQJ
…ependent Ports PR #237 into this PR so its own unit(linux) check goes green now instead of waiting on #237 to merge — this is the other base-branch-wide failure on dev (see standing-down comment on this PR), not caused by this PR's own changes. No-ops once dev carries #237. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SHQKcGH7ayRe8UHJ9CAPQJ
Ported from #237. Companion to the stats-controller.ts change.
Ported from #237. Companion to the stats-controller.ts change.
Issue for this PR
Closes #236
Type of change
What does this PR do?
unit (linux)is currently red ondevitself (confirmed on the latest fewdevcommits, e.g. https://github.com/alltomatos/opencode/actions/runs/34911995346/job/104226783370), which blocks CI on every open PR regardless of what it touches — including #234.Root cause:
formatMinutes()inpackages/app/src/pages/stats/stats-controller.tscallsmins.toLocaleString()with no locale argument, so its output silently depends on the process's default locale. Every other numeric/date formatter on the stats page (numFmt,compactFmt, the session date/time formatters) already threads throughlanguage.intl()explicitly —formatMinuteswas the one outlier. Its unit test hardcoded the pt-BR-style output ("60.327 min", period as thousands separator) that this fork's default locale produces locally, but GitHub'subuntu-latestrunners default to a locale that renders it as"60,327 min".Fix:
formatMinutes(ms, locale?)now accepts and forwards an explicit locale.stats.tsx's three call sites now passlanguage.intl(), matching the rest of the file."pt-BR"explicitly instead of relying on the process's default locale, so it's deterministic on any runner.How did you verify your code works?
bun test --conditions=solid --preload ./happydom.ts src/pages/stats/stats-controller.test.ts→ 4 pass, 0 fail (was 1 fail before the fix, reproduced locally by not pinning a locale).tsgo -bonpackages/appshows no new errors from this change (pre-existing errors are all unrelatedghostty-webmodule-resolution failures caused by a sandbox proxy limitation in this environment, not this diff).oxlinton the 3 changed files: 0 errors, pre-existing warnings only.Screenshots / recordings
N/A — output string format only (now correctly locale-aware instead of relying on the runtime default).
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_015KrFrdVEmx7apnofWUViJw
Generated by Claude Code