-
Notifications
You must be signed in to change notification settings - Fork 3
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
FF-3753 feat(dart): Dart SDK #197
base: main
Are you sure you want to change the base?
Conversation
Copied flutter_rust_bridge minimal example[1] and beat it into working: - vendored simple_build.dart to remove dependency on an unpublished git-only package - updated packages because I couldn't get dart test to work otherwise - stripped flutter_rust_bridge internal options [1]: https://github.com/fzyzcjy/flutter_rust_bridge/tree/05247dd90a7fcb2512c5ede13cf00271b0eb548e/frb_example/dart_minimal
🦋 Changeset detectedLatest commit: 0fd3594 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Dropping `BackgroundRuntime` cancels all tracked tasks. This may (and have) lead to hard to debug issues when configuration poller just stops working and `.wait_for_configuration()` unhelpfully returns `PollerThreadPanicked`. (I am a little embarrassed to say how long this simple issue took me to debug when it was paired with running in Dart environment.)
I'm going to work on adding documentation next but this is now ready for review 🎉 |
await this._core!.waitForInitialization(); | ||
} | ||
|
||
String stringAssignment(String flagKey, Subject subject, String defaultValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to note that this is a different signature than usual, with a subject instead of subjectId and subjectAttributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the ask for review leaked slightly earlier than I expected, so I didn't have the time to annotate all the interesting parts 🙂
For the difference here: I hate Attributes
/ContextAttributes
distinction in other SDKs, so I tried to experiment with it. This change makes signature uniform for both assignments and bandits.
Bandit signature for comparison (no ContextAttributes
!):
EvaluationResult<String> banditAction(
String flagKey,
Subject subject,
Map<String, Attributes> actions,
String defaultVariation)
and example usage in Dart (from test):
final bandit = client.banditAction(
'banner_bandit_flag',
Subject('alice')
..numberAttribute('age', 25)
..stringAttribute('country', 'USA')
..stringAttribute('genderIdentity', 'female'),
{
'nike': Attributes()
..numberAttribute('brand_affinity', 1.0)
..stringAttribute('loyalty_tier', 'gold')
..boolAttribute('purchased_last_30_days', true),
},
'control',
);
That seems to work better for typed languages that don't allow mixing strings and numbers in the same container. I like it but curious what other think.
@@ -101,6 +101,7 @@ impl BackgroundRuntime { | |||
|
|||
/// Command background activities to stop and exit. | |||
pub(crate) fn stop(&self) { | |||
log::debug!(target: "eppo", "stopping background runtime"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intend to keep this debug here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely: 5353290
I've spent a couple of days debugging why poller mysteriously crashes (spoiler: it was just background runtime silently stopping). That log line would cut the debugging to one minute 🙈
As a first-time Dart user, this looks very clean and insightful! Will be prudent and have a second pair of eyes approve |
No description provided.