Skip to content

chore(test-app): start a second environment when a second key is set - #428

Open
abelonogov-ld wants to merge 6 commits into
andrey/test-app-event-storagefrom
andrey/test-app-two-environments
Open

abelonogov-ld wants to merge 6 commits into
andrey/test-app-event-storagefrom
andrey/test-app-two-environments

Conversation

@abelonogov-ld

@abelonogov-ld abelonogov-ld commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #427.

What

When local.properties sets launchdarkly.secondaryMobileKey, the client is started with that key as a secondary environment through LDConfig.Builder.secondaryMobileKeys. An Env spinner next to Persistence chooses which environment's client the buttons use, through LDClient.getForMobileKey. Without the key the spinner stays hidden and nothing changes.

The selected environment is used by:

  • Evaluate Flag and its flag listener;
  • Track;
  • Eval+Kill 5s, Eval+Kill now, Eval+Crash now, Over-Refresh Eval and Fill 3 Batches;
  • Post 20 MB (which key it posts with);
  • the connection status;
  • the event storage view, which shows that environment's own directory.

These reach both environments whichever is selected, because the SDK applies flush, setOffline, setOnline, identify and close to every environment it started: Flush, Offline, Identify, and the restart a persistence change makes. The status line says so.

The buttons now get their client through doSafeClientAction(client -> ...) instead of reading ldClient after a null check. Status and flag listeners are registered on every environment and show the selected one's connection. The choice is saved in shared preferences like the persistence choice.

Testing

On the API 23 emulator with both keys set:

  • The Env spinner appears.
  • Selecting Secondary switches the connection status to that environment's own information.
  • Track wrote a pending log into the secondary environment's directory only, and the storage view showed it.
  • Flush delivered it.
  • Switching back to Primary showed the primary environment's status and directory again.

Note

Overview
Release 5.18.0 bumps version metadata and documents FDv2 usePost support in the changelog.

The SDK adds HttpConfigurationBuilder.usePost / shouldUsePost() so FDv2 streaming and polling send evaluation context in an HTTP POST body instead of the old FDv2 REPORT path or a base64 context segment on GET. With the data system enabled, useReport is documented as ineffective for FDv2 (one-time warning); FDv1 fallback still uses REPORT when usePost is on. LDConfig.Builder.payloadFilter() validates a filter key and threads it through data-source build inputs as a filter query parameter on FDv1/FDv2 streaming and polling. Contract tests and the Makefile adopt harness v3.2.0-alpha.10 and new conformance tags (client-use-post, filtering).

The test app can start a secondary environment via launchdarkly.secondaryMobileKey and an Env spinner so eval/track/kill flows, connection status, storage inspection, and oversized posts target the selected client while flush/offline/identify/close still apply to all started environments.

Reviewed by Cursor Bugbot for commit 81c6f30. Bugbot is set up for automated code reviews on this repo. Configure here.

joker23 and others added 4 commits October 30, 2026 16:53
## Summary

- Adds a `usePost` option (default `false`) to
`HttpConfigurationBuilder`. When the FDv2 data system is configured,
polling and streaming requests use POST with the evaluation context JSON
in the request body instead of GET with the base64url context in the URL
path. This keeps the context out of URL-based request logs and CDN logs.
- The FDv1 fallback synchronizer sends REPORT when `usePost` is enabled,
because the FDv1 endpoints do not support POST.
- `useReport` no longer affects FDv2 requests. The SDK logs one warning
when it is set together with the data system. Legacy (non-data-system)
FDv1 behavior is unchanged.
- Contract tests: the test service declares the `client-use-post`
capability, maps the harness's `clientSide.usePost` parameter, and the
v3 harness is bumped to v3.2.0-alpha.10 (the release that added the POST
test variants). The bump also pulls in stricter events-redaction tests
that expose a pre-existing bug in `launchdarkly-java-sdk-internal`
(attribute names containing `/` are not escaped as attribute references
in `redactedAttributes`). The three affected test groups are suppressed
in `testharness-suppressions-fdv2.txt` and tracked by SDK-3338; the
suppressions should be removed when that fix ships.

Implements CSFDV2 Requirement 2.1.3 (usePost option) and 2.1.4
(useReport ignored with a warning under the FDv2 configuration).

Verified locally: full unit suite (752 tests) green; contract tests
green on an emulator (v2 suite, and v3 at v3.2.0-alpha.10 with the
suppressions above - all POST variants pass).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> Adds a **`usePost`** HTTP option (default off) so that when the FDv2
data system is enabled, polling and streaming send the evaluation
context in a **POST** body instead of a **GET** URL with a base64
context segment—keeping context out of URL/CDN logs. FDv2 paths that
previously used **REPORT** under `useReport` now use **POST**;
**ETag**/`If-None-Match` caching stays on **GET** only.
> 
> With the data system, **`useReport` no longer changes FDv2 traffic**;
the builder logs a **one-time warning** that requests stay GET unless
`usePost` is on. **FDv1 fallback** still has no POST endpoint, so
enabling `usePost` maps to **REPORT** with a body there.
> 
> Contract testing advertises **`client-use-post`**, wires harness
`clientSide.usePost`, and bumps the v3 harness to **v3.2.0-alpha.10**.
Three new v3 event-redaction cases are **suppressed** pending an
internal SDK fix (SDK-3338).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
913ef16. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
🤖 I have created a release *beep* *boop*
---


##
[5.18.0](5.17.0...5.18.0)
(2026-10-30)


### Features

* add support for `usePost` option for FDv2
([#411](#411))
([d5049ae](d5049ae))

---
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 5.18.0** — version-only changes from Release Please: bumps
the package version from **5.17.0** to **5.18.0** in
`.release-please-manifest.json` and `gradle.properties`, and adds a
matching **CHANGELOG** section dated 2026-10-30.
> 
> The new changelog entry records the headline feature shipped in this
release: **FDv2 `usePost` support** ([#411]), allowing clients to send
context in the POST body instead of on the query string when configured.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3229755. 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>
Co-authored-by: Cursor <cursoragent@cursor.com>
launchdarkly.secondaryMobileKey in local.properties adds a secondary mobile key to the client's
LDConfig. An Env spinner then chooses which environment's client the buttons, the connection status,
Post 20 MB and the event storage view use. Flush, Offline, Identify and the persistence restart
still reach both, as the SDK applies them to every environment.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld
abelonogov-ld requested a review from a team as a code owner November 11, 2026 01: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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 186c9f1. Configure here.

This branch has not been deployed

No deployments
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.

2 participants