Skip to content

fix: Support the v2 harness persistence config shape and daemon mode in the contract test service - #2047

Open
joker23 wants to merge 3 commits into
skz/sdk-3083/persistent-store-write-back-recovery-contract-entityfrom
skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes
Open

joker23 wants to merge 3 commits into
skz/sdk-3083/persistent-store-write-back-recovery-contract-entityfrom
skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes

Conversation

@joker23

@joker23 joker23 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The contract test service only read the persistence configuration from the FDv2 shape (dataSystem.store.persistentDataStore). The v2 test harness sends it at the top level of the SDK configuration, so no persistent store was constructed at all under that harness: the SDK ran on the in-memory store, the $inited marker was never written, and every read-write persistence test failed.

  • Read the top-level persistentDataStore configuration and map it to the FDv1 featureStore option. One code path serves both the Redis and DynamoDB store types.
  • When a persistent store is configured with neither streaming nor polling, enable daemon mode (useLdd). This is the faithful translation of the harness's store-without-sources configuration, matches the Go test service (ExternalUpdatesOnly), and stops the entity from dialing production LaunchDarkly with the test credential in those scenarios.
  • Wait for the Redis client's ready event before handing it to the store. The entity disables the offline queue, so commands sent before the connection is ready fail immediately and can race the SDK's first writes.
  • Suppress the FDv2 no-data-source persistence tests: the FDv2 store-read mode with zero sources does not complete initialization yet.

Verified locally against the full v2 and v3 harness suites with Redis and DynamoDB running: all persistence tests pass (v2) or are explicitly suppressed (v3 no-data-source set).


Note

Overview
Fixes the Node server contract-test entity so v2 harness persistence scenarios work: it now reads top-level persistentDataStore (not only dataSystem.store) and maps it to FDv1 featureStore, with useLdd when there is a store but no streaming/polling (daemon mode).

Redis persistence is built with an explicit ioredis client (new dependency), waits for ready before the SDK writes, and closeStore tears down the connection on client shutdown or init failure. DynamoDB sets maxAttempts: 1 so harness outage simulations aren’t masked by AWS retries. makeSdkConfig is async and returns { config, closeStore }; FDv2 paths also enable dataSystem.useLdd when there are zero data sources.

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

@joker23
joker23 added this pull request to stack #2014 September 24, 2026 16:30
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 29338 bytes
Compressed size limit: 29500
Uncompressed size: 141229 bytes

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 32644 bytes
Compressed size limit: 34000
Uncompressed size: 117007 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25437 bytes
Compressed size limit: 44000
Uncompressed size: 165420 bytes

@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch from 56b3536 to 4bc7ae9 Compare September 24, 2026 22:17
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch from 4bc7ae9 to 1f50641 Compare September 25, 2026 14:55
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch from 1f50641 to 1882e76 Compare September 25, 2026 16:25
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch 2 times, most recently from 63b9615 to be9c442 Compare September 25, 2026 18:26
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch from be9c442 to ae114e1 Compare September 25, 2026 19:43
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch from ae114e1 to d1e36a1 Compare September 25, 2026 21:12
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch from d1e36a1 to 8ab31d4 Compare September 28, 2026 21:02
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch 2 times, most recently from 22a7c85 to cb43b4c Compare September 28, 2026 21:40
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch from cb43b4c to eb17a6e Compare September 28, 2026 22:16
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch from eb17a6e to c839a6c Compare September 28, 2026 23:23
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch from c839a6c to 1298c42 Compare September 28, 2026 23:26
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch 2 times, most recently from c974a03 to c727bd2 Compare September 29, 2026 15:22
@joker23
joker23 force-pushed the skz/sdk-3083/persistent-store-write-back-recovery-contract-fixes branch from c727bd2 to 13b6d2a Compare September 29, 2026 16:19
@joker23
joker23 marked this pull request as ready for review September 29, 2026 16:21
@joker23
joker23 requested a review from a team as a code owner September 29, 2026 16:21

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment thread packages/sdk/server-node/contract-tests/src/sdkClientEntity.ts

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.

1 participant