feat(im): add +chat-list and --exclude-muted to filter muted chats#820
feat(im): add +chat-list and --exclude-muted to filter muted chats#820shifengjuan-dev wants to merge 1 commit into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new ChangesIM Chat List and Mute Filtering
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
883d5bf to
7b081dc
Compare
Change-Id: I22221ac5835667f58cbd40b34de75825d2445d1c
7b081dc to
cc80539
Compare
Summary
im +chat-listshortcut wrappingGET /open-apis/im/v1/chats(previously not exposed via lark-cli).--exclude-mutedto both+chat-searchand+chat-list: client-side filter that callsPOST /open-apis/im/v1/chat_user_setting/batch_get_mute_statusafter each page and dropsis_muted=truechats.shortcuts/im/mute_filter.gowith pure helpers and an orchestrator (MaybeApplyMuteFilter) shared by both shortcuts.Design highlights
--page-size; the JSON output adds afiltersub-object withapplied/skipped/fetched_count/returned_count/filtered_count/hintso AI/scripts can chainpage_token.fetched_count == returned_count + filtered_countalways holds.--as bot):batch_get_mute_statusis UAT-only, so the filter is skipped withfilter.skipped=true, skip_reason="bot_identity_no_mute_data". All chats returned unfiltered.--search-types public_not_joinedalone: pre-skipped withskip_reason="all_non_member_search_types"(the batch call would 100% returnnot_a_member).filtered_count; surfaced in thehinttext only.--exclude-mutednever injectssearch_typesor any other field into the search/list request. Verified via dry-run tests.BatchGetChatMuteStatusalready has metrics (mute_status.go:60-62). CLI does not duplicate.Output schema (only when
--exclude-mutedis set){ "chats": [...], "filter": { "applied": "exclude_muted", "skipped": false, "fetched_count": 20, "returned_count": 19, "filtered_count": 1, "hint": "Filtered out 1 muted chat(s) on this page (19 remaining, including 2 non-member public group(s)); use --page-token to fetch more." } }Hint is shown in
--format json(field) and--format pretty(line below summary). Not shown in--format table/ndjson/csv— consistent with the existing pagination hint behavior.Test plan
go test ./shortcuts/im/...— passesgo build ./...— cleango vet ./...— clean+chat-list --dry-run— endpoint + params correct+chat-search --query foo --exclude-muted --dry-run— request body unchanged, nosearch_typesinjection+chat-search --search-types public_not_joined --exclude-muted --dry-run—search_typespresent as user requested, no auto-injection+chat-list --helpexposes--exclude-mutedwith correct descriptionbatch_get_mute_statusis GA (currently UAT-only)--as botcall confirmsfilter.skipped=truewithbot_identity_no_mute_dataRisks
batch_get_mute_statusis currently UAT-only (TAT/bot rejected at the API gateway). The CLI handles this gracefully (bot identity skips the filter), but the API itself must be GA before this feature is broadly usable.im:chat:readscope is assumed to coverchat_user_settingreads. If the gateway requires a separate scope, users will see99991679/99991672and we will need a follow-up to add the right scope.meta_data.chat_idfrom each item; if the v2 search response schema changes the wrapping, the filter helper needs updating.Spec docs
docs/specs/2026-05-09-im-chats-filter-muted-design.mddocs/specs/2026-05-09-im-chats-filter-muted-plan.mdThese reference the earlier exploration at
docs/specs/2026-04-28-search-filter-muted-chats-design.md— this PR is the CLI-side variant (option D — pure transparent reporting) that does not block on the search-team-side option B.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests