Skip to content

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

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

flagsmithsmith[bot] wants to merge 5 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

renovate Bot and others added 2 commits November 5, 2026 17:35
Its entry in Flagsmith/sdk-spec's compatibility matrix at v0.7.1: `core or events or local-evaluation`.
@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: 759bb407-d3c1-4286-8247-bcacb5b7dbe3

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

✅ 15 untouched benchmarks


Comparing openhands/sdk-spec-v0.7.1 (795dff1) with main (a6ccd7f)

Open in CodSpeed

flagsmithsmith Bot and others added 3 commits November 5, 2026 20:11
Implements SDK spec v0.6.0's getExperimentFlag, trackEvent and
trackExposureEvent. With `enable_events: true`, the client buffers events
and sends them in batches to the Flagsmith events API (`events_api_url`).
`get_experiment_flag` records an identity's exposure to the variant it was
served when it is in the feature's running experiment, which flags now
expose as `variant` and `experiment`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 3ec4437)
A slow or failing events API request held the flush lock while every
further event past the buffer limit started another flush thread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 2526c08)
- Stop running event processors at exit from one registry that a
  stopped processor leaves, instead of an at_exit block per start that
  kept every processor in memory.
- Drop the identifier from the duplicate exposure debug log.
- Give the accurate reason when get_experiment_flag skips an exposure
  because flags come from the environment document, which carries no
  experiment data.

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

flagsmithsmith Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

The spec run was red because v0.7.1's compatibility matrix adds the events capability for this SDK, and the SDK had no event tracking: the 5 @events scenarios failed on the missing Create the SDK client with events enabled step. The other v0.7.1 change, empty-string flag values, already passed.

I re-applied the earlier event tracking work:

  • 7489c5e (from 793e104) adds enable_events / events_api_url, track_event, track_exposure_event and get_experiment_flag. Exposures are recorded when the identity is in the feature's running experiment, and flags now carry variant and experiment. Events are buffered and sent in batches to the events API.
  • a59d16e (from 34bf7c5) schedules at most one flush when the event buffer is full.
  • 795dff1 (from 4751d17) releases stopped event processors and keeps identifiers out of logs.

The only conflict was in sdk-spec/steps.rb. Since that work was written, main gained create_client_with_local_evaluation. I kept it next to the new create_client_with_events. The steps only call the SDK.

Checks run locally:

  • bundle exec rubocop: no offences.
  • bundle exec rspec spec: 430 examples, 0 failures.
  • The v0.7.1 spec with core or events or local-evaluation: 9 passed, three runs in a row on an isolated stack.

@flagsmithsmith
flagsmithsmith Bot marked this pull request as ready for review November 5, 2026 21:02
@flagsmithsmith
flagsmithsmith Bot requested a review from a team as a code owner November 5, 2026 21:02
@flagsmithsmith
flagsmithsmith Bot requested review from emyller and removed request for a team November 5, 2026 21:02
@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