Skip to content

feat: Support the file and test data source capabilities in the contract test service - #393

Open
kinyoklion wants to merge 2 commits into
rlamb/fdv2-persist-flag-v9from
rlamb/contract-tests-data-source-persistence-v9
Open

kinyoklion wants to merge 2 commits into
rlamb/fdv2-persist-flag-v9from
rlamb/contract-tests-data-source-persistence-v9

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Summary

The test harness gains tests that a file data source and a test data source do not write their data to a persistent store, and that they do when they request it (launchdarkly/sdk-test-harness#537). This change lets the server SDK's contract test service run them, on dotnet-server-sdk-v9, where TestData is not persisted by default (#390).

  • A file entry in dataSystem.initializers or dataSystem.synchronizers configures FileData.DataSource() with the given file paths. As a synchronizer it reloads the files when they change (AutoUpdate(true)).
  • A testData synchronizer configures a TestData source whose flags each serve one value to every context (ValueForAll), and the updateTestData command changes one of its flags. A configuration may have one testData synchronizer, and no testData initializer, as the service spec says.
  • A file entry needs at least one file path, and updateTestData needs a flag key; the service rejects the configuration or the command otherwise.
  • persist: true on either entry calls ShouldPersist(true).
  • The service advertises file-data-source, test-data-source, and data-source-persist-opt-in.

BuildSdkConfig and CreateSynchronizer become instance methods, so that the client entity keeps its test data source for the command.

Dependencies

Testing

Against a local merge of this branch and #392, with Redis, DynamoDB local, and Consul in Docker, the harness branch's data source persistence tests pass for all three stores.

To check that the tests catch the defects they target, defects were put into the SDK one at a time, and each failed the tests that target it for every store: the write-through store's persistence check removed; upserts always persisted, as Java's FDv1 adapter does; the recovery write back done whatever the persistence indicator; persisting everything once anything was persisted; and the store mode ignored for data that requests persistence.

Opened from termag


Note

Overview
The .NET server SDK contract test service now implements harness scenarios for file and test data sources and for opt-in persistence to the FDv2 data store.

Harness JSON can configure a file block on data-system initializers (one-shot load) or synchronizers (reload on change via AutoUpdate). A testData synchronizer seeds flags with ValueForAll, and the new updateTestData command mutates a single flag on that source. Optional persist: true maps to ShouldPersist(true) on both source types; invalid configs (missing file paths, duplicate test-data synchronizers, or updateTestData without a test source) fail fast.

BuildSdkConfig / synchronizer wiring are instance methods so each client keeps a handle to its lone TestData instance for runtime updates. The service advertises file-data-source, test-data-source, and data-source-persist-opt-in so the harness can run the new persistence suite.

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

@kinyoklion

Copy link
Copy Markdown
Member Author

bugbot review

@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.

Stale Bugbot comment from a previous run.

…ract test service

From the review of this change:

- testData is a synchronizer only, and a configuration may have one: the
  updateTestData command addresses the client's test data source, and a test
  data initializer is disposed when the initializer phase ends.
- A file data source needs at least one file path. With none it would load
  an empty data set, which hides LaunchDarkly data in memory or, when
  persisted, empties the store.
- updateTestData without a flag key is rejected.
@kinyoklion

Copy link
Copy Markdown
Member Author

bugbot review

@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e8c9f4a. Configure here.

@kinyoklion
kinyoklion marked this pull request as ready for review November 3, 2026 23:26
@kinyoklion
kinyoklion requested a review from a team as a code owner November 3, 2026 23:26

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