Repository navigation
test: Wait for the failure status in the file synchronizer pins, so they hold on Windows - #260
Conversation
8cda80f to
d63a9a0
Compare
b3e3725 to
83375f8
Compare
There was a problem hiding this comment.
Stale comment
Risk: low.
Automated risk review (dry run): Low
This PR would be automatically approved.
Why: The diff only updates
FileSynchronizerReloadBehaviorTest.javaso two reload-failure pins wait for the first STATUS after a Windows double WatchService event, with no production, infra, or CI workflow changes.If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver
There was a problem hiding this comment.
Automated risk review (dry run): Low
This PR would be automatically approved.
Why: The only change is in FileSynchronizerReloadBehaviorTest.java, a test helper that waits for the first STATUS result so Windows dual WatchService events do not fail existing pins. No production, infrastructure, auth, or CI files are modified.
Sent by Cursor Approval Agent: Dry-Run PR Approver
…hey hold on Windows On Windows a rewrite with Files.write produces two file system events, and the legacy synchronizer reloads after each. The reload after the truncation reads the empty file as an empty document and delivers a change set before the malformed content is reported. The two pins that asserted the first result was the STATUS now consume results until the STATUS arrives.
83375f8 to
9374a4b
Compare
d63a9a0 to
0b90193
Compare
There was a problem hiding this comment.
Risk: low. Approved under SDK approval policy rules 1–4: not a release PR, author is an allowed SDK team member, and the diff is a single test helper with no GitHub Actions workflow changes. Cursor Bugbot completed with no findings that need human review.
Sent by Cursor Approval Agent: SDK - Pull Request Router and Approver
164ea0f
into
rlamb/overrides-java-reject-deleted
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…hey hold on Windows (#260) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - No changes of its own. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** This resolves Finding 1 of the Windows stability assessment for the Java overrides work: [plans/java-overrides-windows-test-stability.md](https://github.com/launchdarkly/sdk-scratchpad/blob/main/plans/java-overrides-windows-test-stability.md) in sdk-scratchpad. It is stacked on #259, the top of the overrides stack, so the PRs below it do not change. **Describe the solution you've provided** #220 added `FileSynchronizerReloadBehaviorTest`. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass: - `everyFailedReloadIsReportedAndLoggedAsThePlainDescription` - `failedReloadIsNotRetriedWithoutAFileChange` Why they fail on Windows: - Both tests rewrite the file with `Files.write`, which truncates the file and then writes it. - On Windows that produces two `WatchService` keys, and the legacy synchronizer reloads after each. - The reload after the truncation reads an empty file. The legacy loader picks the parser by content, so the empty file goes to the YAML parser, which reads it as an empty document. The synchronizer then delivers a change set with no flags. - The reload after the write then reports the malformed content. - The tests asserted that the first result after the rewrite is that `STATUS`, so they received the change set instead. A new helper, `awaitStatus`, consumes results until the first `STATUS` arrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still the `STATUS`. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change. To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and `checkstyleTest` is clean. I did not run this on Windows. java-core CI runs on Linux only. **Describe alternatives you've considered** Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe. **Additional context** Not in this PR: - **Finding 2.** That reload after the truncation also shows a defect on `main`, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR against `main`. - **Finding 3.** Build hygiene, all on `main`: - the compile tasks set no source encoding, so JDK 17 on Windows reports the box-drawing characters in three source files as unmappable; - the server pins common 2.6.0 and internal 1.13.0, which are not released yet. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=bodies --> <sub>Opened from termag</sub> [SDK-3246](https://launchdarkly.atlassian.net/browse/SDK-3246) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Fixes flaky failures on Windows** in `FileSynchronizerReloadBehaviorTest` by not assuming the first synchronizer result after an in-place file rewrite is the failure `STATUS`. > > Adds **`awaitStatus`**, which drains `synchronizer.next()` futures until a `SourceResultType.STATUS` arrives (within the existing timeout). On Windows, `Files.write` can emit two watch events (truncate then write), so an extra **change set** from an empty truncated file may arrive before the malformed-load status; Linux usually sees `STATUS` first. > > **`everyFailedReloadIsReportedAndLoggedAsThePlainDescription`** and **`failedReloadIsNotRetriedWithoutAFileChange`** now use `awaitStatus` instead of `await` for the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3246]: https://launchdarkly.atlassian.net/browse/SDK-3246?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…y it is listed under (#259) <!-- TERMAG_PR_BODY_BEGIN --> ## Update, 2026-12-03 - `launchdarkly-java-sdk-common` 2.6.0 and `launchdarkly-java-sdk-internal` 1.15.0 are released from `main` (#298, #299), and the pins are unchanged. - Verified against the Maven Central artifacts: every PR in the stack builds at its own head, with the contract test service, the server unit tests pass at the top (2348, with the 72 existing skips), and CI passes. ## Update, 2026-12-01 - Rebased onto `feat/overrides`, which has `main` merged into it again. From `main` it gets the 7.19.0 to 7.19.2 releases, `java-sdk-internal` 1.14.0, and the FDv2 fix that leaves out an empty selector (#261). The v3.2.0-alpha.21 contract tests check that fix, so CI failed three FDv2 streaming tests without it. - No changes of its own. It keeps #260, which merged into this branch: the file synchronizer pin tests wait for the failure status, so they hold on Windows. - Verified with the v3.2.0-alpha.21 harness that CI runs, with `common` 2.6.0 and `internal` 1.15.0 published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass at the top (2348, with the 72 existing skips); - the full v3 contract tests pass at the top (6457 tests ran). That includes the flag overrides suite and both flag listener suites. ## Update, 2026-11-13 - Rebased onto `feat/overrides`, which now includes #218 and #219 and has `main` merged into it. From `main` it gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and the `java-sdk-internal` 1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes. - New commit, "fix: Key each override by the key it is listed under, and reject one listed under another key": - Evaluation reads an override entry by the key it is listed under, but the all-flags state and events report the definition's own key. The file source deserialized each `flags` and `segments` entry as it was, so an entry with no `key` property made `allFlagsState()` throw a `NullPointerException` to the application, and an entry pasted under a new key with its old `key` property was served under one key and reported under the other. I confirmed both with a probe against the stack. - Each entry now takes the key it's listed under, as the Node, Go and Python sources key it. A `key` property is optional, and `FileOverrides.source()` says so. - The override layer also rejects a snapshot that lists a flag or segment under a key other than its own, the same way as one with a deleted item: the sink logs it and the overrides in effect stay. Only a custom source can produce such a snapshot now. Python added the same check after keelerm84's review of its port (python-server-sdk#527). Go, Node, .NET and Ruby don't have it yet. - Tests: `OverrideFileLoaderTest.entryIsKeyedByTheKeyItIsListedUnder` (JSON and YAML, flags and segments), `LDClientOverridesTest.fileEntryIsServedAndReportedUnderTheKeyItIsListedUnder`, `OverrideLayerTest.replacementThatListsAnItemUnderAnotherKeyIsRejectedAndTheLayerIsUnchanged` (including a definition with no key), and `OverrideSinkImplTest.snapshotThatListsAFlagUnderAnotherKeyIsRejected`. Removing the keying fails the first two, and removing the layer check fails the other two. - Verified at the top of the stack, with `common` and `internal` published locally from `feat/overrides`: - every PR in the stack compiles, with Javadoc, at its own head; - the server unit tests pass (2285, with the 72 existing skips); - the full v3 contract tests pass (6321 tests). That includes the flag overrides suite, with the deleted-entry tests of launchdarkly/sdk-test-harness#599, and both flag listener suites. **Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Related issues** Implements the "reject deleted entries" rule of the flag overrides spec, launchdarkly/sdk-specs#288 (Requirements 1.1.1.1, 1.2.8.1 and 1.3.6.2). This PR is stacked on #225 (`rlamb/overrides-java-contract-tests`) so that the PRs below it do not change. Retarget it when the stack merges. **Describe the solution you've provided** Before: a flag or segment entry with `"deleted": true` became a deleted placeholder. That was true both in an override file and in a snapshot from a custom source. The override layer stored it and the overlay served it, so the key looked absent: the LaunchDarkly definition was hidden from evaluation, from prerequisites and segment reads, and from the all-flags state, and the evaluation was not marked as override-affected. After: - **Sink (every source, including a custom one through `OverrideSink`).** The override layer never holds a deleted item. If a snapshot contains one, the SDK rejects the whole snapshot. The layer stays unchanged, no flag change listener is notified, and the SDK logs an Error naming the kind and the key, for example `Rejected an override snapshot because flag "f" is marked as deleted; the overrides in effect are unchanged`. A deleted item is either the placeholder that `DataKind.deserialize` produces or a model object marked as deleted. The check runs in `OverrideLayer.setAll` before the contents are swapped, and `OverrideSinkImpl` logs the rejection. The `OverrideSink` signature is unchanged and nothing is thrown to the source. - **File override source.** `OverrideFileLoader` fails the load when a file has a flag or segment entry marked as deleted, the same way it fails for a file that cannot be parsed. The overrides in effect stay, and the existing retry applies. The failure is logged like other load failures and names the file and the key: `Unable to load flags: file /path/overrides.json: flag "f" is marked as deleted; remove the entry to remove its override`. The check also fires when the duplicate keys handling would drop the entry, because the file still needs correcting. The source detects this while loading, before it calls the sink. - `"deleted": false` is an ordinary definition and still loads. - **Public docs.** `FileOverrides.source()` gains one sentence saying that a file with an entry marked as deleted fails to load and that an override is removed by removing its entry or deleting the file. `OverrideSink.setOverrides` gains one sentence saying that a snapshot with a deleted flag or segment is rejected. The experimental notice is unchanged on both. **The ordinary file data source is unchanged on purpose.** `FileDataSourceBase` and `FileDataSourceParsing` are not modified. Rejecting deleted entries there would be a breaking change, which is planned for a later major version. The check lives only in the override path (`OverrideFileLoader` and the override layer). A new test, `DataLoaderTest.entriesMarkedAsDeletedStillLoadAsDeletedItems`, pins the data source's current behavior: it still loads such entries as deleted items. **Tests** - `OverrideLayerTest`: `replacementThatContainsADeletedItemIsRejectedAndTheLayerIsUnchanged` replaces `deletedPlaceholderIsStoredAsIs`, which pinned the old behavior. It covers the deserialized placeholder and a model object marked as deleted, for both flags and segments. `definitionWithDeletedFalseIsStored` is new. - `OverrideSinkImplTest`: `snapshotWithADeletedFlagIsRejected`, `snapshotWithADeletedSegmentIsRejected` and `snapshotWithADeletedItemIsRejectedWhenNothingIsListening`. Each checks that the layer is unchanged, that no notification is sent, and that the Error is logged. - `OverrideFileLoaderTest`: `flagMarkedAsDeletedFailsTheLoad` and `segmentMarkedAsDeletedFailsTheLoad` cover JSON and YAML, with the exact message naming the file and the key. Also `entryMarkedAsDeletedFailsTheLoadEvenWhenItIsADroppedDuplicate` and `entriesWithDeletedFalseAreOrdinaryDefinitions`. - `FileOverrideSourceTest`: `flagMarkedAsDeletedFailsTheReloadAndKeepsTheOverrides` and `segmentMarkedAsDeletedFailsTheReloadAndKeepsTheOverrides`. In each, an in-place edit adds the deleted entry and changes another override. Nothing is supplied, the logged Error names the file and the key, and removing the entry recovers. `entriesWithDeletedFalseLoad` is also new. - `DataLoaderTest.entriesMarkedAsDeletedStillLoadAsDeletedItems`: the ordinary file data source behavior is pinned as unchanged. How I ran them, on JDK 17 (arm64): 1. Published the unreleased shared libraries locally from the monorepo. Common came from the #218 head (`b5deba0`) with `./gradlew publishToMavenLocal -Pversion=2.6.0 -PskipSigning=true` in `lib/shared/common`. Internal came from the #219 head (`0e7744f`) with `-Pversion=1.13.0` in `lib/shared/internal`. 2. In `lib/sdk/server`, ran the override and file data source classes with `./gradlew --max-workers=2 --no-daemon -Dorg.gradle.jvmargs=-Xmx2g test --tests '*Override*' --tests '*.integrations.File*' --tests '*.integrations.DataLoaderTest' --tests '*.integrations.FlagFileParser*' --tests '*.integrations.ClientWithFileDataSourceTest'`. Result: 343 tests in 29 classes, 0 failures. 3. Ran the full server `test` task (same Gradle options). Result: 2275 tests in 129 classes, 0 failures. The 72 skipped tests are the existing skips in `PersistentDataStoreWrapperTest`. 4. Ran `checkstyleMain checkstyleTest javadoc`: passed, with no new Javadoc warnings. 5. Checked that the new tests fail without the change. With the layer check and the loader check disabled, all 9 rejection tests fail, and the `deleted: false` tests and the data source pin still pass. With the sink's catch removed, the 3 sink tests fail. **Describe alternatives you've considered** - Checking only in the sink, with a separate pass over the snapshot. That pass would iterate the source's `Iterable` twice. Checking in `OverrideLayer.setAll` keeps it to one pass and makes the layer enforce its own invariant. - Dropping only the deleted entry. The spec requires rejecting the whole snapshot, so the layer is always exactly a snapshot that the source supplied. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-0575d1c54853058d7 project=java-core --> <sub>Opened from termag</sub> [SDK-3578](https://launchdarkly.atlassian.net/browse/SDK-3578) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Strengthens **flag/segment override** handling so invalid snapshots are rejected instead of partially applied. > > **Override layer** (`OverrideLayer.setAll`) now refuses any replacement that includes a **deleted** flag/segment (placeholder or `deleted: true`) or a definition **listed under a different key** than its own `key`. The prior snapshot stays in place; new `DeletedItemException` / `MismatchedKeyException` types carry clear messages. > > **Override sink** catches those failures, logs an error, and **does not** notify flag-change listeners. > > **File override source** (`OverrideFileLoader`) treats `"deleted": true` entries as a **load failure** (like a parse error), forces each `flags`/`segments` entry’s `key` to match the map key it’s listed under via `keyedBy`, and updates public docs on `FileOverrides` and `OverrideSink`. Removing an override is done by deleting the entry or file—not by marking deleted. > > The **ordinary file data source** is intentionally unchanged; a new test pins that deleted entries still load there. > > Extensive unit/integration tests cover rejection, logging, key consistency in evaluation vs `allFlagsState`, and file reload behavior. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7b2ebcf. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [SDK-3578]: https://launchdarkly.atlassian.net/browse/SDK-3578?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ


Update, 2026-11-13
feat/overrides, which now includes feat: Add the overrideAffected indicator to EvaluationReason #218 and feat: Count override-affected evaluations separately and send no individual events for them #219 and hasmainmerged into it. Frommainit gets the 7.18.0 release, CI on the latest v3 contract tests, flag change listener support in the contract test service, and thejava-sdk-internal1.12.1 and 1.12.2 fixes. A common 2.6.0 and internal 1.13.0 release from this branch needs those fixes.commonandinternalpublished locally fromfeat/overrides:Requirements
Related issues
This resolves Finding 1 of the Windows stability assessment for the Java overrides work: plans/java-overrides-windows-test-stability.md in sdk-scratchpad.
It is stacked on #259, the top of the overrides stack, so the PRs below it do not change.
Describe the solution you've provided
#220 added
FileSynchronizerReloadBehaviorTest. It pins how the legacy file data synchronizer reloads: on every file system event, reporting every failure, without retrying. On Windows, two of its tests fail every time; on Linux they pass:everyFailedReloadIsReportedAndLoggedAsThePlainDescriptionfailedReloadIsNotRetriedWithoutAFileChangeWhy they fail on Windows:
Files.write, which truncates the file and then writes it.WatchServicekeys, and the legacy synchronizer reloads after each.STATUS, so they received the change set instead.A new helper,
awaitStatus, consumes results until the firstSTATUSarrives, within the existing timeout. The three assertions that waited on the next result now use it. On Linux, the first result is still theSTATUS. The pins still describe the legacy behavior they set out to pin: the failure is reported, each failure is logged as the plain description, and nothing retries without a file change.To reproduce the Windows sequence on Linux, I made a scratch copy of the test that empties the file, waits 300 ms, and then writes the malformed content. Both pinned tests fail with the old assertions and pass with this change. The whole class passes on Linux as written. The file data, file synchronizer and file override test classes pass (144 tests), and
checkstyleTestis clean. I did not run this on Windows. java-core CI runs on Linux only.Describe alternatives you've considered
Writing the malformed content to a temporary file and moving it into place, which is one event on both platforms. That would pin a different writer than the one the tests describe.
Additional context
Not in this PR:
main, outside the overrides work. On Windows, every in-place rewrite of a legacy file data source's file briefly applies an empty data set: all flags are gone and defaults are served until the next reload. The assessment recommends a minimal fix: treat an empty file as a failed load, which keeps the last data. That changes the legacy data sources, so it belongs in its own PR againstmain.main:Opened from termag
SDK-3246
Note
Overview
Fixes flaky failures on Windows in
FileSynchronizerReloadBehaviorTestby not assuming the first synchronizer result after an in-place file rewrite is the failureSTATUS.Adds
awaitStatus, which drainssynchronizer.next()futures until aSourceResultType.STATUSarrives (within the existing timeout). On Windows,Files.writecan emit two watch events (truncate then write), so an extra change set from an empty truncated file may arrive before the malformed-load status; Linux usually seesSTATUSfirst.everyFailedReloadIsReportedAndLoggedAsThePlainDescriptionandfailedReloadIsNotRetriedWithoutAFileChangenow useawaitStatusinstead ofawaitfor the assertions that pin failed-reload reporting and logging. The behavioral expectations are unchanged—only how the tests wait for the right result.Reviewed by Cursor Bugbot for commit 0b90193. Bugbot is set up for automated code reviews on this repo. Configure here.