Skip to content

Conversation

@tanderson-ld
Copy link
Contributor

@tanderson-ld tanderson-ld commented Jan 27, 2026

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

SDK-1622

Describe the solution you've provided

Adds shouldPersist to change set classes.


Note

Introduces conditional persistence across data flow by adding shouldPersist to DataStoreTypes.FullDataSet and ChangeSet, and propagating it through ingestion, translation, storage, and recovery paths.

  • Core API: FullDataSet and ChangeSet now carry shouldPersist; equality/hashCode updated. DataModelSerialization.parseFullDataSet now returns iterable for constructing FullDataSet with persistence intent. FDv2ChangeSetTranslator.toChangeSet accepts shouldPersist.
  • Data sources: Polling/streaming paths wrap parsed data with shouldPersist=true. File data source builds FullDataSet(..., false). TestData adds shouldPersist(boolean) and uses it when initializing.
  • Stores: InMemoryDataStore tracks and preserves shouldPersist in init/apply/exportAll. WriteThroughStore only writes to persistent store when shouldPersist=true; legacy paths preserved. PersistentDataStoreConverter carries the flag; PersistentDataStoreWrapper passes it through init, and during recovery skips persisting external data when shouldPersist=false; cache-based recovery uses true.
  • Sorting/translation: DataModelDependencies.sortAllCollections/sortChangeset preserve shouldPersist.
  • Tests: Extensive updates/additions to cover new flag propagation, conditional persistence behavior, recovery semantics, and export preservation.

Written by Cursor Bugbot for commit 6e14b7f. This will update automatically on new commits. Configure here.

@tanderson-ld tanderson-ld requested a review from a team as a code owner January 27, 2026 15:37
Copy link

@cursor cursor bot left a comment

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 and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

public TestData shouldPersist(boolean shouldPersist) {
this.shouldPersist = shouldPersist;
return this;
}
Copy link

Choose a reason for hiding this comment

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

TestData.shouldPersist(false) doesn't prevent updates from persisting

Medium Severity

The shouldPersist(false) setting is only honored during the initial init() call via makeInitData(). Subsequent calls to update() and delete() use upsert() which always persists to the persistent store regardless of the shouldPersist setting. The documentation promises to "prevent test data from being written to persistent stores" but this only works for initial data, not for updates.

Additional Locations (2)

Fix in Cursor Fix in Web

* @param shouldPersist true if the data should be persisted to persistent stores, false otherwise
*/
public FullDataSet(Iterable<Map.Entry<DataKind, KeyedItems<TDescriptor>>> data) {
public FullDataSet(Iterable<Map.Entry<DataKind, KeyedItems<TDescriptor>>> data, boolean shouldPersist) {
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this change be a major version break?

Copy link
Member

Choose a reason for hiding this comment

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

I was assuming for v1 we would leave things alone, then for v2 we would specify this in the builders which instantiate the wrappers. So on the FDv2 path it would have persist = false.

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.

3 participants