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
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved SSE and polling defects can block reconnection indefinitely, discard needed refetches, miss stream URL changes, and delay recovery after fetch failures.
Adds server-sent events (SSE) support to the Dynatrace OpenFeature provider so flag-change notifications trigger configuration refreshes, with polling as a fallback.
Changes:
Adds stream discovery, message parsing, reconnection, and shutdown handling.
Integrates SSE-triggered refreshes with single-flight polling and configurable polling intervals.
Adds unit and end-to-end coverage, dependencies, and user documentation.
File
Description
uv.lock
Locks the new SSE client dependency.
tests/test_sse.py
Tests stream lifecycle, callbacks, and logging.
tests/test_sse_message.py
Tests message parsing and invalid payload handling.
tests/test_provider_sse.py
Tests provider-level SSE integration and lifecycle.
tests/test_polling.py
Tests interval changes and deferred refresh coalescing.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
An SSE callback race can submit a fetch after stop() returns, allowing a CDN request to start after shutdown unless the stop event is rechecked under the condition lock.
Prevent SSE callbacks from submitting fetches after poller shutdown
src/dynatrace/openfeature/_polling.py:97
An SSE callback can pass the stop check, pause, and acquire _cond after stop() has returned, then submit a new fetch on the stopped poller. Because _poll() invokes the fetcher before checking cancellation, this can start a CDN request after shutdown. Recheck _stop_event under _cond before deferring or submitting work.
@toddbaert I made the variable-name adjustments you proposed, but when looking at the other languages, they use different ones entirely (for example, looking at the polling manager in java and .net). They both use inFlightSseRefetch instead inFlightLastModified or issuedFor instead of previousInFlight, for example. I think it makes sense to re-adjust them here to match the others.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A race between the stop check and condition-lock acquisition allows an SSE callback to submit a fetch after shutdown, potentially issuing a CDN request despite cancellation.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed to evaluate timezone-dependent suppression of newer SSE notifications and an initialization race that can make rotation tests fail despite correct behavior.
@toddbaert I made the variable-name adjustments you proposed, but when looking at the other languages, they use different ones entirely (for example, looking at the polling manager in java and .net). They both use inFlightSseRefetch instead inFlightLastModified or issuedFor instead of previousInFlight, for example. I think it makes sense to re-adjust them here to match the others.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A re-initialization race can commit a rejected poll response’s validators alongside a different configuration body, enabling later 304 responses for a configuration that was never applied.
The reason will be displayed to describe this comment to others. Learn more.
The shutdown + re-initialize variant from the latest review is real but narrow (a poll has to finish between its stop check and its apply while the lifecycle is replaced). Same gap exists in all our providers, so we'll fix it consistently there: poll callbacks name the poller they came from and the provider drops them unless it's still current, like the SSE callbacks. Tracked in AI-1639.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Concurrent initialization and polling can commit validators from a rejected configuration, causing subsequent requests to return 304 indefinitely while an older configuration remains loaded.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed for a critical lifecycle race that can let a stale fetch worker apply flags and close or replace the new lifecycle’s SSE stream after shutdown and reinitialization.
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.
References
https://dt-rnd.atlassian.net/browse/AI-984