test(ensemble): cover CDN pending updates and upload batch splitting#2259
Merged
Conversation
- Extract splitUploadFileBatches for testable background upload batching - Add tests for CDN _handlePendingUpdate app bundle sync and resume path - Expose minimal @VisibleForTesting hooks on CdnDefinitionProvider Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Risky behavior now covered
CDN update race condition (
19b50b2e): When CDN artifacts refresh in the background,_handlePendingUpdatemust syncappBundlefrom the in-memory cache and refresh translations before screens rebuild. Without this ordering, resumed apps can show stale resources/translations after a CDN push.Background upload batch splitting (
33829f9b): Uploads withbatchSizemust enqueue every chunk as a separate batch. Regressions here silently drop files from multi-batch selections.Test files added/updated
modules/ensemble/test/upload_batch_split_test.dart(new)modules/ensemble/test/cdn_provider_test.dart(extended)modules/ensemble/lib/util/upload_utils.dart— extractedsplitUploadFileBatchesmodules/ensemble/lib/action/upload_files_action.dart— uses shared batch helpermodules/ensemble/lib/framework/definition_providers/cdn_provider.dart— minimal@visibleForTestinghooksWhy these tests materially reduce regression risk
AppLifecycleState.resumed, then asserts translations are available after the pending-update handler runs (the exact failure mode from the race fix)._handlePendingUpdatecopies refreshed CDN cache intoEnsembleConfig.appBundleand clears the pending flag — preventing screens from rebuilding against stale global resources.Validation
All 16 tests pass.