Skip to content

feat(im): format feed group error handling - #1308

Merged
zhumiaoxin merged 1 commit into
larksuite:mainfrom
zhumiaoxin:feat/feed-group
Jun 7, 2026
Merged

feat(im): format feed group error handling#1308
zhumiaoxin merged 1 commit into
larksuite:mainfrom
zhumiaoxin:feat/feed-group

Conversation

@zhumiaoxin

@zhumiaoxin zhumiaoxin commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Improve formatted error output for feed group flows so validation failures return structured, parseable errors with clear parameter attribution.

Changes

  • Standardize feed group parameter validation failures as structured validation errors
  • Add clear error messages and parameter markers for missing or invalid inputs, such as --feed-group-id, --feed-id, pagination flags, and time filters
  • Ensure dry-run validation failures produce actionable error output instead of misleading request previews

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark-cli im <feed-group command> error output works as expected

Related Issues

  • None

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 83244244-5fce-48fa-be8c-ef634312019a

📥 Commits

Reviewing files that changed from the base of the PR and between 6aae8ee and 01cd749.

📒 Files selected for processing (17)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_feed_group_item_test.go
  • shortcuts/im/im_feed_group_items.go
  • shortcuts/im/im_feed_group_list.go
  • shortcuts/im/im_feed_group_list_item.go
  • shortcuts/im/im_feed_group_list_test.go
  • shortcuts/im/im_feed_group_query_item.go
  • shortcuts/im/im_flag_cancel.go
  • shortcuts/im/im_flag_create.go
  • shortcuts/im/shortcuts.go
  • skill-template/domains/im.md
  • skills/lark-im/SKILL.md
  • skills/lark-im/references/lark-im-feed-group-list-item.md
  • skills/lark-im/references/lark-im-feed-group-list.md
  • skills/lark-im/references/lark-im-feed-group-query-item.md
  • skills/lark-im/references/lark-im-feed-groups.md
  • skills/lark-im/references/lark-im-flag-cancel.md
✅ Files skipped from review due to trivial changes (7)
  • shortcuts/im/shortcuts.go
  • shortcuts/im/im_flag_cancel.go
  • skills/lark-im/references/lark-im-feed-group-list.md
  • skills/lark-im/references/lark-im-feed-group-query-item.md
  • skills/lark-im/references/lark-im-feed-group-list-item.md
  • skills/lark-im/SKILL.md
  • shortcuts/im/im_flag_create.go
🚧 Files skipped from review as they are similar to previous changes (8)
  • skill-template/domains/im.md
  • shortcuts/im/im_feed_group_items.go
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_feed_group_query_item.go
  • shortcuts/im/im_feed_group_list_item.go
  • shortcuts/im/im_feed_group_list.go
  • shortcuts/im/im_feed_group_list_test.go
  • shortcuts/im/im_feed_group_item_test.go

📝 Walkthrough

Walkthrough

Adds three IM CLI shortcuts (+feed-group-list, +feed-group-list-item, +feed-group-query-item), shared enrichment/render helpers, pagination and validation logic, dry-run support, comprehensive tests, and documentation updates.

Changes

Feed group CLI shortcuts and API integration

