Skip to content

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

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

renovate Bot and others added 2 commits November 5, 2026 17:37
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: e48dc113-c436-4799-8e03-5987d75f4f8c

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
⏩ 15 skipped benchmarks1


Comparing openhands/sdk-spec-v0.7.1 (0a6f487) with main (de1d8e8)

Open in CodSpeed

Footnotes

  1. 15 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Implements the experimentation features the SDK spec's `events`
scenarios require, run from SDK spec v0.7.1:

- `enable_events` starts an event processor that buffers events and
  sends them to Flagsmith's events API in batches.
- `get_experiment_flag` resolves a flag for an identity and records a
  `$flag_exposure` when the identity is enrolled in a running experiment.
- `track_event` and `track_exposure_event` record events directly.
- `Flag` exposes the `variant` and `experiment` served by remote
  identity evaluation.

Re-applied from f28b98d on top of
flag dependency evaluation.

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

flagsmithsmith Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

The SDK spec was failing because v0.7.1 runs this SDK's events scenarios: experiment flags, tracking events and exposure events. This SDK had no steps for them. The SDK side was already written in f28b98d, so this re-applies it on top of flag dependency evaluation as 0a6f487.

Changes

  • The client can be configured to send events to Flagsmith's events API (enable_events, events_api_url, flush interval and buffer size). Events are buffered and sent in batches.
  • get_experiment_flag returns an identity's flag. When the identity is in a running experiment, it also records a $flag_exposure event for the variant served.
  • track_event and track_exposure_event record events directly. Names starting with $ are reserved, and an exposure needs an identifier.
  • Flags from remote identity evaluation expose variant and experiment.
  • The spec steps call these SDK methods.

The re-application had two conflicts, in sdk-spec/steps.rs and tests/integration_test.rs. Both sides of each were additions, so I kept both. The commit also needed a HashMap import, which main had removed in the meantime. v0.7.1 also adds empty-string flag values (""). The SDK already handled those, and they passed in the previous CI run.

Checked locally: cargo fmt --check, cargo test --all-features --workspace (34 unit and 37 integration tests), cargo +1.86.0 check, and the v0.7.1 spec for core or events or local-evaluation against its compose stack (9 of 9 passed).

Review effort: 3/5

@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 khvn26 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