Repository navigation
chore: Port CI, tooling and test changes from main - #522
Merged
Merged
Conversation
#473) Fixes an intermittent JRuby failure in `big_segment_store_status_provider sends status updates` (`spec/ldclient_listeners_spec.rb:34`, `expected false, got true`), seen on #472. - `spec/mock_components.rb`: adds `GatedBigSegmentStore`, a Big Segment store whose metadata queries wait for the test to supply each result - `spec/ldclient_listeners_spec.rb`: the example adds its observer and checks what it received only while the poller is waiting inside a query **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 <details> <summary>Implementation details</summary> **Root cause** The status poller caches each status inside `@poll_lock` and notifies observers after it releases the lock. `status_provider.status` returns the cached status without waiting for that notification. When the poller's first poll runs before the example reads the status, as it usually does on JRuby, the example can do all of the following before the poller delivers its first notification: 1. Read the healthy status. 2. Add its observer. 3. Inject the store error. The provider has not notified anyone yet, so that first notification goes to the new observer, carrying the healthy status. `statuses.pop` returns it instead of the unavailable status. #440 fixed the same race in the `status polling` examples in `spec/impl/big_segments_spec.rb`. There it caused a hang; here it delivers the wrong first status. **Solution** `GatedBigSegmentStore#get_metadata` counts the query, then waits until the test queues a result. The poller notifies observers of one result before it starts its next query. So once query N has started, every earlier result has been delivered, and nothing else happens until the test queues another result. The example now runs in three steps: 1. It queues a healthy result and reads it through `status_provider.status`. 2. It waits for query 2, then adds the observer. Only the poller can make that query, because later status reads come from the cache. 3. It queues an error and waits for query 3. Then it checks that the observer received exactly one status, that the status is unavailable, and that `status_provider.status` returns it. None of these steps depends on how long a poll or notification takes: - `status_poll_interval: 0.01` only controls how quickly the poller moves on to its next query. - The 5-second wait timeouts only bound how long a failure takes to report. The example releases the store in `ensure`. The client can't stop its poller while a query is waiting. **Alternatives considered** - Skipping statuses until an unavailable one arrives, as `next_status_matching` does in `big_segments_spec.rb`. That would pass, but it would hide an extra or out-of-order notification, and it waits in a sleep loop. - Changing the manager so the first status reaches observers before `status` returns. That changes SDK behavior to suit a test. The manager also deliberately notifies outside `@poll_lock` (see `query_store_status`). **Testing** With no code changes, the failure reproduces on JRuby 9.4.6 pinned to one or two cores. Every failure was the CI one: `expected false, got true` at line 34. | Unmodified SDK, JRuby 9.4.6 | Old example | New example | |---|---|---| | Pinned to 1 core (`taskset -c 0`) | 6/1,000 failed; 8/1,000 on a rerun | 1,000/1,000 passed | | Pinned to 2 cores | 4/1,000 failed | 1,000/1,000 passed | | 8 cores, not pinned | 1,500/1,500 passed | 1,500/1,500 passed | The next rows inject delays, gated by environment variables, into a local copy of `big_segments.rb` and the spec. None of that code is in this PR. The random delays apply at 5 points in the poll and notify path, plus the example's status read and `add_observer`. | Injected delays | Old example | New example | |---|---|---| | Poller polls first, notify delayed 0.3s (MRI 3.2) | 10/10 failed | 10/10 passed | | Same, JRuby 9.4.6 | 10/10 failed | 10/10 passed | | Random delay up to 5ms at each point (MRI 3.2) | 121/300 failed | 300/300 passed | | Same, JRuby 9.4.6 | 141/300 failed | 300/300 passed | | Random delay up to 50ms at each point (MRI 3.2) | 23/60 failed | 60/60 passed | | Same, JRuby 9.4.6 | 23/60 failed | 60/60 passed | The new example still fails when the SDK is broken in each of these ways: - The poller never notifies. - A store error is reported as available. - A change is notified twice. - Polls never update the cached status. - The store is queried only once. The full suite passes on MRI 3.2 (`bundle exec rspec spec`) and on JRuby 9.4.6 (`--tag '~flaky'`, as in CI), with one exception. `launchdarkly-server-sdk_spec.rb:5` fails on `main` too: its unbundled subprocess can't find the gems in my local bundle path. RuboCop reports no offenses on the changed files. **Not addressed here** The same timing can affect an application. If it reads the status and then adds a listener while the client is starting, the listener can receive the status that was just read. That's a redundant notification rather than a wrong status, so this PR doesn't change it. </details> [SDK-3424](https://launchdarkly.atlassian.net/browse/SDK-3424) [SDK-3424]: https://launchdarkly.atlassian.net/browse/SDK-3424?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Fixes a flaky JRuby failure in **`big_segment_store_status_provider sends status updates`** where the observer could receive the initial healthy status instead of the post-error unavailable status, because the status poller notifies observers after caching and the old mock returned results immediately. > > Adds **`GatedBigSegmentStore`** in `spec/mock_components.rb`: metadata **`get_metadata`** blocks until the test **`queue_metadata`** / **`queue_metadata_error`**, exposes **`wait_for_queries`** for poll ordering, and **`release`** so the client can shut down without hanging on a blocked query. > > The listener example switches from **`MockBigSegmentStore`** to the gated store: queue healthy metadata, wait for the second poll before registering the observer, then queue an error and wait for the third poll before asserting exactly one unavailable notification and matching **`status`**. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1ecf5d0. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> (cherry picked from commit d3f643e)
…verification in the contract test service (#481) <!-- TERMAG_PR_BODY_BEGIN --> The contract test service now maps `configuration.wrapper` to `wrapper_name`/`wrapper_version` (an empty name or version counts as unset) and `configuration.serviceEndpoints` to `stream_uri`/`base_uri`/`events_uri`, and streams by default when only `serviceEndpoints.streaming` is given. It declares `wrapper`, `service-endpoints` and `tls:verify-peer`, so the harness now runs the wrapper header tests, `events/disabling`, `service endpoints/using separate service endpoints properties` (v2) and the three `invalid tls certificate` tests. The SDK verifies peers by default, so TLS needs no mapping. Tested locally against harness v2.42.0 and v3.2.0-alpha.15 with persistence tests enabled: every newly run test passes and no test that passed on main fails or disappears. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0d6d1f51b3baf24ee project=appease-ai-feverish --> <sub>Opened from termag</sub> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > The contract test **ClientEntity** now maps harness **`configuration.serviceEndpoints`** onto SDK **`stream_uri` / `base_uri` / `events_uri`** (applied early; legacy streaming/polling/events blocks can still override). When there is no **`dataSystem`**, **`streaming`**, or **`polling`** block, **`use_ldd`** is enabled only if **`serviceEndpoints.streaming`** is absent—so a streaming-only endpoint config can drive live updates without an explicit streaming section. > > **`configuration.wrapper`** is mapped to **`wrapper_name`** and **`wrapper_version`**, treating empty strings as unset. > > The test service advertises **`wrapper`**, **`service-endpoints`**, and **`tls:verify-peer`** capabilities so the harness runs wrapper header, separate-endpoints, events-disable, and invalid-TLS scenarios (peer verification relies on SDK defaults, not new mapping). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0370c08. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> (cherry picked from commit 9a2f5b9)
(cherry picked from commit cd9308c)
(cherry picked from commit 48d606e)
(cherry picked from commit f3706f2)
(cherry picked from commit 3153f21)
…#507) ## Summary Declares `diagnostic-events` in the contract test service so the new sdk-test-harness test `events/diagnostic events` runs. The test was added in v3.2.0-alpha.20 and checks that `diagnostic-init` is sent to `/diagnostic` and that no diagnostic payload reaches the analytics route. - The entity already sets `diagnostic_opt_out = !enableDiagnostics`, so the entity needs no other change. <details> <summary>Testing</summary> I ran the v3.2.0-alpha.20 harness locally with `-run diagnostic` against the service (Ruby 3.3), and all 3 diagnostic tests passed. </details> Link to Devin session: https://app.devin.ai/sessions/56b8ade9602745fbba00e59a531bbefa Open in Devin Desktop: https://app.devin.ai/desktop/session/56b8ade9602745fbba00e59a531bbefa?variant=devin Requested by: @joker23 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Adds **`diagnostic-events`** to the capabilities returned by the contract test service’s root endpoint so the sdk-test-harness **diagnostic events** suite (v3.2.0-alpha.20+) is selected for this adapter. No other service or entity changes are required because diagnostics opt-out is already driven by `enableDiagnostics` in the client entity. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit b40a9c9. 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> (cherry picked from commit 81e7544)
(cherry picked from commit 8080f5b)
There was a problem hiding this comment.
Risk: medium. Not approved: this exceeds the low-risk threshold (CI/release action retags, Dependabot replacing Renovate, and contract-test harness changes), which is the rule that decided the result. Cursor Bugbot completed with no findings; human review is needed and no reviewers were assigned.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
kinyoklion
approved these changes
Dec 3, 2026
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.


Fixes an intermittent JRuby failure in
big_segment_store_status_provider sends status updates(
spec/ldclient_listeners_spec.rb:34,expected false, got true), seenon #472.
spec/mock_components.rb: addsGatedBigSegmentStore, a Big Segmentstore whose metadata queries wait for the test to supply each result
spec/ldclient_listeners_spec.rb: the example adds its observer andchecks what it received only while the poller is waiting inside a query
Requirements
guidelines
versions
Implementation details
Root cause
The status poller caches each status inside
@poll_lockand notifiesobservers after it releases the lock.
status_provider.statusreturnsthe cached status without waiting for that notification. When the
poller's first poll runs before the example reads the status, as it
usually does on JRuby, the example can do all of the following before
the poller delivers its first notification:
The provider has not notified anyone yet, so that first notification
goes to the new observer, carrying the healthy status.
statuses.popreturns it instead of the unavailable status.
#440 fixed the same race in the
status pollingexamples inspec/impl/big_segments_spec.rb. There it caused a hang; here itdelivers the wrong first status.
Solution
GatedBigSegmentStore#get_metadatacounts the query, then waits untilthe test queues a result. The poller notifies observers of one result
before it starts its next query. So once query N has started, every
earlier result has been delivered, and nothing else happens until the
test queues another result.
The example now runs in three steps:
status_provider.status.make that query, because later status reads come from the cache.
observer received exactly one status, that the status is unavailable,
and that
status_provider.statusreturns it.None of these steps depends on how long a poll or notification takes:
status_poll_interval: 0.01only controls how quickly the pollermoves on to its next query.
report.
The example releases the store in
ensure. The client can't stop itspoller while a query is waiting.
Alternatives considered
next_status_matchingdoes inbig_segments_spec.rb. That would pass,but it would hide an extra or out-of-order notification, and it waits in
a sleep loop.
statusreturns. That changes SDK behavior to suit a test. The manageralso deliberately notifies outside
@poll_lock(seequery_store_status).Testing
With no code changes, the failure reproduces on JRuby 9.4.6 pinned to
one or two cores. Every failure was the CI one:
expected false, got trueat line 34.taskset -c 0)The next rows inject delays, gated by environment variables, into a
local copy of
big_segments.rband the spec. None of that code is inthis PR. The random delays apply at 5 points in the poll and notify
path, plus the example's status read and
add_observer.The new example still fails when the SDK is broken in each of these
ways:
The full suite passes on MRI 3.2 (
bundle exec rspec spec) and on JRuby9.4.6 (
--tag '~flaky', as in CI), with one exception.launchdarkly-server-sdk_spec.rb:5fails onmaintoo: its unbundledsubprocess can't find the gems in my local bundle path. RuboCop reports
no offenses on the changed files.
Not addressed here
The same timing can affect an application. If it reads the status and
then adds a listener while the client is starting, the listener can
receive the status that was just read. That's a redundant notification
rather than a wrong status, so this PR doesn't change it.
SDK-3424
Note
Overview
Ports CI and dependency maintenance from main: Dependabot now tracks
github-actions(monthly, with cooldown; LaunchDarkly actions excluded), Renovate config is removed, and workflow/composite action pins move to slash-style LaunchDarkly refs (contract-tests/v1, etc.) plus patch bumps fordownload-artifact,upload-artifact,ruby/setup-ruby, andactions/attest. README wording now recommends running the latest patched Ruby/JRuby on top of the minimum versions.Contract test harness gains service endpoints, wrapper client options in
ClientEntity, and advertises diagnostic-events, wrapper, service-endpoints, and tls:verify-peer capabilities.Fixes intermittent JRuby failure in
big_segment_store_status_provider sends status updatesby introducingGatedBigSegmentStore(metadata queries block until the test queues results) and sequencing the example withwait_for_queriesso observer assertions cannot race the status poller.Reviewed by Cursor Bugbot for commit 4f6cb7f. Bugbot is set up for automated code reviews on this repo. Configure here.
(cherry picked from commit d3f643e)