Guard precomputed ETag reuse by context - #364
Open
leoromanovsky wants to merge 60 commits into
Open
Conversation
Validate caller-supplied previous configurations before sending their ETag or reusing them on a 304 response. Environment: Datadog workspace
leoromanovsky
marked this pull request as ready for review
August 12, 2026 20:30
leoromanovsky
requested review from
dd-oleksii,
sameerank and
typotter
and removed request for
a team and
typotter
August 12, 2026 20:30
dd-oleksii
requested changes
Aug 13, 2026
Comment on lines
+92
to
+94
| const previousConfiguration = configMatchesContext(options.previousConfiguration, options.context) | ||
| ? options.previousConfiguration | ||
| : undefined |
Member
There was a problem hiding this comment.
major: reusing etag across context must be fine. If context change results in a different response, that response must have a different etag. If context changed in a way that does not affect the response, it should get the same etag (e.g. change in attribute that is not used for evaluation).
So having some etag is better than none. We also want to avoid busting cache on insignificant attribute change.
sameerank
force-pushed
the
sameerank/FFL-2934/configuration-fetchers-bootstrap-init
branch
3 times, most recently
from
August 18, 2026 15:21
567a26c to
fda2716
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
fetchPrecomputedConfigurationaccepts a caller-supplied previous configuration. When that configuration belongs to context A but the new request targets context B, the public fetcher currently sends context A’s ETag and can reuse A’s assignments after a304 Not Modifiedresponse.This PR is stacked on #351 to demonstrate and close that context-boundary gap.
Changes
previousConfigurationagainst the requested context insidefetchPrecomputedConfigurationIf-None-Matchor handling304304when its ETag is incorrectly sent, while context B returns fresh assignments when it is omittedDecisions
The invariant lives in the exported public fetcher rather than only in
createFlagsConfigurationFetcher, so direct callers receive the same context-safety guarantee as the provider wrapper. Rules configurations remain unchanged because they are not precomputed for an evaluation context.Validation:
yarn workspace @datadog/openfeature-browser test --runInBand test/transport/fetchConfiguration.spec.ts— 25 tests passedyarn workspace @datadog/openfeature-browser typecheckyarn biome check packages/browser/src/transport/fetchConfiguration.ts packages/browser/test/transport/fetchConfiguration.spec.ts --diagnostic-level=error