You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: consume dependent precomputed assignments in browser - #458
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Spreading hookContext can re-trigger a throwing enumerable getter despite earlier error handling, preventing dependency callbacks from being delivered.
Adds browser support for precomputed dependent-flag assignments, complementing the Node producer and building on the evaluator failure semantics from #453.
Changes:
Parses separate assignment and error maps, preserving caller defaults for failed roots.
Authenticates encrypted prerequisite references and resolves their assignments.
Propagates selected prerequisites to exposure hooks and RUM, with ordered evaluation telemetry and regression coverage.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
An ERROR dependency assignment is reconstructed as a selection without an error code, allowing a successful root evaluation to emit exposure and RUM enrichment for a failed prerequisite.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Reject ERROR assignments during dependency reconstruction
A top-level assignment with reason: 'ERROR' passes wire validation and is reconstructed here as a selected dependency with a variant but no error code. When the root succeeds, the browser can emit an exposure and RUM enrichment for that failed prerequisite. Reject ERROR assignments here and return dependency PARSE_ERROR details, as for missing or quarantined assignments.
🤖 Comment from Claude working with Aaron Silverman:
[P1] Carry-over from #453. When #453 was rebuilt from main, its threads about the precomputed path were resolved as belonging to this work. I checked them against this PR's head (62219ff):
Capability transport (still open).packages/browser/src/transport/fetchConfiguration.ts:146 sends dependent-flag-variant-key-v1 only in X-DD-FEATURE-FLAGS-CAPABILITIES, and omits that header by default when flaggingProxy is set (callers can supply it through customHeaders). The suggestion in this thread applies unchanged: add cap_dependent-flags-variant-key=v1 to the precompute request URL, with or without flaggingProxy, and remove the token from the header list.
Contract before advertising (partly open). The response shape now matches Add precomputed dependent flag fixture ffe-system-test-data#62 (dependencyEvaluations plus flagEvaluationErrors), and the consumer uses dependency-key-encryption.ts to decrypt dependency keys in obfuscated responses. That addresses the obfuscation point in this thread. The design document still uses reachedPrerequisiteKeys, and the fixture schema does not yet enforce the success and error forms of a dependency entry. The flagSelection point is still open: the flag-selection spec does not say whether the producer keeps a prerequisite that is outside the selection. packages/core/src/configuration/flag-key-obfuscation.ts:12 advertises support before Add precomputed dependent flag fixture ffe-system-test-data#62 merges.
Fixture pin (reminder). The fixture gitlink stays at c8cc8da, so precomputed-corpus.spec.ts does not run the dependent precomputed corpus in CI. The description explains why. Please repin after Add precomputed dependent flag fixture ffe-system-test-data#62 merges.
Measured from the Vite production output after installing packed @datadog/flagging-core and @datadog/openfeature-browser tarballs.
Both scenarios initialize an OpenFeature provider, evaluate a boolean flag, change context, and evaluate again. Telemetry is disabled for DatadogProvider; no tracking hooks are registered for DatadogCoreProvider. DatadogProvider fetches precomputed assignments for each context; DatadogCoreProvider receives rules from fetchRulesConfiguration once and evaluates locally.
Sizes include OpenFeature and the same small scenario harness. Configuration responses are supplied by Playwright and are not bundled. These are complete scenario JS sizes, not configuration payload sizes or isolated provider/Protobuf costs; the difference between rows is not a decoder-only delta.
Scenario
HTML
JS Assets
Raw JS
Gzip JS
Protobuf Markers
DatadogProvider (precomputed fetching)
provider.html
15
122.7 KiB
44.1 KiB
no
DatadogCoreProvider + fetchRulesConfiguration
core-provider.html
15
222.4 KiB
71.6 KiB
yes
Dependency checks passed: no Protobuf markers in default/precomputed scenarios; markers present in rules-based scenarios.
OpenFeature Browser Tracking Hook Bundle Sizes
Synthetic entrypoints import and call tracking hook factories from the packed @datadog/openfeature-browser/rules-based ESM package. Deltas are measured against the no-hook baseline from the same Vite production build.
Scenario
HTML
JS Assets
Raw JS
Raw Δ
Gzip JS
Gzip Δ
tracking hook baseline
tracking-baseline.html
5
2.8 KiB
0 B
1.5 KiB
0 B
exposure logging hook
tracking-exposure.html
10
73.2 KiB
+70.5 KiB
27.0 KiB
+25.5 KiB
evaluation logging hook
tracking-evaluation.html
11
69.2 KiB
+66.4 KiB
25.6 KiB
+24.1 KiB
RUM tracking hook
tracking-rum.html
8
7.3 KiB
+4.5 KiB
3.7 KiB
+2.2 KiB
all tracking hooks
tracking-all.html
13
78.6 KiB
+75.8 KiB
29.4 KiB
+27.9 KiB
OpenFeature Node Server Bundle Sizes
Independent Webpack production builds of the installed core and Node SDK tarballs, targeting Node 18 with ESM (module export condition). Node built-ins remain external. OpenFeature, dd-trace, and configuration fixtures are not bundled.
Scenario
Raw JS
Gzip JS
Protobuf Modules
Node provider only
57.4 KiB
17.1 KiB
no
SSR helpers only (fetch client rules + serialize)
84.8 KiB
24.9 KiB
yes
Node provider + SSR helpers
140.4 KiB
40.7 KiB
yes
Precompute only (parsed rules)
50.5 KiB
16.7 KiB
no
Node provider + precompute
74.9 KiB
23.1 KiB
no
Adding SSR helpers to the provider adds 83.1 KiB raw / 23.6 KiB gzip in this build. This includes fetching, parsing, and serialization, not just the decoder. SSR helpers fetch rules for the browser, not for configuring that provider (which uses its existing JSON API).
Adding precomputation to the provider adds 17.5 KiB raw / 6.0 KiB gzip in this build. Both precompute scenarios import precomputeConfiguration from /rules-based and receive already-parsed rules from the test harness; they do not fetch, parse, or serialize configuration.
These are bundler sizes, not npm install sizes, unbundled Node require/import costs, payload sizes, or latency. Gzip compares compressed artifacts. Deltas compare scenarios in this build, not changes against the base branch. The browser scenarios include OpenFeature and a different harness, so their sizes are not directly comparable.
Dependency checks passed: no Protobuf runtime or generated schema modules in the provider-only or either precompute bundle; present in both SSR bundles (checked using Webpack module statistics).
This report shows current PR artifact sizes only; it does not compare against the base branch.
Negotiate dependent precomputed assignments through the request URL, fail malformed dependency graphs closed, and carry dependency telemetry through internal metadata without changing the public API.
Environment: Datadog workspace
Co-Authored-By: Codex GPT-5 <noreply@localhost>
Pin the shared fixtures to the corrected dependency failure contract: GENERAL at the requested root while preserving prerequisite-specific errors.
Environment: Datadog workspace
Co-Authored-By: Codex GPT-5 <noreply@localhost>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Browser consumer counterpart for dependent-flag precomputed packets. This PR is stacked on the Node precompute producer in #457.
attributes.flagsand failures from siblingattributes.flagEvaluationErrorscap_dependent-flags-variant-key=v1in the precomputed request URL, including proxy requestsPARSE_ERRORwithout speculative descendant telemetryERRORassignments during dependency reconstructionValidation
git diff --checkpassedRelated: DataDog/ffe-system-test-data#62, ddoghq/dd-source#155394, Node producer #457.