Skip to content

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

Merged
gagantrivedi merged 4 commits into
mainfrom
openhands/sdk-spec-v0.7.1
Nov 9, 2026
Merged

gagantrivedi merged 4 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:36
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

This PR was authored by a bot without an assigned CodeRabbit review seat. Ask an organization administrator to assign a seat to the bot. See the seat-assignment guide. After the seat is assigned, request a review again.

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: 7d14bd3d-e643-4d77-ace7-372be12820fe

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

  • 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 (99daf20) with main (faddb16)

Open in CodSpeed

flagsmithsmith Bot and others added 2 commits November 5, 2026 21:57
…osures

Implements the events steps of SDK spec v0.6.0.

- `Flagsmith::getExperimentFlag()` gets an identity's flag and records a
  `$flag_exposure` event for the variant served, when the identity is
  enrolled in a running experiment on the feature.
- `Flagsmith::trackEvent()` and `Flagsmith::trackExposureEvent()` record
  custom and exposure events; `Flagsmith::flushEvents()` sends them now.
- `EventProcessor` buffers events, deduplicates exposures, and posts them
  to the Flagsmith events API on flush, when full, after the flush
  interval, or when destroyed. Events are opt-in via `enableEvents`.
- `Flag` exposes the `variant` and `experiment` the identities API returns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0dad745)
- Reject `withEventProcessor()` on offline instances, as the constructor
  already does for `enableEvents`.
- Remove `EventProcessor`'s unused `$timeout` parameter: PSR-18 has no
  per-request timeout, so document passing a client configured with one.
- Read the SDK version from composer.json once per process.

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

flagsmithsmith Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

The spec job failed because v0.7.1 now runs this SDK's @events scenarios, and the SDK didn't implement the Create the SDK client with events enabled step or the events When steps. The core and local-evaluation scenarios were already passing, including the new empty-string flag value scenarios from v0.7.1.

Changes

  • Re-applied the Experimentation commits (ed02408, 1d36396) on this branch:
    • Flagsmith::getExperimentFlag() gets an identity's flag. When the identity is in a running experiment on that feature, it also records a $flag_exposure event for the variant it was served.
    • Flagsmith::trackEvent() and Flagsmith::trackExposureEvent() record events, and Flagsmith::flushEvents() sends them.
    • EventProcessor buffers and deduplicates events and posts them to the events API. Events are opt-in with enableEvents / eventsApiUrl.
    • Each of these has unit tests.
  • Resolved the conflict in sdk-spec/steps.php by keeping both the local-evaluation client step from main and the new events client step. Between v0.6.0 and v0.7.1 the events features didn't change, so nothing else had to be adapted.

Verification (local)

  • php-cs-fixer: no changes needed.
  • phpunit: 329 tests pass on PHP 8.1.
  • SDK spec v0.7.1 (core or events or local-evaluation) against the spec's compose stack: the SDK implements 8/8 steps, and all 9 scenarios pass.

@flagsmithsmith
flagsmithsmith Bot marked this pull request as ready for review November 5, 2026 22:37
@flagsmithsmith
flagsmithsmith Bot requested a review from a team as a code owner November 5, 2026 22:37
@flagsmithsmith
flagsmithsmith Bot requested review from emyller and removed request for a team November 5, 2026 22:37
@flagsmithsmith flagsmithsmith Bot changed the title feat: Implement SDK spec v0.7.1 feat: Support getExperimentFlag, trackEvent and trackExposure methods Nov 6, 2026
@gagantrivedi
gagantrivedi merged commit 42b3fff into main Nov 9, 2026
10 checks passed
@gagantrivedi
gagantrivedi deleted the openhands/sdk-spec-v0.7.1 branch November 9, 2026 10:55
gagantrivedi pushed a commit that referenced this pull request Nov 9, 2026
🤖 I have created a release *beep* *boop*
---


##
[5.3.0](v5.2.0...v5.3.0)
(2026-11-09)


### Features

* Support `getExperimentFlag`, `trackEvent` and `trackExposure` methods
([#156](#156))
([42b3fff](42b3fff))


### Other

* Let Renovate keep updating spec bumps the webhook handler commits to
([#153](#153))
([faddb16](faddb16))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

2 participants