Skip to content

Conversation

astandrik
Copy link
Collaborator

@astandrik astandrik commented Sep 29, 2025

Closes #2938

Stand


Note

Adjusts formatPercent to round as a number and pass numeric value to configuredNumeral, fixing locale issues (e.g., ru) and handling very small numbers.

  • Data formatting:
    • src/utils/dataFormatters/dataFormatters.ts:
      • Update formatPercent to round using Number(value.toFixed(precision)) and pass a numeric value to configuredNumeral.
      • Preserves 0.[00]% format while improving handling of very small numbers and locale-specific decimal separators.

Written by Cursor Bugbot for commit 38c83be. This will update automatically on new commits. Configure here.

Greptile Overview

Updated On: 2025-09-29 22:02:10 UTC

Summary

This PR fixes a locale-specific formatting issue in the formatPercent function where percentages were incorrectly formatted for the Russian locale. The root cause was passing string values to configuredNumeral which caused issues with decimal separator parsing in non-English locales.

Key Changes:

  • Modified formatPercent to pass numeric values instead of strings to configuredNumeral
  • Simplified the logic by combining rounding and number conversion into a single step
  • Preserved the existing behavior for handling very small numbers (e.g., 2e-27 from backend)
  • Maintains the 0.[00]% format while ensuring proper locale handling

Technical Impact:
The fix ensures that percentage values display correctly across all supported locales, particularly Russian, where decimal separators differ from English conventions. This change affects any UI component that displays percentage values in the YDB Embedded UI.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a focused bug fix that addresses a specific locale formatting issue. The logic is simplified and improved, maintaining backward compatibility while fixing the underlying problem. The change only affects the formatPercent function and doesn't introduce any new dependencies or breaking changes.
  • No files require special attention

Important Files Changed

File Analysis

Filename        Score        Overview
src/utils/dataFormatters/dataFormatters.ts 5/5 Fixed formatPercent function to pass numeric values to configuredNumeral instead of strings, resolving Russian locale decimal separator issues

Sequence Diagram

sequenceDiagram
    participant C as Client Code
    participant FP as formatPercent
    participant CN as configuredNumeral
    participant NL as Numeral Library
    
    Note over C,NL: Before Fix
    C->>FP: formatPercent(0.001234)
    FP->>FP: Number(0.001234).toFixed(2) → "0.00"
    FP->>CN: configuredNumeral("0.00")
    CN->>NL: numeral("0.00") with ru locale
    Note over NL: String parsing with ru locale<br/>may misinterpret decimal separator
    NL-->>CN: Potential parsing issues
    CN-->>FP: Incorrectly formatted result
    FP-->>C: Wrong percentage format
    
    Note over C,NL: After Fix
    C->>FP: formatPercent(0.001234)
    FP->>FP: Number(0.001234).toFixed(2) → "0.00"
    FP->>FP: Number("0.00") → 0.00
    FP->>CN: configuredNumeral(0.00)
    CN->>NL: numeral(0.00) with ru locale
    Note over NL: Numeric input avoids<br/>locale decimal separator issues
    NL-->>CN: Correctly parsed number
    CN-->>FP: Properly formatted result
    FP-->>C: Correct "0.00%" format
Loading

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
378 373 0 3 2
Test Changes Summary ⏭️2

⏭️ Skipped Tests (2)

  1. Scroll to row, get shareable link, navigate to URL and verify row is scrolled into view (tenant/diagnostics/tabs/queries.test.ts)
  2. Copy result button copies to clipboard (tenant/queryEditor/queryEditor.test.ts)

Bundle Size: ✅

Current: 85.61 MB | Main: 85.61 MB
Diff: +0.00 KB (0.00%)

✅ Bundle size unchanged.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.

@astandrik
Copy link
Collaborator Author

bugbot run

Copilot

This comment was marked as resolved.

cursor[bot]

This comment was marked as resolved.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@astandrik astandrik added this pull request to the merge queue Sep 30, 2025
Merged via the queue into main with commit eda8c5a Sep 30, 2025
14 checks passed
@astandrik astandrik deleted the astandrik.2938 branch September 30, 2025 09:29
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.

fix: percents incorrectly formatted for locale ru
2 participants