Add mail sender allow and block management guidance#1974
Conversation
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.
📝 WalkthroughWalkthrough新增发件人 allow/block 动态命令的注册快照测试,并补充相关资源的操作参考。邮件技能文档同步更新命令检查、发信、HTML、模板、快捷命令、API 资源及权限说明。 ChangesMail sender controls
Estimated code review effort: 3 (Moderate) | ~30 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@0fa36b73b2bc5def171442173b7e2020e1a5b886🧩 Skill updatenpx skills add infeng/cli#feat/c0bed37 -y -g |
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
cmd/service/mail_sender_registry_test.goskill-template/domains/mail.mdskills/lark-mail/SKILL.mdskills/lark-mail/references/lark-mail-sender-controls.md
| root := &cobra.Command{Use: "lark-cli"} | ||
| RegisterServiceCommandsFromCatalog(context.Background(), root, &cmdutil.Factory{}, catalog) |
There was a problem hiding this comment.
📐 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.
| 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
Adds CLI guidance for managing mailbox sender allow and block entries through the existing APIs.
Summary by CodeRabbit