Repository navigation
fix: Include an error type in provider error events - #73
Merged
Merged
Conversation
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
tanderson-ld
approved these changes
Oct 23, 2026
Contributor
|
❌ Cannot revive Devin session - the session is too old. Please start a new session instead. |
kinyoklion
added a commit
that referenced
this pull request
Oct 23, 2026
…vents (#74) **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** OFP requirements 4.2.3 / 4.2.4 (sdk-specs `OFP-openfeature-provider-behavior`): `STALE`/`ERROR` events MUST include the message of the last data source error, or a message describing the condition if it has none. The Java provider already does this. **Describe the solution you've provided** ```csharp private static string DescribeLastError(DataSourceStatus status, string fallback) => status.LastError is ErrorInfo e ? e.Message ?? e.ToString() : fallback; ``` - `Off` (both in `StatusChangeHandler` and the `InitializeAsync` pre-check): `PROVIDER_ERROR` message and the `LaunchDarklyProviderInitException` message now use `DescribeLastError(status, ProviderShutdownMessage)` instead of always `ProviderShutdownMessage`. - `Interrupted`: previously `LastError?.Message ?? "encountered an unknown error"`, so HTTP errors (which have no `Message`) got the generic text; they now get `ErrorInfo.ToString()` (e.g. kind + status code). Behavior is unchanged when there is no `LastError`. Added tests for Off with an exception message, Off with an HTTP 401, Off with no error, and Interrupted with an HTTP 503. **Describe alternatives you've considered** Always using `ErrorInfo.ToString()` would also include the timestamp for exception-based errors; `Message` is kept when present so existing Stale messages do not change. **Additional context** Validated locally with `dotnet test` on net8.0 (72 passed). Independent of the error-type PR (#73). Link to Devin session: https://app.devin.ai/sessions/929f5530882d40bc95e55391e97536d5 Open in Devin Desktop: https://app.devin.ai/desktop/session/929f5530882d40bc95e55391e97536d5?variant=devin Requested by: @kinyoklion [SDK-3255](https://launchdarkly.atlassian.net/browse/SDK-3255) [SDK-3255]: https://launchdarkly.atlassian.net/browse/SDK-3255?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Provider error and stale events now surface the LaunchDarkly data source’s last error** instead of only generic shutdown or “unknown error” text, aligning with OpenFeature provider behavior (OFP 4.2.3 / 4.2.4). > > A new `DescribeLastError` helper picks `ErrorInfo.Message` when present, otherwise `ErrorInfo.ToString()` (so HTTP failures without a message still describe status codes). That message is used for `PROVIDER_ERROR` / init failures when the data source is `Off` (including the `InitializeAsync` pre-check) and for `PROVIDER_STALE` when state is `Interrupted`. When there is no `LastError`, behavior stays the same via the existing fallback strings. > > Tests cover exception messages, HTTP 401/503 cases, and the default message when `LastError` is absent. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4324114. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
kinyoklion
pushed a commit
that referenced
this pull request
Oct 23, 2026
🤖 I have created a release *beep* *boop* --- ## [2.3.2](2.3.1...2.3.2) (2026-10-23) ### Bug Fixes * Honor the cancellation token when waiting for initialization ([#72](#72)) ([0e6432d](0e6432d)) * Include an error type in provider error events ([#73](#73)) ([4f64d9c](4f64d9c)) * Include the last data source error in provider error and stale events ([#74](#74)) ([8c23f97](8c23f97)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Release 2.3.2** bumps the package version in the manifest, `LaunchDarkly.OpenFeature.ServerProvider.csproj`, and adds a **2.3.2** section to `CHANGELOG.md`. No application code changes appear in this PR; it ships three already-merged bug fixes. > > The release notes call out: honoring **`CancellationToken`** during provider initialization waits, setting **`ErrorType`** on provider error events, and including the **last data source error** in provider error and stale event messages. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 47ba220. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Requirements
Related issues
OFP requirement 5.1.5 (sdk-specs
OFP-openfeature-provider-behavior):PROVIDER_ERRORevents SHOULD populate the event details' error code.Describe the solution you've provided
StatusProvider.EmitProviderEventsetsProviderEventPayload.ErrorType = ErrorType.GeneralforProviderEventTypes.ProviderErrorevents (emitted when the LaunchDarkly data source isOff). AddedProviderTests.ItIncludesAnErrorTypeInErrorEvents.Describe alternatives you've considered
A more specific type (e.g.
ProviderFatalfor 401/403) was not used; OFP does not define a mapping, and the Python provider already usesGENERALfor the same transition.Additional context
Validated locally with
dotnet teston net8.0 (69 passed).Link to Devin session: https://app.devin.ai/sessions/929f5530882d40bc95e55391e97536d5
Open in Devin Desktop: https://app.devin.ai/desktop/session/929f5530882d40bc95e55391e97536d5?variant=devin
Requested by: @kinyoklion
SDK-3255
Note
Overview
Aligns provider status error events with OpenFeature provider behavior (OFP 5.1.5) by populating the event’s error code when the provider reports an error.
StatusProvider.EmitProviderEventnow setsProviderEventPayload.ErrorTypetoErrorType.Generalwhenever the event type isProviderError(e.g. when status moves toError/Fatalafter the data source isOff). A new test drives a post-init data-sourceOfftransition and asserts the emitted event isProviderErrorwithErrorType.General.Reviewed by Cursor Bugbot for commit 7a95e73. Bugbot is set up for automated code reviews on this repo. Configure here.