Skip to content

Add mail sender allow and block management guidance#1974

Open
infeng wants to merge 1 commit into
larksuite:mainfrom
infeng:feat/c0bed37
Open

Add mail sender allow and block management guidance#1974
infeng wants to merge 1 commit into
larksuite:mainfrom
infeng:feat/c0bed37

Conversation

@infeng

@infeng infeng commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Adds CLI guidance for managing mailbox sender allow and block entries through the existing APIs.

  • Documents list, query, set, and delete operations for both sender lists.
  • Adds reusable reference material for request fields, permissions, and command examples.
  • Covers the registered sender-control APIs with service-level tests.

Summary by CodeRabbit

  • Documentation
    • Added guidance for managing user-level allowed and blocked senders, including listing, bulk updates, cleanup, pagination, permissions, and retry handling.
    • Expanded email operation guidance for receiving rules, recipient lookup, sending confirmation, scheduling, send-as workflows, delivery status, cancellation, recall, templates, HTML content, and sharing.
    • Clarified command discovery, parameter checks, output formats, scopes, and native API usage.
    • Updated available mail shortcuts and API resource references.

Document the six generated sender-management commands with self-contained allow and block cleanup flows, scope requirements, and retry guidance. Add a registry snapshot regression for offline command discovery, request parameters, identities, risks, and JSON output defaults.
@github-actions github-actions Bot added domain/mail PR touches the mail domain size/L Large or sensitive change across domains or core paths labels Jul 20, 2026
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

新增发件人 allow/block 动态命令的注册快照测试,并补充相关资源的操作参考。邮件技能文档同步更新命令检查、发信、HTML、模板、快捷命令、API 资源及权限说明。

Changes

Mail sender controls

Layer / File(s) Summary
Sender command discovery contract
cmd/service/mail_sender_registry_test.go
通过嵌入式 OpenAPI fixture 验证 allow_sendersblocked_senderslistbatch_createbatch_remove 命令发现、参数、schema、scope 和写入风险元数据。
Sender controls reference
skill-template/domains/mail.md, skills/lark-mail/references/lark-mail-sender-controls.md
新增用户级 allow/block 发件人资源说明、权限与 JSON 错误格式、创建查询清理流程、分页规则及 15180304 重试策略。
Mail skill workflow guidance
skills/lark-mail/SKILL.md
更新邮件技能的前置要求、参数检查、收件人处理、发信确认、send-as、投递状态、撤回、HTML、模板、快捷命令、API 资源和权限表。

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

  • larksuite/cli#1885:覆盖相同发件人 allow/block 资源的 schema、命令及 dry-run 测试。
  • larksuite/cli#1938:更新相同发件人 allow/block 管理相关邮件文档。
  • larksuite/cli#1966:为相同发件人资源接入 mail user-allow-block 快捷命令。

Suggested reviewers: liangshuo-1, caojie0621

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding guidance for managing mail sender allow/block lists.
Description check ✅ Passed The description includes the summary and main changes and is mostly complete, though Test Plan and Related Issues are omitted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 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.

@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@0fa36b73b2bc5def171442173b7e2020e1a5b886

🧩 Skill update

npx skills add infeng/cli#feat/c0bed37 -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.

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 `@cmd/service/mail_sender_registry_test.go`:
- Around line 128-129: Update the test setup around
RegisterServiceCommandsFromCatalog to use cmdutil.TestFactory instead of a raw
cmdutil.Factory, and configure LARKSUITE_CLI_CONFIG_DIR to point to a temporary
test directory. Ensure the temporary configuration environment is established
and cleaned up through the test lifecycle to prevent state leakage.
🪄 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: e8df427b-8409-4bcb-8ab3-cb985f633ea1

📥 Commits

Reviewing files that changed from the base of the PR and between 4cdfa2f and 0fa36b7.

📒 Files selected for processing (4)
  • cmd/service/mail_sender_registry_test.go
  • skill-template/domains/mail.md
  • skills/lark-mail/SKILL.md
  • skills/lark-mail/references/lark-mail-sender-controls.md

Comment on lines +128 to +129
root := &cobra.Command{Use: "lark-cli"}
RegisterServiceCommandsFromCatalog(context.Background(), root, &cmdutil.Factory{}, catalog)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔴 Critical | ⚡ Quick win

Isolate configuration state and use TestFactory.

As per coding guidelines, test factories must be initialized using cmdutil.TestFactory and the configuration state must be isolated by pointing LARKSUITE_CLI_CONFIG_DIR to a temporary directory. Using a raw &cmdutil.Factory{} without isolation risks state pollution.

🛠️ Proposed fix
-	root := &cobra.Command{Use: "lark-cli"}
-	RegisterServiceCommandsFromCatalog(context.Background(), root, &cmdutil.Factory{}, catalog)
+	t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir())
+	root := &cobra.Command{Use: "lark-cli"}
+	RegisterServiceCommandsFromCatalog(context.Background(), root, cmdutil.TestFactory(t, nil), catalog)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
root := &cobra.Command{Use: "lark-cli"}
RegisterServiceCommandsFromCatalog(context.Background(), root, &cmdutil.Factory{}, catalog)
t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir())
root := &cobra.Command{Use: "lark-cli"}
RegisterServiceCommandsFromCatalog(context.Background(), root, cmdutil.TestFactory(t, nil), catalog)
🤖 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 `@cmd/service/mail_sender_registry_test.go` around lines 128 - 129, Update the
test setup around RegisterServiceCommandsFromCatalog to use cmdutil.TestFactory
instead of a raw cmdutil.Factory, and configure LARKSUITE_CLI_CONFIG_DIR to
point to a temporary test directory. Ensure the temporary configuration
environment is established and cleaned up through the test lifecycle to prevent
state leakage.

Source: Coding guidelines

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

Labels

domain/mail PR touches the mail domain size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant