Skip to content

feat(im): add at-chatter-ids filter to +messages-search#612

Open
arnold9672 wants to merge 1 commit intolarksuite:mainfrom
arnold9672:feat/im-messages-search-at-chatter-ids
Open

feat(im): add at-chatter-ids filter to +messages-search#612
arnold9672 wants to merge 1 commit intolarksuite:mainfrom
arnold9672:feat/im-messages-search-at-chatter-ids

Conversation

@arnold9672
Copy link
Copy Markdown

@arnold9672 arnold9672 commented Apr 22, 2026

Summary

Add a new filter --at-chatter-ids to the im +messages-search shortcut so users can narrow search results to messages that @mention specific users. Matched results naturally include messages that @all.

Changes

  • shortcuts/im/im_messages_search.go: register the --at-chatter-ids flag; parse comma-separated ou_* user IDs, validate via common.ValidateUserID, and pass as filter.at_chatter_ids in the search body
  • shortcuts/im/coverage_additional_test.go: add two table-driven sub-tests (valid IDs populate the filter; malformed ID returns a validation error)
  • shortcuts/im/im_messages_search_execute_test.go: register the new flag in the execute-test runtime helper
  • skills/lark-im/references/lark-im-messages-search.md: document the flag and add a usage example

Test Plan

  • make unit-test passes locally
  • Manual verification: lark-cli im +messages-search --query "release" --at-chatter-ids ou_xxx,ou_yyy — confirm the request payload in --dry-run includes filter.at_chatter_ids: [ou_xxx, ou_yyy]
  • Manual verification: lark-cli im +messages-search --at-chatter-ids bad_id — confirm it surfaces invalid user ID format

Related Issues

N/A

Summary by CodeRabbit

Release Notes

  • New Features

    • Added --at-chatter-ids flag to filter instant messages by explicitly mentioned user IDs (comma-separated format).
  • Tests

    • Enhanced test coverage for the new flag validation and request building.

Add --at-chatter-ids flag to shortcuts/im/im_messages_search.go that
passes filter.at_chatter_ids to the search API, restricting results to
messages that @mention any of the given user open_ids. Messages that
@ALL are included automatically.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added domain/im PR touches the im domain size/M Single-domain feat or fix with limited business impact labels Apr 22, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 27456281-b3a6-4db8-b224-fe55474b7a48

📥 Commits

Reviewing files that changed from the base of the PR and between 543a836 and 3b5dfea.

📒 Files selected for processing (4)
  • shortcuts/im/coverage_additional_test.go
  • shortcuts/im/im_messages_search.go
  • shortcuts/im/im_messages_search_execute_test.go
  • skills/lark-im/references/lark-im-messages-search.md

📝 Walkthrough

Walkthrough

Added a new CLI flag --at-chatter-ids to the ImMessagesSearch command that filters messages by comma-separated user IDs, with CSV parsing and validation. Includes implementation, test coverage, test helper updates, and documentation.

Changes

Cohort / File(s) Summary
Implementation
shortcuts/im/im_messages_search.go
Added --at-chatter-ids CLI flag declaration and implemented parsing logic that splits CSV input, validates each ID as a valid user ID, and populates the filter["at_chatter_ids"] in the request body.
Test Coverage
shortcuts/im/coverage_additional_test.go
Added two new subtests validating at-chatter-ids parameter handling: one verifying correct parsing of comma-separated user IDs into the filter, and another ensuring invalid user ID tokens are rejected with an appropriate error message.
Test Helper
shortcuts/im/im_messages_search_execute_test.go
Registered "at-chatter-ids" as a string flag in the test helper's cobra command setup to support flag parsing during test execution.
Documentation
skills/lark-im/references/lark-im-messages-search.md
Documented the new --at-chatter-ids <ids> parameter, describing it as an optional flag for filtering messages by mentioned users' open_ids (comma-separated), with note that results may also include @all mentions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A fluffy filter hops on by,
Comma-separated IDs multiply!
At-chatter-ids now validate with care,
Tests and docs with features to share! 🚀

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(im): add at-chatter-ids filter to +messages-search' accurately and concisely summarizes the main change—adding a new CLI filter flag to the messages-search command.
Description check ✅ Passed The description includes all required template sections with substantial content: a clear summary, detailed changes list, comprehensive test plan with checkboxes, and related issues reference.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/im PR touches the im domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants