Skip to content

ui-common: Show mention suggestions after non-alphanumeric dividers#6530

Open
gpunto wants to merge 1 commit into
developfrom
fix/comma-separated-mention-suggestions
Open

ui-common: Show mention suggestions after non-alphanumeric dividers#6530
gpunto wants to merge 1 commit into
developfrom
fix/comma-separated-mention-suggestions

Conversation

@gpunto

@gpunto gpunto commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Goal

Typing a mention right after a comma (e.g. @john,@jane) did not reveal suggestions for the second mention. TypingSuggester only accepted the @ symbol at the start of the input or after whitespace, so any non-whitespace divider in front of it was rejected.

Reported during QA: Android QA - Mentions

Closes AND-1276

Implementation

  • TypingSuggester now accepts the symbol unless it is glued directly to a letter or digit. This covers commas and other separators (punctuation, brackets) while still rejecting cases like Hello@john and email addresses (john@example.com).

Testing

  • New TypingSuggesterTest cases: comma-divided mentions (@john,@jane), a bracket divider ((@john), and an email that must not trigger (john@example.com).

Summary by CodeRabbit

  • Bug Fixes
    • Improved mention detection in the message composer so typing suggestions no longer trigger on email-like text.
    • Mention suggestions now work more reliably around punctuation and when multiple mentions appear in a message.
    • Expanded typing behavior checks to cover additional real-world input patterns, including parentheses and comma-separated mentions.

@gpunto gpunto added the pr:bug Bug fix label Jun 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.93 MB 5.93 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.19 MB 11.19 MB 0.00 MB 🟢
stream-chat-android-compose 12.65 MB 12.65 MB 0.00 MB 🟢

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The isValidPosition logic in TypingSuggester.typingSuggestion is updated to allow the trigger symbol after any non-alphanumeric character (not just whitespace or start-of-input). Four new parameterized test cases are added to verify multi-mention, parenthesis-preceded, and email-like inputs.

TypingSuggester Trigger Validation

Layer / File(s) Summary
isValidPosition logic and new test cases
...composer/typing/TypingSuggester.kt, ...composer/typing/TypingSuggesterTest.kt
isValidPosition now checks that the character before the trigger is not a letter or digit (via getOrNull). New test cases cover @john,@jane, `@john, `@jane, (@john``, and john@example.com.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • GetStream/stream-chat-android#6526: Directly modifies the same TypingSuggester.typingSuggestion parsing flow, rejecting suggestions whose extracted token starts with whitespace.

Suggested reviewers

  • andremion

🐇 A comma or paren, no longer a wall,
The @ may follow them, one and all!
But letters and digits still block the way,
So emails won't trigger a mention today.
Hop hop, the suggester now works with flair! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: showing mention suggestions after non-alphanumeric dividers.
Description check ✅ Passed The description covers the required Goal, Implementation, and Testing sections and is complete enough for this change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/comma-separated-mention-suggestions

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.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/typing/TypingSuggesterTest.kt (1)

48-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a digit-adjacent negative case.

The new contract is “not attached to a letter or digit”, but these additions only lock down punctuation and letter/email cases. A case like 1@john or room2@john returning null would keep the isDigit() half of Line 45 covered.

Suggested test addition
             Arguments.of("Hello@john", null),
+            Arguments.of("1@john", null),
             Arguments.of("`@john`,`@jane`", TypingSuggestion("jane", 7 until 11)),
             Arguments.of("`@john`, `@jane`", TypingSuggestion("jane", 8 until 12)),
             Arguments.of("(`@john`", TypingSuggestion("john", 2 until 6)),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/typing/TypingSuggesterTest.kt`
around lines 48 - 51, Add a new negative test case in TypingSuggesterTest to
cover the “not attached to a letter or digit” contract for
TypingSuggester.suggestTypingSuggestion. Extend the existing parameterized data
near the current email and punctuation cases with an input like 1@john or
room2@john that must return null, so the isDigit() branch in the
typing-suggestion boundary check is explicitly covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/typing/TypingSuggesterTest.kt`:
- Around line 48-51: Add a new negative test case in TypingSuggesterTest to
cover the “not attached to a letter or digit” contract for
TypingSuggester.suggestTypingSuggestion. Extend the existing parameterized data
near the current email and punctuation cases with an input like 1@john or
room2@john that must return null, so the isDigit() branch in the
typing-suggestion boundary check is explicitly covered.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 52141207-2fc2-40ae-8b9f-0baf840a45e3

📥 Commits

Reviewing files that changed from the base of the PR and between 7b99f38 and f1b5870.

📒 Files selected for processing (2)
  • stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/typing/TypingSuggester.kt
  • stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/typing/TypingSuggesterTest.kt

@sonarqubecloud

Copy link
Copy Markdown

@gpunto gpunto marked this pull request as ready for review June 29, 2026 12:47
@gpunto gpunto requested a review from a team as a code owner June 29, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant