Skip to content

feat(all): tag OpenFeature exposures with $openfeature_provider (SDK-448) - #107

Open
ketanmixpanel wants to merge 1 commit into
masterfrom
ketanshikhare-sdk-448-openfeature-provider-marker
Open

ketanmixpanel wants to merge 1 commit into
masterfrom
ketanshikhare-sdk-448-openfeature-provider-marker

Conversation

@ketanmixpanel

Copy link
Copy Markdown
Contributor

Summary

SDK-448: $experiment_started exposures fired through the Mixpanel OpenFeature provider now include "$openfeature_provider": true, so OpenFeature usage can be told apart from direct SDK flag calls. Direct SDK calls are unchanged (no property).

No public API change: no new public methods, parameters or fields. The provider signals the SDK through an argument it already passes on every evaluation.

How

  • Provider: adds "$openfeature_provider": true to the evaluation context it already passes to getVariant, set after the customer attributes so a same-named attribute cannot override it.
  • SDK: the exposure-tracking code (which already receives the context to read distinct_id) copies the marker onto $experiment_started when the context value is exactly true. Covers local and remote evaluation.
  • Local evaluation is unaffected: it only reads the flag assignment key, distinct_id and custom_properties.

Testing

  • New SDK tests (local and remote): marker present tags the exposure, absent does not. The protected trackExposure signature is unchanged.
  • New provider tests: marker reaches getVariant, cannot be overridden by a customer attribute, and is set for a null context.
  • mvn test (SDK): 396, 0 failures. cd openfeature-provider && mvn test: 38, 0 failures.
  • Also verified the provider against the local SDK (throwaway version installed to ~/.m2, removed afterwards), including an end-to-end test with a real RemoteFlagsProvider: 39/39.

Note: marker is sent to the server on remote evaluation

Because the marker lives in the evaluation context, remote evaluation sends it to /flags with the rest of the context. The flags API accepts and ignores it (checked in analytics/go/src/mixpanel.com/flags/api/handlers/evaluatefeatureflags.go):

  • request validation only type-checks distinct_id and device_id;
  • evaluation only reads the assignment key, distinct_id/device_id, custom_properties and hierarchical group IDs;
  • logRequest does not log it.

So it has no effect on targeting, rollout or variant assignment; it is only visible in the GET context query parameter.

Release order

Older SDKs ignore the marker, so the provider change is safe on its own (no errors; the property just does not appear). The property appears once customers run an SDK release containing this change; the provider minimum SDK version was intentionally not bumped here and should be raised after the SDK release. No version or changelog edits.

🤖 Generated with Claude Code

Exposures fired through the Mixpanel OpenFeature provider now include
"$openfeature_provider": true so they can be told apart from direct SDK
flag calls. Direct SDK calls are unchanged. No public API change: the
provider signals the SDK through an argument it already passes on every
evaluation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 12, 2026

Copy link
Copy Markdown

SDK-448

@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Reviews (1) · Last reviewed commit: "feat: tag OpenFeature exposures with $op..." · Reviewed by Greptile

@ketanmixpanel ketanmixpanel changed the title feat: tag OpenFeature exposures with $openfeature_provider (SDK-448) feat(all): tag OpenFeature exposures with $openfeature_provider (SDK-448) Nov 12, 2026
@ketanmixpanel
ketanmixpanel marked this pull request as ready for review November 13, 2026 08:55
@ketanmixpanel
ketanmixpanel requested review from a team and rahul-mixpanel November 13, 2026 08:55

@rahul-mixpanel rahul-mixpanel 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.

Reviewed against the SDK-448 design. Looks good: convertContext sets the marker after customer attributes (tested, including a null context), and addOpenFeatureProviderProperty uses Boolean.TRUE.equals, applied on both local and remote exposure paths. Local targeting is unaffected (runtime rules read custom_properties); remote sends the marker in context, which the server ignores.

  1. Follow-up: the provider pom.xml pins mixpanel-java to 1.10.0. Maven picks the version nearest in the dependency tree, so customers who only add the provider stay on 1.10.0 and won't get the tag. Raise this after the SDK release.
  2. Nit – test gap: the remote tests check that the property is added, but not that it's absent for direct calls; the local tests cover both.
  3. Behaviour change (fine): a null evaluation context now yields {"$openfeature_provider": true} instead of an empty map. No distinct_id means no exposure.

Cross-SDK notes:

  • Dedup trade-off: in apps using both direct calls and the provider, the marker undercounts provider exposures (whichever path evaluates a flag first after a fetch wins). Worth recording on SDK-448 / in docs for whoever analyses this property, not only in the PR body.
  • Testing: provider tests mock the SDK; the real provider ↔ SDK contract was only verified manually. An end-to-end test would protect it.

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.

2 participants