Repository navigation
Honor explicit formats for ratio metrics - #426
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9088feb961
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Explicit display hints override the legacy percentage default for ratios. | ||
| const percent = options.style === "percent" || format.includes("%") || format.includes("percent") || format.includes("pct") | ||
| || (!format && !options.style && !options.currency && options.type === "ratio"); | ||
| const decimalPattern = format.match(/^[^0#]*[0#,]+(?:\.([0#]+))?%?$/); |
There was a problem hiding this comment.
Accept escaped percent markers when parsing precision
When a format originates from LookML, percent signs are commonly preserved as escaped strings such as 0.00\% (for example, tests/fixtures/lookml/edge_cases_liquid.lkml:230). The percent check recognizes this string, but decimalPattern rejects the backslash and falls back to one fractional digit, so 0.1234 renders as 12.3% rather than the explicitly requested 12.34%. Normalize the escaped marker or allow \% in the pattern before deriving precision.
Useful? React with 👍 / 👎.
8cae344 to
b913cde
Compare
Ratio metrics now honor explicit numeric, currency, and percentage formats before falling back to percentage display. Numeric formats keep their decimal precision in regular and compact labels, so ARPU, ARPPU, and average order value no longer acquire a percent sign.
Expose named formats through Python and Rust describe metadata and use them when no explicit format is supplied. Includes regression coverage and rebuilt embedded UI bundles.
Fixes #419.