Skip to content

docs: add ADR 0010 to disable default polling for static-context providers#69

Open
jonathannorris wants to merge 7 commits intomainfrom
adr/event-driven-refresh
Open

docs: add ADR 0010 to disable default polling for static-context providers#69
jonathannorris wants to merge 7 commits intomainfrom
adr/event-driven-refresh

Conversation

@jonathannorris
Copy link
Copy Markdown
Member

Summary

  • Proposes disabling default timer-based polling for static-context providers
  • Providers should re-fetch on initialization, context change, app foreground / page visibility, and SSE push
  • Timer-based polling remains available as opt-in but defaults to disabled

Motivation

Current OFREP static-context providers poll on a fixed timer by default (JS: 30s, Swift: 30s, Kotlin: 5min). This breaks sticky bucketing expectations and wastes resources on mobile. The majority of vendor SDKs (DevCycle, LaunchDarkly, Statsig, Eppo) do not use timer-based polling as the default client-side refresh mechanism.

See the vendor comparison table in the issue for details.

Notes

  • This supersedes the default polling behavior in ADR-0005 for static-context providers only. ADR-0005 remains valid for the polling mechanism itself and for server-side providers.
  • Designed to work alongside ADR-0008 (SSE) and ADR-0009 (local persistence / cache-first initialization).
  • Open questions around foreground refresh cooldown duration and migration path for existing applications.

Related Issues

Closes #68

@jonathannorris jonathannorris requested a review from a team as a code owner March 19, 2026 21:24
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant change to how static-context providers refresh feature flag evaluations. It proposes disabling default timer-based polling in favor of event-driven mechanisms, such as initialization, context changes, app foreground/page visibility, and Server-Sent Events (SSE) pushes. This aims to enhance sticky bucketing consistency, reduce resource consumption on client devices, and align the OpenFeature Protocol with common practices observed in leading vendor SDKs.

Highlights

  • Default Polling Disabled: Timer-based polling is now disabled by default for static-context providers to prevent sticky bucketing issues and improve resource efficiency on client devices.
  • Event-Driven Refresh: Providers will now re-fetch bulk evaluations based on event-driven triggers: initialization, context changes, app foreground/page visibility, and Server-Sent Events (SSE) push events.
  • Opt-in Polling: Timer-based polling remains available as an opt-in configuration, with the default poll interval set to disabled (0 or negative value) for applications that explicitly require it.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces ADR 0010, which proposes to disable default timer-based polling for static-context providers in favor of event-driven updates. This is a well-reasoned and detailed proposal that aligns with common industry practices. My review includes a few suggestions to improve the accuracy and completeness of the ADR: correcting a potentially broken link to another ADR, fixing an incorrect API name for watchOS foreground detection, and recommending that a more concrete migration strategy for the proposed breaking change be included directly in the ADR.

Comment thread service/adrs/0010-disable-default-polling-for-static-context-providers.md Outdated
Copy link
Copy Markdown
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

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

I'm good with this, but interested in what @beeme1mr @lukas-reining @thomaspoignant think.

Copy link
Copy Markdown
Member

@lukas-reining lukas-reining left a comment

Choose a reason for hiding this comment

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

Approving with some comments.


Timer-based polling is problematic for static-context providers for two reasons:

1. **Sticky bucketing** — polling causes flag values to change mid-session, breaking the expectation that a user sees consistent behavior throughout a session. Most platforms expect feature flag bucketing to remain sticky for a user's whole session. Changing flag values mid-session can cause UI flicker, inconsistent experiences, and breaks experiment integrity.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does polling change the bucketing?
Wouldn't we assume the bucketing to be consistent throughout all reloads of an app during the experiment? The polling is noting else than a reload to me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

While bucketing is generally deterministic, there are cases where time-based rules (commonly used in rollouts) would get triggered by polling where they would generally stay consistent between sessions if polling wasn't used. With 30s polling, those changes get picked up mid-session while the user is actively using the app, which can cause the experience to shift unexpectedly. With foreground-only refresh, changes are picked up at a natural transition point when the user returns to the app. SSE-based pushes as discussed in ADR-0008 would also trigger changes, but those are explicit server-initiated notifications rather than the client blindly re-fetching on a timer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It may be worth clarify this in the doc. Initially, I had the same question as Lukas.


2. **Context change** — when `onContextChange` is invoked (e.g., user switch, logout), the provider re-fetches bulk evaluations for the new context. This is already handled by existing provider implementations.

3. **App foreground / page visibility** — when the application returns from the background or the page becomes visible, the provider should re-fetch bulk evaluations. This ensures values are fresh when the user returns without requiring continuous polling.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would't this bring back the flickering described above?
First the old values would be there until the request has finished.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yea there's still a potential for the values to change on foreground, but in most real-world cases it's very unlikely there is any change when the app is foregrounded since feature flag changes are fairly infrequent. The difference is also that it happens at a natural transition point when the user returns to the app rather than unpredictably while they're actively using it. Users already expect the app to refresh when they come back to it. With polling, the values can change mid-interaction which is more disruptive.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm pretty sure the React SDK allows us to opt out of this live update behavior but it would be worth confirming.

… providers

Replace default timer-based polling with trigger-based refresh (initialization, context change, app foreground, SSE push). Closes #68.

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
… ADR 0010

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
@jonathannorris jonathannorris force-pushed the adr/event-driven-refresh branch from 4f82864 to c987f3d Compare April 14, 2026 14:06
Breaking provider change is acceptable since OFREP providers are all sub-v1.

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
…R 0010

Foreground re-fetch cooldown is unnecessary since ETag/304 handles redundant requests.

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
@jonathannorris jonathannorris requested a review from Copilot April 14, 2026 21:01
@jonathannorris
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Architecture Decision Record (ADR) documenting a shift away from default timer-based polling for OFREP static-context providers, favoring event-driven refresh (init/context change/foreground/SSE), while keeping polling as opt-in.

Changes:

  • Introduces ADR-0010 specifying that default timer polling should be disabled for static-context providers.
  • Defines recommended event-driven refresh triggers (initialization, context change, foreground/visibility, SSE push).
  • Documents interactions with SSE (changeDetection modes) and conditional refresh via ETag.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread service/adrs/0010-disable-default-polling-for-static-context-providers.md Outdated
Comment thread service/adrs/0010-disable-default-polling-for-static-context-providers.md Outdated
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces ADR-0010, which proposes disabling default timer-based polling for static-context providers in favor of event-driven triggers such as application foregrounding and SSE. The review feedback identifies a contradiction regarding 'unconditional' re-fetches when SSE is unavailable, which conflicts with the ETag revalidation strategy, and notes an inconsistency in event naming compared to existing project guidelines.

Comment thread service/adrs/0010-disable-default-polling-for-static-context-providers.md Outdated
Comment thread service/adrs/0010-disable-default-polling-for-static-context-providers.md Outdated
…R 0010

Drop 'unconditionally' to avoid contradiction with ETag section. Use ConfigurationChanged to match guideline and ADR-0008.

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
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.

Disable Default Polling for OFREP Static-Context Providers

6 participants