feat(mail): add message modify and trash shortcuts#1567
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:
📝 WalkthroughWalkthroughTwo new mail CLI shortcuts are added: ChangesMail message management shortcuts
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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@bb71d4ade43aefe0a1ef5f8a755229199df4a0e2🧩 Skill updatenpx skills add bubbmon233/cli#feat/c8c09bb -y -g |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@shortcuts/mail/mail_message_manage_test.go`:
- Around line 64-66: The validation tests around normalizeMessageManageIDs and
the related message-manage cases only prove that an error occurred, so they can
miss incorrect problem typing or wrong field names. Update the assertions to
inspect errs.ProblemOf for the expected typed validation problem fields
(category, subtype, and param), and use errors.As against *errs.ValidationError
when verifying Param for --message-ids, --add-label-ids, and --add-folder. Keep
the checks anchored to normalizeMessageManageIDs and the affected test cases so
they validate the exact error shape, not just the message text.
In `@shortcuts/mail/mail_message_modify.go`:
- Around line 85-99: The batch modify flow in executeMessageModify currently
records per-message failures in summary but always returns nil, so a run with
only failures still exits successfully. After emitMessageManageSummary, check
whether summary.SuccessMessageIDs is empty and summary.FailedMessageIDs is
non-empty, and in that case return a typed/non-zero error instead of nil; apply
the same fix to executeMessageTrash since it has the same pattern.
In `@shortcuts/mail/message_manage_helpers.go`:
- Around line 183-208: `validateCustomMessageManageLabels` is missing the
label-read scope preflight, and `MailMessageModify` does not declare the
folder-read scope needed by the `--add-folder` path. Update
`validateCustomMessageManageLabels` to call `validateLabelReadScope(rt)` before
the `CallAPITyped` label checks, and adjust `MailMessageModify` so
`mail:user_mailbox.folder:read` is included conditionally when folder validation
is used, keeping the existing `validateCustomMessageManageFolder` flow and its
`mailboxPath` lookups intact.
🪄 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: 6bc67455-485e-41e4-a8ec-9dbd4e1f38bc
📒 Files selected for processing (15)
shortcuts/mail/helpers.goshortcuts/mail/mail_message_manage_test.goshortcuts/mail/mail_message_modify.goshortcuts/mail/mail_message_trash.goshortcuts/mail/mail_shortcut_test.goshortcuts/mail/message_manage_helpers.goshortcuts/mail/shortcuts.goskill-template/domains/mail.mdskills/lark-mail/SKILL.mdskills/lark-mail/references/lark-mail-forward.mdskills/lark-mail/references/lark-mail-message-modify.mdskills/lark-mail/references/lark-mail-message-trash.mdskills/lark-mail/references/lark-mail-reply-all.mdskills/lark-mail/references/lark-mail-reply.mdtests/cli_e2e/mail/coverage.md
bubbmon233
left a comment
There was a problem hiding this comment.
🤖 AI Review | CR 汇总 | 有风险(2 个 P2)
增量审查:基于之前 3 条已 resolved 的 review thread,本次新增 2 条 P2 评论。主要风险是 +message-modify 的 folder read scope 被无条件 pre-flight,以及新提示命令没有复用已有 shell quoting。
Keep message-id token parsing raw for message management commands so whitespace and control characters cannot be stripped by flag CSV parsing before shared validation. Tests: make unit-test sprint: S1
Return a failed-precondition error when every message modify/trash batch fails, preflight custom label validation scope, and assert typed validation errors in message manage tests. Change-Type: ci-fix
Generated by the harness-coding skill.
Sprints
This MR was created autonomously. Quality gates were enforced by the repo's own pre-commit hooks.
Summary by CodeRabbit
mail +message-modifyfor add/remove label and/or move-to-folder actions with 20-message batching and--dry-runplanning.mail +message-trashfor soft-deletes in 20-message batches, requiring--yes.+message-modifyto removeUNREAD.trash).+message-modify/+message-trash.