Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: launchdarkly/openfeature-java-server
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.3
Choose a base ref
...
head repository: launchdarkly/openfeature-java-server
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.2.0
Choose a head ref
  • 4 commits
  • 7 files changed
  • 3 contributors

Commits on Aug 25, 2026

  1. feat: Populate OpenFeature flag metadata from the evaluation reason (#56

    )
    
    The provider discarded everything in the LaunchDarkly evaluation reason
    that did not fit into the OpenFeature reason string, so OpenFeature
    users could not tell that an evaluation was part of an experiment; the
    reason detail is now exposed as OpenFeature flag metadata.
    
    - `ProviderEvaluation.flagMetadata` now carries `variationIndex`,
    `inExperiment`, `ruleIndex`, `ruleId`, `prerequisiteKey`, and
    `bigSegmentsStatus`
    - Each entry is only present when it applies to the evaluation, so
    callers must null-check — `inExperiment` in particular is absent rather
    than `false` for non-experiment evaluations
    - Key names match the LaunchDarkly reason field names and the attribute
    names used by the LaunchDarkly OpenTelemetry hooks
    - Documented the keys in the README
    
    @cursor review
    
    <details>
    <summary>Implementation details</summary>
    
    **Requirements**
    
    - [x] I have added test coverage for new or changed functionality
    - [x] I have followed the repository's pull request submission
    guidelines
    - [x] I have validated my changes against all supported platform
    versions
    
    **Related issues**
    
    None; this is one of several gaps found while auditing the LaunchDarkly
    OpenFeature providers against the OpenFeature specification.
    
    **Describe the solution you've provided**
    
    `EvaluationDetailConverter.getProviderEvaluation` builds an
    `ImmutableMetadata` from the `EvaluationReason`. Both entry points
    (typed values and `LDValue` results) go through it, so object and array
    evaluations get metadata too.
    
    `variationIndex` duplicates the information in `variant`, but as an
    integer rather than a stringified index, which is what consumers reading
    metadata for telemetry want. It is omitted along with `variant` when the
    SDK returned the default value.
    
    The OpenFeature telemetry conventions only reserve `contextId`,
    `flagSetId`, and `version`; none of the three map to a LaunchDarkly
    concept available on the evaluation detail (`contextId` would need the
    canonical context key rather than the reason, and could be added
    separately). Everything here is therefore LaunchDarkly-specific, named
    after the reason fields so it lines up with `EvaluationReason` and with
    the `feature_flag.result.*` attributes the LaunchDarkly OTel hook emits.
    
    **Describe alternatives you've considered**
    
    - A single nested `reason` structure: `ImmutableMetadata` only holds
    scalars, and flat keys are what telemetry hooks read.
    - Always emitting `inExperiment: false`: cheap for consumers, but it
    makes the metadata claim knowledge about evaluations where the reason
    carries none.
    
    **Additional context**
    
    `./gradlew test javadoc` passes, including new cases per metadata entry
    and one covering object results. Nothing outside the converter changes.
    No visual preview applies — this is a server-side provider change.
    
    </details>
    
    
    Link to Devin session:
    https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
    Requested by: @kinyoklion
    
    <!-- CURSOR_SUMMARY -->
    ---
    
    > [!NOTE]
    > **Overview**
    > **OpenFeature evaluations now expose LaunchDarkly-specific details on
    `ProviderEvaluation.flagMetadata`**, so consumers can see experiment
    participation, rule matches, prerequisites, and Big Segments status
    without parsing the reason string alone.
    > 
    > `EvaluationDetailConverter` builds `ImmutableMetadata` from each
    `EvaluationReason` and attaches it on every conversion path (typed
    values and `LDValue` object/array results). Keys are included only when
    they apply: `variationIndex` (integer, omitted for default values),
    `inExperiment` (only when true), `ruleIndex`/`ruleId` for rule matches,
    `prerequisiteKey`, and `bigSegmentsStatus`. The README adds a **Flag
    Metadata** table describing these fields.
    > 
    > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
    c93fd2c. 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 and devin-ai-integration[bot] authored Aug 25, 2026
    Configuration menu
    Copy the full SHA
    153eaa3 View commit details
    Browse the repository at this point in the history
  2. feat: Deprecate the provider getState method (#55)

    `FeatureProvider#getState()` is deprecated in the OpenFeature Java SDK,
    but this provider overrode it without marking it deprecated, so
    consumers got no signal to migrate.
    
    - Marks the `getState()` override `@Deprecated` and documents
    `Client#getProviderState()` as the replacement
    - Behavior is unchanged; the override is kept so existing callers keep
    getting real state rather than the SDK's `READY` default
    - Removes the deprecation warning emitted when compiling this provider
    
    @cursor review
    
    <details>
    <summary>Implementation details</summary>
    
    **Context**
    
    The OpenFeature SDK now tracks provider state itself, from `initialize`
    and from the events this provider emits
    (`ready`/`stale`/`error`/`configuration changed`), which is why
    `FeatureProvider#getState()` carries `@Deprecated` with "The state is
    handled by the SDK internally. Query the state from the Client instead."
    
    **Alternatives considered**
    
    Deleting the override entirely: rejected for now because
    `FeatureProvider` supplies a default that always returns `READY`, so any
    consumer still calling `provider.getState()` would silently get a wrong
    answer. Deprecating first gives a migration path; the override can be
    dropped in a future major.
    
    **Testing**
    
    `./gradlew test javadoc` — all 44 tests pass and javadoc builds with no
    new warnings.
    
    No visual preview applies — this is a server-side provider change.
    
    </details>
    
    
    Link to Devin session:
    https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
    Requested by: @kinyoklion
    
    <!-- CURSOR_SUMMARY -->
    ---
    
    > [!NOTE]
    > **Overview**
    > Aligns this LaunchDarkly OpenFeature server provider with the
    OpenFeature Java SDK by marking the **`getState()`** override
    **`@Deprecated`** and documenting **`Client#getProviderState()`** as the
    replacement.
    > 
    > The override remains so callers still receive accurate provider state
    instead of the SDK default **`READY`**; behavior is unchanged aside from
    deprecation signaling and cleaner compilation (no missing-deprecation
    warning on this override).
    > 
    > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
    302cd66. 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 and devin-ai-integration[bot] authored Aug 25, 2026
    Configuration menu
    Copy the full SHA
    1f71ef3 View commit details
    Browse the repository at this point in the history
  3. fix: Synchronize provider state access on the state lock (#54)

    `getState()` synchronized on the `state` field's value instead of the
    `stateLock` monitor, so reads were never mutually exclusive with writes.
    
    - `getState()` now locks `stateLock`, matching `setState`
    - `initialize` sets the ready state through `setState` and reads it
    through `getState` instead of touching the field unlocked
    - No behavior change for callers beyond correct visibility of state
    transitions
    
    @cursor review
    
    <details>
    <summary>Implementation details</summary>
    
    **Root cause**
    
    `synchronized (state)` locks on the `ProviderState` enum constant
    currently referenced by the field. A reader holding the monitor of
    `ProviderState.NOT_READY` does not exclude a writer holding `stateLock`,
    so state transitions had no happens-before relationship with reads.
    Because enum constants are JVM-wide singletons, it also meant contending
    on a monitor shared with any other code that happens to lock the same
    constant.
    
    `initialize` also wrote `state = ProviderState.READY` and later read
    `state` without any lock, on a different thread than the data source
    status listener that mutates it.
    
    **Alternatives considered**
    
    Making the field `volatile` would fix visibility, but the `VALID` branch
    of `handleDataSourceStatus` needs a compare-and-set over the field, so
    the lock is still required; keeping a single lock is simpler than mixing
    both.
    
    **Testing**
    
    `./gradlew test` — all 44 tests pass. The existing `LifeCycleTest` cases
    already assert the state transitions this lock protects (`NOT_READY` →
    `READY`, and → `ERROR` on a failed data source); a test cannot
    deterministically observe the previous incorrect locking, so no new test
    is added.
    
    No visual preview applies — this is a server-side provider change.
    
    </details>
    
    
    Link to Devin session:
    https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
    Requested by: @kinyoklion
    
    <!-- CURSOR_SUMMARY -->
    ---
    
    > [!NOTE]
    > **Overview**
    > Fixes incorrect locking around the OpenFeature provider lifecycle
    state so reads and writes use the same monitor.
    > 
    > `getState()` now synchronizes on `stateLock` instead of on the
    `ProviderState` enum value held in the field, which did not exclude
    concurrent updates from `setState` and could contend on JVM-wide enum
    monitors. **`initialize`** routes the early-ready path through
    `setState(READY)` and the readiness check through `getState()` instead
    of assigning or reading the `state` field without the lock.
    > 
    > Callers should see the same transitions, with correct visibility and
    mutual exclusion when the data source listener updates state on another
    thread.
    > 
    > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
    dfc2c89. 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 and devin-ai-integration[bot] authored Aug 25, 2026
    Configuration menu
    Copy the full SHA
    ebe9513 View commit details
    Browse the repository at this point in the history
  4. chore(main): release 1.2.0 (#57)

    🤖 I have created a release *beep* *boop*
    ---
    
    
    ##
    [1.2.0](1.1.3...1.2.0)
    (2026-08-25)
    
    
    ### Features
    
    * Deprecate the provider getState method
    ([#55](#55))
    ([1f71ef3](1f71ef3))
    * Populate OpenFeature flag metadata from the evaluation reason
    ([#56](#56))
    ([153eaa3](153eaa3))
    
    
    ### Bug Fixes
    
    * Synchronize provider state access on the state lock
    ([#54](#54))
    ([ebe9513](ebe9513))
    
    ---
    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 Please** bumps the library from **1.1.3** to **1.2.0** in
    `gradle.properties` and `.release-please-manifest.json`, and adds the
    **1.2.0** section to `CHANGELOG.md`. No runtime code changes in this
    diff.
    > 
    > The published **1.2.0** release (already on `main`) includes:
    **deprecated** `Provider.getState()` with guidance to use
    `Client.getProviderState()`; **flag metadata** on evaluations derived
    from LaunchDarkly evaluation reason fields; and **thread-safe** provider
    state reads/writes via synchronization on the state lock.
    > 
    > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
    a86744b. 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>
    github-actions[bot] authored Aug 25, 2026
    Configuration menu
    Copy the full SHA
    878b505 View commit details
    Browse the repository at this point in the history
Loading