Skip to content

fix: locale-dependent number/currency formatting.#20

Open
bmerkle wants to merge 1 commit intoAgentEvalHQ:mainfrom
bmerkle:fix-locale
Open

fix: locale-dependent number/currency formatting.#20
bmerkle wants to merge 1 commit intoAgentEvalHQ:mainfrom
bmerkle:fix-locale

Conversation

@bmerkle
Copy link
Copy Markdown

@bmerkle bmerkle commented Mar 5, 2026

  • The system locale uses e.g. , as decimal separator instead of .
  • fixed all affected classes/locations which e.g. produced 0.95 instead of 0,95 on comma-locale systems.

Description

locale specific settings where not handeled

Motivation and Context

need for running also in other countries

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

How Has This Been Tested?

  • Existing unit tests pass
  • Added new unit tests
  • Tested manually (describe below)

Test Configuration:

  • .NET version(s):
  • OS:

Test Details:
test run

Checklist

  • My code follows the code style of this project
  • I have added XML documentation for new public APIs
  • I have updated the documentation (if applicable)
  • I have added tests to cover my changes
  • All new and existing tests pass
  • My changes generate no new compiler warnings
  • I have checked for breaking changes
  • I agree that my contributions are licensed under the MIT License and I have the right to submit this work (see CONTRIBUTING.md)

Screenshots (if applicable)

Additional Notes

Breaking Changes

- The system locale uses e.g. , as decimal separator instead of .
- fixed all affected classes/locations which e.g. produced 0.95 instead of 0,95 on comma-locale systems.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

{
var statusIcon = !call.HasError ? "✓" : "✗";
var duration = call.Duration?.TotalMilliseconds.ToString("F0") + "ms" ?? "?ms";
var duration = call.Duration?.TotalMilliseconds.ToString("F0", CultureInfo.InvariantCulture) + "ms" ?? "?ms";
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

call.Duration?.TotalMilliseconds.ToString("F0", CultureInfo.InvariantCulture) is operating on a nullable (double?) and will not bind to the formatted ToString overload. Additionally, the + "ms" ?? "?ms" expression will never hit the ?? branch because string concatenation yields a non-null string even when the left side is null. Consider formatting via an explicit null check (e.g., use call.Duration is TimeSpan d / call.Duration.HasValue) so null durations render as ?ms and non-null values are formatted with InvariantCulture.

Suggested change
var duration = call.Duration?.TotalMilliseconds.ToString("F0", CultureInfo.InvariantCulture) + "ms" ?? "?ms";
var duration = call.Duration is TimeSpan d
? d.TotalMilliseconds.ToString("F0", CultureInfo.InvariantCulture) + "ms"
: "?ms";

Copilot uses AI. Check for mistakes.
Comment on lines 53 to +55
sb.AppendLine($"**Status:** {statusEmoji} {statusText}");
sb.AppendLine($"**Score:** {report.OverallScore:F1}/100");
sb.AppendLine($"**Tests:** {report.PassedTests}/{report.TotalTests} passed ({report.PassRate:F0}%)");
sb.AppendLine(string.Create(CultureInfo.InvariantCulture, $"**Score:** {report.OverallScore:F1}/100"));
sb.AppendLine(string.Create(CultureInfo.InvariantCulture, $"**Tests:** {report.PassedTests}/{report.TotalTests} passed ({report.PassRate:F0}%)"));
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

PR description says comma-locale systems should display values like 0,95 (comma decimal separator), but the changes consistently force CultureInfo.InvariantCulture, which will output 0.95. Please clarify the intended behavior: either (a) update the PR description to reflect a goal of culture-invariant (dot) formatting for stable exports/logs, or (b) switch these user-facing strings to CultureInfo.CurrentCulture / CurrentUICulture where localized formatting is desired.

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +55
sb.AppendLine(string.Create(CultureInfo.InvariantCulture, $"**Score:** {report.OverallScore:F1}/100"));
sb.AppendLine(string.Create(CultureInfo.InvariantCulture, $"**Tests:** {report.PassedTests}/{report.TotalTests} passed ({report.PassRate:F0}%)"));
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

These changes aim to make formatting culture-stable, but the existing exporter tests don’t appear to validate behavior under a non-dot decimal culture (e.g., de-DE). Consider adding a unit test that temporarily sets CultureInfo.CurrentCulture / CurrentUICulture to a comma-decimal locale and asserts the exported markdown still matches the intended format, to prevent regressions.

Copilot uses AI. Check for mistakes.
@joslat
Copy link
Copy Markdown
Collaborator

joslat commented Mar 31, 2026

@copilot review again the PR code - is this still relevant? (I just merged a lot of code... so re-review everything)

@joslat joslat self-assigned this Mar 31, 2026
@joslat
Copy link
Copy Markdown
Collaborator

joslat commented Mar 31, 2026

@copilot apply changes based on the comments in this thread

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.

3 participants