Skip to content

fix(openfeature-web): reject blank numeric flag variants - #5621

Open
peterolkhov wants to merge 1 commit into
PostHog:mainfrom
peterolkhov:codex/reject-blank-openfeature-number-variants
Open

peterolkhov wants to merge 1 commit into
PostHog:mainfrom
peterolkhov:codex/reject-blank-openfeature-number-variants

Conversation

@peterolkhov

@peterolkhov peterolkhov commented Nov 8, 2026 •

Copy link
Copy Markdown

Problem

A blank variant becomes 0 through Number(variant), so getNumberDetails('flag', 42) silently returns zero instead of the caller's default. The Node provider already rejects blank variants; its original PR explicitly left the web equivalent for a follow-up.

Changes

Match the Node guard in the web provider. Empty and whitespace-only variants now produce TYPE_MISMATCH, letting OpenFeature return the caller's default; valid numeric variants, including '0', keep working. Added provider-level cases and regressions through the real OpenFeature client, plus a patch changeset.

Validation on Node 24.13.0:

  • Before the guard: 5 new cases failed and 28 passed. Afterward: all 33 package tests passed.
  • pnpm turbo run test:unit check-types lint build --filter=@posthog/openfeature-web-provider --concurrency=2 passed, including prerequisite builds.
  • Root pnpm format, pnpm lint:oxlint, pnpm lint:playground, changeset status, and git diff --check passed.

The full monorepo build, type-check, and test matrices were not run; dependency installation was limited to the provider's workspace graph and root tools.

Release info Sub-libraries affected

Libraries affected

  • All of them
  • posthog-js (web)
  • posthog-js-lite (web lite)
  • posthog-node
  • posthog-react-native
  • @posthog/react-native-plugin
  • @posthog/react
  • @posthog/ai
  • @posthog/convex
  • @posthog/next
  • @posthog/nextjs-config
  • @posthog/nuxt
  • @posthog/openfeature-node-provider
  • @posthog/openfeature-web-provider
  • @posthog/rollup-plugin
  • @posthog/webpack-plugin
  • @posthog/types
  • @posthog/browser-common

Checklist

  • All commits are signed
  • Tests for new code
  • Accounted for the impact of any changes across different platforms
  • Accounted for backwards compatibility of any changes (no breaking changes!)
  • Took care not to unnecessarily increase the bundle size
  • Human review completed (required for agent-authored PRs)

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted). Peter Olkhovets (@peterolkhov) directed the contribution and is the DRI.

Prepared with Codex using GPT-6.1 Sol at high reasoning, shell/GitHub CLI for source and PR inspection, and pnpm/Vitest/Oxfmt for local validation. Session: local Codex session, not publicly shared.

The existing Node guard and the deferred web follow-up established the intended behavior. The change stays in the numeric adapter; it adds no public options, dependencies, or broader parsing rules. Human review is still required before merge.

DRI: @peterolkhov. Repository permissions prevent this account from setting its own assignee; a maintainer will need to set the assignment.

@peterolkhov
peterolkhov requested a review from a team as a code owner November 8, 2026 18:19

This branch has not been deployed

No deployments
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.

1 participant