Skip to content

Honor explicit formats for ratio metrics - #426

Merged
nicosuave merged 2 commits into
clickhouse-filter-escapingfrom
ratio-format-precedence
Oct 19, 2026
Merged

nicosuave merged 2 commits into
clickhouse-filter-escapingfrom
ratio-format-precedence

Conversation

@nicosuave

Copy link
Copy Markdown
Member

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T20:32:13.636286Z 9088feb PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread webapp/src/lib/uiCore.js Outdated
// 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#]+))?%?$/);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@nicosuave
nicosuave force-pushed the ratio-format-precedence branch from 8cae344 to b913cde Compare October 19, 2026 21:30
@nicosuave
nicosuave changed the base branch from main to clickhouse-filter-escaping October 19, 2026 21:30
@nicosuave
nicosuave added this pull request to stack #431 October 19, 2026 21:30
@nicosuave
nicosuave merged commit 184cdc3 into main Oct 19, 2026
45 of 46 checks passed
@nicosuave
nicosuave deleted the ratio-format-precedence branch October 19, 2026 22:47
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.

Web UI: ratio metrics always show as percent, format is ignored

1 participant