Skip to content

chore: Port CI, tooling and test changes from main - #522

Merged
keelerm84 merged 10 commits into
feat/9.xfrom
mk/SDK-3806/sync-main-chores
Dec 3, 2026
Merged

keelerm84 merged 10 commits into
feat/9.xfrom
mk/SDK-3806/sync-main-chores

Conversation

@keelerm84

@keelerm84 keelerm84 commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

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

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission
    guidelines
  • I have validated my changes against all supported platform
    versions
Implementation details

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.

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 for download-artifact, upload-artifact, ruby/setup-ruby, and actions/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 updates by introducing GatedBigSegmentStore (metadata queries block until the test queues results) and sequencing the example with wait_for_queries so 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)

kinyoklion and others added 10 commits December 2, 2026 21:05
#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)
…github/actions/publish (#511)

(cherry picked from commit b89031c)
…#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)
@keelerm84
keelerm84 requested a review from a team as a code owner December 3, 2026 14:46

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Open in Web View Automation 

Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver

@keelerm84
keelerm84 merged commit 83844fa into feat/9.x Dec 3, 2026
10 checks passed
@keelerm84
keelerm84 deleted the mk/SDK-3806/sync-main-chores branch December 3, 2026 17:44
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.

4 participants