Skip to content

✨ FFL-16 Precomputed flags evaluation #3571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

rasendubi
Copy link

@rasendubi rasendubi commented May 26, 2025

Motivation

Precomputed flags evaluation + small fixes on top of #3554.

Changes

  • Precomputed flags evaluation
  • Fetching remote configuration
  • Option to set initial configuration from configuration wire

See individual commits for more details.

Test instructions

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

cc @leoromanovsky

@rasendubi rasendubi requested a review from a team as a code owner May 26, 2025 21:03
@bits-bot
Copy link

bits-bot commented May 26, 2025

CLA assistant check
All committers have signed the CLA.

@rasendubi rasendubi changed the title 👌 FFL-24 Fixes for OpenFeature provider ✨ FFL-16 Precomputed flags evaluation May 27, 2025
@rasendubi rasendubi marked this pull request as draft May 27, 2025 00:25
@leoromanovsky leoromanovsky force-pushed the leo.romanovsky/flagging-sdk-long-running-openfeature-2 branch 2 times, most recently from 862769f to 3078f1b Compare May 27, 2025 21:40
@leoromanovsky leoromanovsky force-pushed the leo.romanovsky/flagging-sdk-long-running-openfeature-2 branch from 3078f1b to 044fd8c Compare May 27, 2025 22:57
leoromanovsky and others added 6 commits May 27, 2025 16:00
OpenFeature recommends relying on web-sdk package instead of core.

The downside is that web-sdk is not side-effect free, so it's better
if we don't depend on StandardResolutionReasons. The good news is that
TypeScript should be able to check literals against enum and using
'DEFAULT' literal is shorter and reduces bundle size a bit.
Remove peer dependencies from `dependencies` list. Also use caret
range, so users are free to select SDK version.
@rasendubi rasendubi changed the base branch from leo.romanovsky/flagging-sdk-long-running-openfeature-2 to main May 28, 2025 11:34
@rasendubi rasendubi marked this pull request as ready for review May 29, 2025 09:58
@rasendubi rasendubi requested a review from a team as a code owner May 29, 2025 09:58
Comment on lines +33 to +50
```typescript
// Initialize RUM with experimental feature flags tracking
import { datadogRum } from '@datadog/browser-rum';

// Initialize Datadog Browser SDK
datadogRum.init({
...
enableExperimentalFeatures: ["feature_flags"],
...
});

// Add OpenFeature hook
OpenFeature.addHooks({
after(_hookContext: HookContext, details: EvaluationDetails<FlagValue>) {
datadogRum.addFeatureFlagEvaluation(details.flagKey, details.value)
}
})
```
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leoromanovsky here's an example of sending of sending flag evaluation to RUM using existing feature flags implementation

*/
clientToken: string

baseUrl: string
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know what's our default base url is, so this option is required for now

Copy link
Contributor

@leoromanovsky leoromanovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for getting your arms around the openfeature spec, it's great to see its semantics coming together. looking forward to building this out with events in the next iteration.

"id": "1",
"data": {
"attributes": {
"createdAt": 1731939805123,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great start

Comment on lines +101 to +106
// type safety: OpenFeature interface requires us to return a
// specific T for *any* value of T (which could be any subtype of
// JsonValue). We can't even theoretically implement it in a
// type-sound way because there's no runtime information passed to
// learn what type the user expects. So it's up to the user to
// makesure they pass the appropriate type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea this is tricky and I am curious as we dogfood it how it "feels"; we'll evolve it to make it easier for our users

/**
* Create configuration from a string created with `configurationToString`.
*/
export function configurationFromString(s: string): Configuration {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who needs classes 😇

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

embracing classless life and tree-shaking 😅

@leoromanovsky
Copy link
Contributor

/trigger-ci

@dd-devflow
Copy link
Contributor

dd-devflow bot commented May 29, 2025

View all feedbacks in Devflow UI.

2025-05-29 11:03:08 UTC ℹ️ Start processing command /trigger-ci
If you need support, contact us on Slack #devflow!


2025-05-29 11:03:10 UTC 🚨 Devflow

cannot get branch ffe-openfeature from github API: unexpected status code: 404 Not Found (Request ID: 98B1:3DAA79:2CB0579:5816422:68383EED)

Details
child workflow execution error (type: devflow.Devflow_TriggerCiFromPr, workflowID: 7539bcd1-4e3c-4544-a06e-7b2a11730c75_26, runID: d6b35766-a5c0-4274-9eb7-07b6b2640b92, initiatedEventID: 26, startedEventID: 27): child workflow execution error (type: devflow.Devflow_TriggerCi, workflowID: d6b35766-a5c0-4274-9eb7-07b6b2640b92_14, runID: 44e135e8-1ad0-4d98-9a66-9e31407050da, initiatedEventID: 14, startedEventID: 15): activity error (type: github.GithubService_GetBranch, scheduledEventID: 8, startedEventID: 9, identity: 1@github-worker-85d7f97cbc-plz2q@): cannot get branch ffe-openfeature from github API: unexpected status code: 404 Not Found (Request ID: 98B1:3DAA79:2CB0579:5816422:68383EED) (type: GitNotFound, retryable: false): unexpected status code: 404 Not Found

If you need support, contact us on Slack #devflow with those details!

@leoromanovsky leoromanovsky marked this pull request as draft May 29, 2025 17:40
@leoromanovsky
Copy link
Contributor

converted to draft because it cannot run CI, branched in #3580

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.

3 participants