Skip to content

feat: Support getExperimentFlag, trackEvent and trackExposure methods - #72

Open
flagsmithsmith[bot] wants to merge 3 commits into
mainfrom
openhands/sdk-spec-v0.7.1
Open

flagsmithsmith[bot] wants to merge 3 commits into
mainfrom
openhands/sdk-spec-v0.7.1

Conversation

@flagsmithsmith

@flagsmithsmith flagsmithsmith Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Contributes to Flagsmith/sdk-spec#13

@flagsmithsmith flagsmithsmith Bot added the sdk-spec Bumps of the Flagsmith SDK behavioural spec label Nov 5, 2026
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 60d3fa05-4ae6-48e1-b447-bd4edc0944a8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codspeed

codspeed Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing openhands/sdk-spec-v0.7.1 (d2d51a5) with main (7bd7fbe)

Open in CodSpeed

@flagsmithsmith
flagsmithsmith Bot marked this pull request as ready for review November 5, 2026 20:18
@flagsmithsmith
flagsmithsmith Bot requested review from a team and khvn26 and removed request for a team November 5, 2026 20:19
@flagsmithsmith
flagsmithsmith Bot marked this pull request as draft November 5, 2026 21:42
@flagsmithsmith flagsmithsmith Bot closed this Nov 5, 2026
@flagsmithsmith flagsmithsmith Bot reopened this Nov 5, 2026
flagsmith-engineering Bot and others added 2 commits November 5, 2026 21:42
Its entry in Flagsmith/sdk-spec's compatibility matrix at v0.7.1: `core or events or local-evaluation`.
Implements SDK spec v0.7.1's `@events` capability:

- `Flagsmith.Client.get_experiment_flag/4` gets an identity's flag and,
  when the identity is enrolled in a running experiment on an enabled
  feature, sends a `$flag_exposure` event valued with the variant served.
- `Flagsmith.Client.track_event/3` and `track_exposure_event/3` send
  events to Flagsmith's events API.
- Events are buffered per environment key by a supervised processor and
  sent in batches on an interval, when the buffer fills, and on shutdown;
  failed batches are kept and retried.
- Flags from the identities API now carry their `variant` and
  `experiment` metadata.
- New options: `enable_events`, `events_api_url` and
  `events_flush_interval_milliseconds`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9caa72a)
@flagsmithsmith

flagsmithsmith Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Re-applied 9caa72a (experiment flags, event and exposure tracking) as d2d51a5. This implements the @events scenarios that the widened tags now run.

The @events features did not change between v0.6.0, which that commit targeted, and v0.7.1. So the SDK behaviour carries over unchanged. Only the conflicts with work merged since then needed to be resolved:

  • sdk-spec/steps.exs: Create the SDK client with events enabled and Create the SDK client with local evaluation are both kept. They share one helper that starts Flagsmith.Supervisor.
  • Flagsmith.Schemas.Features.FeatureState: it now casts variant, and it keeps empty_values: [], so "" flag values (new in v0.7.1) are still kept.
  • Flagsmith.Client: the version/0 refactor is kept, so that events can report sdk_version. It is set to the current release, 2.4.0.

Checked locally: mix format --check-formatted, mix test (412 tests, 0 failures) and mix dialyzer all pass. The spec v0.7.1 run with core or events or local-evaluation passes all 9 scenarios, and the SDK implements 8/8 steps.

This comment was written by an AI agent (OpenHands).

@flagsmithsmith
flagsmithsmith Bot marked this pull request as ready for review November 5, 2026 22:16
@flagsmithsmith
flagsmithsmith Bot requested a review from a team as a code owner November 5, 2026 22:16
@flagsmithsmith flagsmithsmith Bot changed the title feat: Implement SDK spec v0.7.1 feat: Support getExperimentFlag, trackEvent and trackExposure methods Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sdk-spec Bumps of the Flagsmith SDK behavioural spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant