Skip to content

test(ensemble): cover CDN pending updates and upload batch splitting#2259

Merged
sharjeelyunus merged 1 commit into
mainfrom
cursor/missing-test-coverage-3ae8
Jun 5, 2026
Merged

test(ensemble): cover CDN pending updates and upload batch splitting#2259
sharjeelyunus merged 1 commit into
mainfrom
cursor/missing-test-coverage-3ae8

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented Jun 5, 2026

Risky behavior now covered

  1. CDN update race condition (19b50b2e): When CDN artifacts refresh in the background, _handlePendingUpdate must sync appBundle from the in-memory cache and refresh translations before screens rebuild. Without this ordering, resumed apps can show stale resources/translations after a CDN push.

  2. Background upload batch splitting (33829f9b): Uploads with batchSize must 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 — extracted splitUploadFileBatches
  • modules/ensemble/lib/action/upload_files_action.dart — uses shared batch helper
  • modules/ensemble/lib/framework/definition_providers/cdn_provider.dart — minimal @visibleForTesting hooks

Why these tests materially reduce regression risk

  • CDN resume test simulates a background manifest update deferred until AppLifecycleState.resumed, then asserts translations are available after the pending-update handler runs (the exact failure mode from the race fix).
  • CDN app bundle sync test verifies that _handlePendingUpdate copies refreshed CDN cache into EnsembleConfig.appBundle and clears the pending flag — preventing screens from rebuilding against stale global resources.
  • Upload batch tests lock in batch boundary behavior (including empty inputs), guarding the fix that prevented only the first Workmanager batch from being scheduled.

Validation

cd modules/ensemble && flutter test test/upload_batch_split_test.dart test/cdn_provider_test.dart test/upload_cancel_all_test.dart

All 16 tests pass.

Open in Web View Automation 

- 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>
@sharjeelyunus sharjeelyunus marked this pull request as ready for review June 5, 2026 16:06
@sharjeelyunus sharjeelyunus merged commit 5956ae4 into main Jun 5, 2026
5 checks passed
@sharjeelyunus sharjeelyunus deleted the cursor/missing-test-coverage-3ae8 branch June 5, 2026 16:06
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