Product Benefits Pricing Guides Docs About Contact us Try it out
Analytics tools

PostHog Numeric Flag Comparison: Rollout Tracking

PostHog server 2.21.4 compares numeric strings as numbers in local flag evaluation. Track feature flag rollout shifts after the upgrade.

· 3 min read

Feature flags decide who sees what, so a quiet change in how conditions are evaluated can move thousands of users between variants without a single deploy of your own. PostHog’s server-side JVM SDK 2.21.4, released on 20 October, fixes local evaluation of numeric strings. The operators gt, gte, lt and lte now compare finite numbers rather than strings.

String comparison gets numbers wrong in a familiar way: “10” sorts before “9”. A rule such as “app_build is greater than 9” could therefore include or exclude the wrong people. Per the release notes, invalid values no longer match through string comparison, and invalid numeric conditions still fall back to remote evaluation. If your flags target on build numbers, order totals or account sizes stored as text, your audience may change when you upgrade.

Data Points to Track

  • flag_key: the flag being evaluated
  • flag_variant: the variant returned
  • evaluation_mode: local or remote
  • sdk_version: the server SDK version
  • targeting_property_type: number or string
  • property_value_valid: whether the value parsed as a number
  • audience_size: users matched per day
  • exposure_to_goal_rate: conversion for each variant

Setup Steps

  1. Find every flag that uses gt, gte, lt or lte conditions.
  2. Check the stored type of each targeted property.
  3. Record daily audience size for those flags before the upgrade.
  4. Log flag_variant and evaluation_mode on every evaluation, or on a sample.
  5. Upgrade the server SDK to 2.21.4 or later in a staging environment first.
  6. Replay a sample of real users through old and new versions and compare results.
  7. Release to production and watch audience size for a week.
  8. Fix property types at source so numbers are stored as numbers.

Actionable Insights

If audience size moves sharply, the old comparison was likely wrong. Decide whether the new audience is the one you intended.

If remote evaluations rise, you have invalid values that now fall back. Cleaning the data will keep latency down.

If an experiment is running, note the upgrade date on it. A change in who qualifies mid-test can distort results, and you may need to restart the analysis.

Common Pitfalls

Do not assume text and numbers behave alike in targeting rules.

Do not upgrade during an active experiment without recording it.

Do not rely on local evaluation alone. Watch how often remote fallback occurs, since it shows how clean your data is.

Rolling It Out Safely

Keep a list of flags with numeric conditions and an owner for each. Before upgrading, ask each owner what audience they expect. After upgrading, compare that expectation with the real audience size and record any gap. A small review like this takes minutes and prevents long investigations later.

Share the findings with support and sales as well. If a customer suddenly loses access to a feature, they will be the first to notice, and a clear note about what changed saves everyone time. Keep the before and after audience counts with the flag’s documentation so the next owner can see the history.