Skip to content

feat: Add hook-environment-id capability and test - #412

Merged
kinyoklion merged 2 commits into
v3from
devin/1786565080-v3-hook-environment-id
Aug 12, 2026
Merged

feat: Add hook-environment-id capability and test#412
kinyoklion merged 2 commits into
v3from
devin/1786565080-v3-hook-environment-id

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Aug 12, 2026

Copy link
Copy Markdown
Member

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

Related issues

Ports #410 (v2) to v3. Companion SDK work: launchdarkly/python-server-sdk#484, launchdarkly/cpp-sdks#594.

Describe the solution you've provided

Same capability and test as #410, adapted to the v3 data system:

  • the hook-environment-id capability, documented in docs/service_spec.md
  • DataSystemOptionEnvironmentID(...), a top-level SDKDataSystemOption that makes every mock service of the data system (initializers and synchronizers, in all connection modes) send an X-LD-EnvID response header
  • an evaluation-series test (hooks/evaluation/provides the environment ID) asserting evaluationSeriesContext.environmentId on afterEvaluation, run against the SDK's default data source plus an explicit polling subtest for client-side/server-side-polling SDKs

Unlike v2, where the option wrapped the single SDKDataSource handler, the header is applied in createEndpoints, so both FDv2 initializers and synchronizers report it — matching production, where the header is on every flag-delivery response.

Describe alternatives you've considered

Making the option per-connection-mode. Environment ID is a property of the environment, not of a connection mode, so a single top-level option keeps call sites simple and covers every mode.

Additional context

Verified against the FDv2 contract services of python-server-sdk (#484) and cpp-sdks (#594): hooks/evaluation/provides the environment ID passes for both, in default (streaming) and polling modes.

Track hooks (trackSeriesContext.environmentId) are documented but not yet asserted, same as in v2.

Link to Devin session: https://app.devin.ai/sessions/bfe54128e2804a96bb100e6120e9a3ef
Requested by: @kinyoklion


Note

Overview
Adds the hook-environment-id capability so SDKs that read LaunchDarkly’s X-LD-EnvID from streaming/polling responses must surface it on hook series contexts (evaluationSeriesContext.environmentId, and trackSeriesContext when track hooks are supported). The harness documents this in service_spec.md and gates a new evaluation hook test on the capability.

Mock flag delivery now supports DataSystemOptionEnvironmentID(...), a top-level data-system option that wraps every initializer and synchronizer endpoint (all connection modes) to emit X-LD-EnvID, matching production flag-delivery responses in the v3 data system.

The test “provides the environment ID” evaluates a flag and asserts environmentId on the afterEvaluation hook payload, under the default data source and an explicit polling subtest for client-side / server-side-polling SDKs. Track-hook environmentId is documented but not asserted yet (same as v2).

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

Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
@kinyoklion kinyoklion self-assigned this Aug 12, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot added the devin-pr PRs created by Devin label Aug 12, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

@cursor review

@kinyoklion
kinyoklion marked this pull request as ready for review August 12, 2026 20:11
@kinyoklion
kinyoklion requested a review from a team as a code owner August 12, 2026 20:11

@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 7d94492. Configure here.

Comment thread sdktests/common_tests_hooks.go
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
@kinyoklion
kinyoklion merged commit 922989a into v3 Aug 12, 2026
5 checks passed
@kinyoklion
kinyoklion deleted the devin/1786565080-v3-hook-environment-id branch August 12, 2026 21:52
kinyoklion pushed a commit that referenced this pull request Aug 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[3.2.0-alpha.6](v3.1.1-alpha.6...v3.2.0-alpha.6)
(2026-08-12)


### Features

* Add contract test for streaming connection close on client shutdown
([#403](#403))
([0f91b2a](0f91b2a))
* Add contract tests for client-side secure mode hash (h query param)
([#376](#376))
([3e3012c](3e3012c))
* Add hook-environment-id capability and test
([#412](#412))
([922989a](922989a))
* Add migration op event context redaction tests
([#385](#385))
([34d68e9](34d68e9))
* add tests for handling redacting attributes prefixed with `/`
correctly
([#381](#381))
([ff6929d](ff6929d))
* Verify the in operator keeps booleans and numbers distinct
([fac2879](fac2879))


### Bug Fixes

* Correct privateAttributes JSON tag in context comparison params
([#392](#392))
([d9d2c01](d9d2c01))
* Fix capability guarding custom event redaction
([#387](#387))
([4d3419b](4d3419b))
* Only expect custom-event anonymous redaction for server SDKs
([#389](#389))
([032ae14](032ae14))
* prevent client side wrapper test datasystem from colliding with
primary connection mode
([#394](#394))
([fb40bc6](fb40bc6))

---
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-only PR** — bumps the package from `3.1.1-alpha.6` to
**`3.2.0-alpha.6`** in `.release-please-manifest.json`, `main.go`
(`versionString`), and adds the matching **CHANGELOG** section.
> 
> No harness or test code changes appear in this diff; the changelog
summarizes work already merged on the branch (new contract tests for
streaming shutdown, client-side secure mode `h` param,
hook-environment-id, migration/context redaction, `/`-prefixed attribute
redaction, and `in` operator type distinction, plus fixes for
`privateAttributes` JSON tagging, custom-event redaction capability
guards, server-only anonymous redaction expectations, and client-side
wrapper datasystem collision).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
104ac51. 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devin-pr PRs created by Devin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants