Skip to content

Conversation

@tanderson-ld
Copy link
Contributor

@tanderson-ld tanderson-ld commented Feb 2, 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

Note

Low Risk
Primarily adds new test-only integration code and tests, with minimal surface-area changes to existing TestData (constructor visibility and docs).

Overview
Adds TestDataV2, a new in-memory test data provider that implements the FDv2 Synchronizer API, emitting an initial full ChangeSet and subsequent partial ChangeSets on update()/delete(), plus optional simulated status events and awaitPropagation helpers.

Reuses the existing TestData.FlagBuilder for flag construction by loosening its constructors’ visibility, and adds comprehensive unit tests validating initialization, updates/deletes, and flag JSON output.

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

@tanderson-ld tanderson-ld requested a review from a team as a code owner February 2, 2026 16:10
* @param condition condition to poll; when it returns true, this method returns
* @throws InterruptedException if the current thread is interrupted while waiting
* @throws AssertionError if the condition does not become true before the timeout
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: Not sure if these helpers are really warranted, but it seems to make usability better.

@tanderson-ld tanderson-ld changed the title chore: update TestData to implement Synchronizer chore: adds TestDataV2 to implement Synchronizer Feb 2, 2026
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 2 potential issues.


ModelBuilders.FlagBuilder expectedFlag = flagBuilder("flag1").version(1).salt("")
.on(true).offVariation(1).fallthroughVariation(0).variations(true, false);
assertJsonEquals(flagJson(expectedFlag, 2), flagJson(flag1));
Copy link

Choose a reason for hiding this comment

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

Test assertion uses incorrect expected version number

Medium Severity

The addsFlag() test asserts against flagJson(expectedFlag, 2) but the flag being added is a NEW flag created after initialization, which gets version 1 (not 2). The update() method calculates version as oldVersion + 1 where oldVersion = 0 for new flags. This is inconsistent with the verifyFlag() helper at line 256 which correctly uses version 1 for the same scenario. The assertion compares mismatched versions, making the test either fail or validate incorrectly.

Fix in Cursor Fix in Web

}
return CompletableFuture.anyOf(shutdownFuture, future).thenApply(r -> (FDv2SourceResult) r);
}
}
Copy link

Choose a reason for hiding this comment

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

Split synchronized blocks create unnecessary race condition window

Low Severity

The next() method uses two separate synchronized (queueLock) blocks when they could be combined into one. Releasing and reacquiring the lock between setting initialSent and processing the queue creates a window where concurrent callers could interleave. If multiple threads call next() simultaneously, the second thread could steal the initial changeset from the first thread. The two blocks can be combined since makeFullChangeSet() doesn't create a deadlock risk with the current lock ordering.

Fix in Cursor Fix in Web

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