Skip to content

Comments

Fix token generation failure test flakiness#6136

Merged
VelikovPetar merged 1 commit intodevelopfrom
fix-flakiness
Feb 9, 2026
Merged

Fix token generation failure test flakiness#6136
VelikovPetar merged 1 commit intodevelopfrom
fix-flakiness

Conversation

@gpunto
Copy link
Contributor

@gpunto gpunto commented Feb 9, 2026

Goal

test_tokenGenerationFails intermittently fails in CI. That's because the token generator used in the test app throws when the backend response is unsuccessful, but that's incorrect. TokenProvider.loadToken is supposed to return an empty string if the token can't be generated.

Implementation

Return empty string instead of throwing

🎨 UI Changes

None

Testing

Running test_tokenGenerationFails should not fail

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling in token authentication processes. The system now gracefully manages failed requests and empty responses by returning safe defaults instead of throwing exceptions, enhancing application stability and reliability.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@gpunto gpunto added the pr:test Test-only changes label Feb 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.26 MB 5.26 MB 0.00 MB 🟢
stream-chat-android-offline 5.48 MB 5.48 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.63 MB 10.63 MB 0.00 MB 🟢
stream-chat-android-compose 12.85 MB 12.85 MB 0.00 MB 🟢

@gpunto
Copy link
Contributor Author

gpunto commented Feb 9, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Walkthrough

The fetchJwtToken function in JwtTestActivity now returns an empty string instead of throwing exceptions when HTTP responses are unsuccessful or the response body is null, shifting error handling from exception-based to return-value-based approaches.

Changes

Cohort / File(s) Summary
Error Handling Update
stream-chat-android-compose-sample/src/e2e/java/io/getstream/chat/android/compose/sample/ui/JwtTestActivity.kt
Modified fetchJwtToken to return empty string on failed HTTP responses and null response bodies instead of throwing exceptions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A gentle hop through error's way,
No exceptions thrown today,
Empty strings guide the flow so clear,
Graceful handling, naught to fear!

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes Goal and Implementation sections addressing the core issue, but lacks detailed Testing explanation, UI Changes content, and all required Contributor/Reviewer checklists. Complete the description by filling out the Contributor Checklist (CLA signature, assignee, Slack thread, branch/issue linking) and Reviewer Checklist sections required by the template.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: addressing test flakiness in token generation, which matches the changeset's purpose.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-flakiness

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gpunto gpunto marked this pull request as ready for review February 9, 2026 09:44
@gpunto gpunto requested a review from a team as a code owner February 9, 2026 09:44
@VelikovPetar VelikovPetar merged commit 6e0a8e8 into develop Feb 9, 2026
16 of 17 checks passed
@VelikovPetar VelikovPetar deleted the fix-flakiness branch February 9, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:test Test-only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants