fix: Fallback to existing evaluation context on failed refresh#14
Open
caitlynstocker wants to merge 2 commits into
Open
fix: Fallback to existing evaluation context on failed refresh#14caitlynstocker wants to merge 2 commits into
caitlynstocker wants to merge 2 commits into
Conversation
5e8ae6e to
dc29af3
Compare
caitlynstocker
commented
May 25, 2026
| @@ -0,0 +1,124 @@ | |||
| package com.octopus.openfeature.provider; | |||
Contributor
Author
There was a problem hiding this comment.
These tests are copied straight over from the dotnet library / my dotnet PR for this same ticket.
dc29af3 to
24f247c
Compare
24f247c to
724f914
Compare
caitlynstocker
commented
May 25, 2026
|
|
||
| static class MockOctopusFeatureClient extends OctopusClient { | ||
|
|
||
| private volatile FeatureToggles toggles; |
Contributor
Author
There was a problem hiding this comment.
volatile??! 🌋😬
Apparently this just guarantees that a write to toggles on one thread will be visible to another - which is good because we're writing toggles with a test thread and then reading them with the background refresh thread.
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.
Background 🌇
To ensure feature toggles are not stale, we regularly refresh the evaluation context. Currently if the refresh request fails and toggles cannot be evaluated, we fall back to using each toggle's default value.
What's this? 🐦
This PR adjusts the function to refresh evaluation context so that if a request to get the evaluation context fails, we fall back to using the evaluation from the existing (stale) evaluation context.
While not perfect, we expect that the most recent evaluation will give us a more correct result than using default values.
Testing 🧪
This has been tested by running the automated tests added in
OctopusContextProviderTests.cs🚩 These tests are a Claude special. I've checked over them carefully and done my best to make sure they are equivalent to (or better than) the same tests in our .NET library, but they could use a careful review.
How to review? 🔍
💬 See comments on code
🧪 Any suggested further testing?
🚩 Carefully check my Java
Part of DEVEX-41