Layer / File(s) Summary
Shortcut registration and test assertions
shortcuts/im/shortcuts.go, shortcuts/im/helpers_test.go
The three new feed-group shortcuts are registered in Shortcuts() and added to the shortcut validation test expectations.
Shared feed group items enrichment and rendering
shortcuts/im/im_feed_group_items.go
Helpers deduplicate feed_ids, resolve chat contexts via chats/batch_query, enrich items with chat_name, render formatted tables with RFC3339-converted update_time, and warn when resolution fails.
Feed group list shortcut implementation
shortcuts/im/im_feed_group_list.go
+feed-group-list validates pagination/time-window flags, always includes page_token in requests, and implements dual-list merging across pages with bounds clamping and infinite-loop safeguards.
Feed group list tests
shortcuts/im/im_feed_group_list_test.go
Validates --page-all merges groups and deleted_groups, ensures page_token is always sent, tests validation errors, dry-run shapes, loop guard behavior, and API error propagation.
Feed group list-item & query implementations
shortcuts/im/im_feed_group_list_item.go, shortcuts/im/im_feed_group_query_item.go
+feed-group-list-item and +feed-group-query-item add flag validation, query/body/path builders, dry-run metadata, execute logic with enrichment and pagination, and registry wiring.
Comprehensive tests for feed-group items and queries
shortcuts/im/im_feed_group_item_test.go
Tests list-item and query-item behavior: enrichment, pagination merging and guards, token precedence, dry-run and validation shapes, API error handling, and pretty-table output including time formatting.
Shortcut wiring and flag description updates
shortcuts/im/im_flag_cancel.go, shortcuts/im/im_flag_create.go
Consolidates description formatting and clarifies --flag-type feed semantics in help text.
Complete API reference and CLI docs
skills/lark-im/references/*, skills/lark-im/SKILL.md, skill-template/domains/im.md
Documents raw feed-group APIs, shortcut-only reads, request/response shapes, enums, permission scopes, and updates skill docs to include feed-group/tag concepts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • larksuite/cli#1102: Implements overlapping IM feed-group shortcuts, helpers, and tests (direct code-level overlap).
  • larksuite/cli#1273: Also updates IM shortcut registry and helpers_test.go expectations for newly-added IM shortcuts.
  • larksuite/cli#770: Prior IM shortcut registry/test changes that touch similar files.

Suggested labels

feature

Suggested reviewers

  • YangJunzhou-01
  • fangshuyu-768
  • liangshuo-1

Poem

A rabbit hops through feed groups bright, 🐰
Tokens ripple, pages merge in night,
Names resolve and time turns clear,
Tests keep loops from endless flight,
Shortcuts bloom — the CLI cheers.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.47% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title partially relates to the changeset, referring to error handling for feed group features, but it does not clearly summarize the main changes which include implementing three new feed group shortcuts with pagination, enrichment, and comprehensive test coverage. Consider a more specific title that highlights the primary implementation: e.g., 'feat(im): add feed group list, list-item, and query-item shortcuts with enrichment and pagination' would better represent the bulk of the work.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description adequately addresses the stated objectives about improving error output for feed group flows, but significantly underrepresents the actual scope of changes, which include three new shortcut implementations, enrichment logic, pagination behavior, and extensive test coverage totaling 1,000+ lines of code.
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.

@github-actions github-actions Bot added domain/im PR touches the im domain size/XL Architecture-level or global-impact change labels Jun 6, 2026
@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.41791% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.14%. Comparing base (7c50b3d) to head (01cd749).

Files with missing lines Patch % Lines
shortcuts/im/im_feed_group_items.go 88.05% 4 Missing and 4 partials ⚠️
shortcuts/im/im_feed_group_list.go 98.31% 1 Missing and 1 partial ⚠️
shortcuts/im/im_feed_group_query_item.go 95.12% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1308      +/-   ##
==========================================
+ Coverage   71.01%   71.14%   +0.12%     
==========================================
  Files         681      685       +4     
  Lines       65435    65770     +335     
==========================================
+ Hits        46470    46793     +323     
- Misses      15320    15326       +6     
- Partials     3645     3651       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@01cd74956d9cc9cc9d1bcd9a014f48c38a902da9

🧩 Skill update

npx skills add zhumiaoxin/cli#feat/feed-group -y -g

@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)
shortcuts/im/im_feed_group_list_test.go (1)

94-118: 💤 Low value

Consider adding test case for --end-time validation.

The test covers --start-time validation but not --end-time (which has the same Unix-milliseconds integer parsing requirement in line 86-89 of im_feed_group_list.go). Adding a case like {"bad end-time", map[string]string{"end-time": "notnum"}, "--end-time"} would complete the validation coverage.

📝 Suggested test case addition
 		{"page-limit too large", map[string]string{"page-limit": "1001"}, "--page-limit"},
 		{"bad start-time", map[string]string{"start-time": "notnum"}, "--start-time"},
+		{"bad end-time", map[string]string{"end-time": "notnum"}, "--end-time"},
 	}
🤖 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 `@shortcuts/im/im_feed_group_list_test.go` around lines 94 - 118, Add a test
case for end-time validation in TestFeedGroupListValidation: update the cases
slice used by TestFeedGroupListValidation to include a {"bad end-time",
map[string]string{"end-time": "notnum"}, "--end-time"} entry so that
ImFeedGroupList.Validate (invoked via newFGRuntime and ImFeedGroupList.Validate)
is exercised for the same Unix-milliseconds integer parsing logic as start-time;
ensure the new case follows the same t.Run assertion pattern already present.
🤖 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 `@shortcuts/im/im_feed_group_list_test.go`:
- Around line 94-118: Add a test case for end-time validation in
TestFeedGroupListValidation: update the cases slice used by
TestFeedGroupListValidation to include a {"bad end-time",
map[string]string{"end-time": "notnum"}, "--end-time"} entry so that
ImFeedGroupList.Validate (invoked via newFGRuntime and ImFeedGroupList.Validate)
is exercised for the same Unix-milliseconds integer parsing logic as start-time;
ensure the new case follows the same t.Run assertion pattern already present.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 994cf024-3b07-47db-8b13-51c4904ce6d6

📥 Commits

Reviewing files that changed from the base of the PR and between 7c50b3d and af60e0f.

📒 Files selected for processing (16)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_feed_group_item_test.go
  • shortcuts/im/im_feed_group_items.go
  • shortcuts/im/im_feed_group_list.go
  • shortcuts/im/im_feed_group_list_item.go
  • shortcuts/im/im_feed_group_list_test.go
  • shortcuts/im/im_feed_group_query_item.go
  • shortcuts/im/im_flag_cancel.go
  • shortcuts/im/im_flag_create.go
  • shortcuts/im/shortcuts.go
  • skill-template/domains/im.md
  • skills/lark-im/SKILL.md
  • skills/lark-im/references/lark-im-feed-group-list-item.md
  • skills/lark-im/references/lark-im-feed-group-list.md
  • skills/lark-im/references/lark-im-feed-group-query-item.md
  • skills/lark-im/references/lark-im-feed-groups.md

zhumiaoxin added a commit to zhumiaoxin/cli that referenced this pull request Jun 6, 2026
Address the Codecov report on larksuite#1308 (patch coverage 62.7%, 125 lines
missing). Adds tests for the previously uncovered paths:

- +feed-group-list: DryRun shape, single-page Execute, table render,
  end-time validation, time-window query params
- page_token infinite-loop guard and defensive page-limit clamping
  for both list and list-item page-all paths
- API error propagation across all three shortcuts
- enrichment warning on total chat-name resolution failure; nil-data no-op
- formatFeedGroupUpdateTime empty/non-numeric passthrough

Remaining uncovered lines are nil-map defensive skips and one dead
branch (SplitCSV already drops empty tokens); no production code changed.
YangJunzhou-01
YangJunzhou-01 previously approved these changes Jun 6, 2026

@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@skills/lark-im/references/lark-im-feed-groups.md`:
- Line 8: Remove the stray blank line inside the continued blockquote at the
start of the document (the blockquote around Line 8) so the quote lines are
contiguous; edit the blockquote so there are no empty lines between its lines
(delete the empty line or merge surrounding text) to satisfy markdownlint MD028.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 17cb9246-d845-43c4-b1fb-bf4ec33c8225

📥 Commits

Reviewing files that changed from the base of the PR and between 9d62121 and 6aae8ee.

📒 Files selected for processing (16)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/im_feed_group_item_test.go
  • shortcuts/im/im_feed_group_items.go
  • shortcuts/im/im_feed_group_list.go
  • shortcuts/im/im_feed_group_list_item.go
  • shortcuts/im/im_feed_group_list_test.go
  • shortcuts/im/im_feed_group_query_item.go
  • shortcuts/im/im_flag_cancel.go
  • shortcuts/im/im_flag_create.go
  • shortcuts/im/shortcuts.go
  • skill-template/domains/im.md
  • skills/lark-im/SKILL.md
  • skills/lark-im/references/lark-im-feed-group-list-item.md
  • skills/lark-im/references/lark-im-feed-group-list.md
  • skills/lark-im/references/lark-im-feed-group-query-item.md
  • skills/lark-im/references/lark-im-feed-groups.md
✅ Files skipped from review due to trivial changes (7)
  • skills/lark-im/references/lark-im-feed-group-query-item.md
  • skills/lark-im/references/lark-im-feed-group-list.md
  • shortcuts/im/im_flag_create.go
  • skills/lark-im/references/lark-im-feed-group-list-item.md
  • skill-template/domains/im.md
  • shortcuts/im/im_flag_cancel.go
  • skills/lark-im/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (8)
  • shortcuts/im/helpers_test.go
  • shortcuts/im/shortcuts.go
  • shortcuts/im/im_feed_group_query_item.go
  • shortcuts/im/im_feed_group_list.go
  • shortcuts/im/im_feed_group_list_item.go
  • shortcuts/im/im_feed_group_items.go
  • shortcuts/im/im_feed_group_list_test.go
  • shortcuts/im/im_feed_group_item_test.go

Comment thread skills/lark-im/references/lark-im-feed-groups.md
@zhumiaoxin
zhumiaoxin merged commit e1bb9db into larksuite:main Jun 7, 2026
20 checks passed
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/XL Architecture-level or global-impact change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants