feat(flags): route split features and share exposure decisions #1291
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 456 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.366
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1291"
general
weight: 0.35
fuzzybinary
What and why?
Precomputed assignments can carry
featuresfor the selected split. Each feature has akey, avalue(string, number or boolean) anddestinations(HOOK,EXPOSURE,EVALUATION). This PR uses them and lets applications record exposures in their own data store, with the same deduplication that the SDK uses for Datadog.featuresleniently. A malformed list or entry is skipped and never fails the flag. On a repeated key, the first valid entry wins. Unknown destinations are kept but ignored, with one warning for each distinct value (64 at most).HOOKfeatures in flag metadata as__dd_feature.<key>. This prefix is the only public metadata contract.EXPOSUREandEVALUATIONfeatures use internal prefixes.EXPOSUREfeatures to exposure events as a flatfeaturesobject. They are not part of the exposure cache entry.EVALUATIONfeatures to the evaluation-count bucket key and to each row.ExposureHookfor OpenFeature. Its callback receives every completed evaluation fromDatadogOpenFeatureProviderwithisExposure,isCacheHit,shouldSend, the flag key, variant, allocation key, targeting key, evaluation context andHOOKfeatures. A failing callback does not affect the evaluation.ExposureHookshare it.trackExposures: false, the SDK sends no exposures, but the exposure cache still records, soExposureHookgets correct decisions.Behaviour changes:
finallyAfterhook, only when the whole evaluation succeeded. Before, it sent the exposure at resolve time, also when a later hook failed.DatadogOpenFeatureProvider.resolve...Valuemethod, outside an OpenFeature client, records no exposure.__dd_metadata keys.DatadogFlagsClient.get...Detailsstill records and sends exposures immediately.EVALUATIONfeatures are attached only to successful evaluation rows; error rows, such as a type mismatch, carry none.How?
The provider registers its own OpenFeature hook. Its
beforestage opens a frame for the evaluation, the provider's resolve method attaches the pending exposure to that frame, and itsfinallyAfterstage records the exposure only when the details have no error code. The verdict is attached to the evaluation details instance, which OpenFeature passes to everyfinallyAfterhook, soExposureHookreads the same verdict.Verified in
openfeature_dart_client_sdk0.0.1: provider hooks run last inbeforeand first inafter,errorandfinallyAfter; a failingbeforeorafterhook replaces the details with error details beforefinallyAfter; exceptions fromfinallyAfterhooks are caught by the SDK. This version has no multi-provider; a provider that wraps this provider without running its hooks records no exposures, as in the Go, browser and Android SDKs.Tests: unit tests for parsing, routing, persistence and warnings, and end-to-end tests with an isolated
OpenFeatureAPIand a mock HTTP client, on the VM and in Chrome. Each new test was checked by breaking the code under test.datadog_flags_flutter(re-exports and README only) was not run locally because Flutter is not installed; CI covers it.Jira: EX-4007
Review checklist