Skip to content

fix: Fallback to existing evaluation context on failed refresh#14

Open
caitlynstocker wants to merge 2 commits into
mainfrom
cat/devex-41/default-to-old-state-on-failed-request
Open

fix: Fallback to existing evaluation context on failed refresh#14
caitlynstocker wants to merge 2 commits into
mainfrom
cat/devex-41/default-to-old-state-on-failed-request

Conversation

@caitlynstocker
Copy link
Copy Markdown
Contributor

@caitlynstocker caitlynstocker commented May 25, 2026

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

@caitlynstocker caitlynstocker requested a review from a team as a code owner May 25, 2026 06:20
@caitlynstocker caitlynstocker marked this pull request as draft May 25, 2026 06:20
@caitlynstocker caitlynstocker force-pushed the cat/devex-41/default-to-old-state-on-failed-request branch from 5e8ae6e to dc29af3 Compare May 25, 2026 06:28
@@ -0,0 +1,124 @@
package com.octopus.openfeature.provider;
Copy link
Copy Markdown
Contributor Author

@caitlynstocker caitlynstocker May 25, 2026

Choose a reason for hiding this comment

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

These tests are copied straight over from the dotnet library / my dotnet PR for this same ticket.

@caitlynstocker caitlynstocker force-pushed the cat/devex-41/default-to-old-state-on-failed-request branch from dc29af3 to 24f247c Compare May 25, 2026 06:37
@caitlynstocker caitlynstocker force-pushed the cat/devex-41/default-to-old-state-on-failed-request branch from 24f247c to 724f914 Compare May 25, 2026 06:38

static class MockOctopusFeatureClient extends OctopusClient {

private volatile FeatureToggles toggles;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@caitlynstocker caitlynstocker marked this pull request as ready for review May 25, 2026 06:43
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.

1 participant