Skip to content

test: fix DemoReviewGapsTest invitation flake on Android 36 - #8

Closed
thisislvca wants to merge 3 commits into
refactor/rename-to-albafrom
test/fix-demo-invitations-api36
Closed

thisislvca wants to merge 3 commits into
refactor/rename-to-albafrom
test/fix-demo-invitations-api36

Conversation

@thisislvca

@thisislvca thisislvca commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Fixes the intermittent API 36 failure of DemoReviewGapsTest.invitationAcceptAndRequestApprovalWorkThroughTheirSheets.

On failure the semantics dump showed the sheet frozen on its first frame (progress bar, no invitations or participants) while the repository had already returned the data. The sheet load resumed on the IO thread, so Compose state was written off the main thread and the update was lost. Shared-sheet view-model calls now hand results back on the main thread. FailureCapture also logs every compose root to logcat, since managed-device additional output was not being collected.

Sheets assign Compose state right after the view-model call returns. With the
IO hop resuming on the IO thread under the Compose test dispatcher, the writes
raced the recomposer and the sheet stayed on its first frame (spinner, no
content), which made DemoReviewGapsTest time out intermittently.
@thisislvca
thisislvca force-pushed the test/fix-demo-invitations-api36 branch from 835addc to 82fbb22 Compare October 17, 2026 20:04
@thisislvca

Copy link
Copy Markdown
Owner Author

Closing in favor of a test-side fix. The diagnosis here is right: the invitation result was applied off the main thread, so the sheet never updated. But that only happens because DemoReviewGapsTest uses the deprecated v1 Compose test rule, whose UnconfinedTestDispatcher resumes coroutines inline on the IO thread. In the app, LaunchedEffect resumes on the main thread. Instead of changing AlbaViewModel, the tests will move to the v2 rules (androidx.compose.ui.test.junit4.v2), which should also fix the other 'UI never updates' flakes.

@thisislvca thisislvca closed this Oct 17, 2026
@thisislvca
thisislvca deleted the test/fix-demo-invitations-api36 branch October 17, 2026 20:50
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.

1 participant