feat(mail): add allow-block sender shortcuts#1728
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds four mail shortcuts for per-user sender allow/block list management, including list/search/set/delete flows, validation, file-backed address input, API error decoration, registration, tests, and documentation updates. ChangesAllow/Block sender list feature
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant MailAllowBlockSet
participant MailAllowBlockDelete
participant SenderAPI
CLI->>MailAllowBlockSet: --address / --address-file
MailAllowBlockSet->>MailAllowBlockSet: parse, dedupe, enforce max count
MailAllowBlockSet->>SenderAPI: POST batch create senders
SenderAPI-->>MailAllowBlockSet: succeeded/failed counts or error
MailAllowBlockSet-->>CLI: decorated error or formatted output
CLI->>MailAllowBlockDelete: --address / --address-file
MailAllowBlockDelete->>SenderAPI: DELETE batch senders
SenderAPI-->>MailAllowBlockDelete: deleted count or error
MailAllowBlockDelete-->>CLI: formatted output
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 Quality SummaryCI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun. Failed checksdeterministic-gate
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@e3d96e3f0781a086564805d4672b4683953125df🧩 Skill updatenpx skills add sysuljx/cli#feat/a834648 -y -g |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
shortcuts/mail/mail_allow_block_test.go (1)
273-293: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueHardcoded page-size default applied to all int flags.
Every
int-typed flag getsallowBlockDefaultPageSizeas its default here, regardless offl.Default. Currently harmless since the only int flag (page-size) is always overridden viavalues, but this will silently produce a wrong default if another int flag is added or a test omits an override forpage-size.♻️ Suggested fix to parse the flag's own default
switch fl.Type { case "int": - cmd.Flags().Int(fl.Name, allowBlockDefaultPageSize, "") + def, _ := strconv.Atoi(fl.Default) + cmd.Flags().Int(fl.Name, def, "")🤖 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/mail/mail_allow_block_test.go` around lines 273 - 293, The helper runtimeForAllowBlockDryRun is hardcoding allowBlockDefaultPageSize for every int flag instead of using each flag’s own default. Update the flag initialization loop to read fl.Default for int-typed flags as well, so future int flags and any tests that rely on the declared default behave correctly.
🤖 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_allow_block_test.go`:
- Around line 32-78: The validation test helper is too weak because
assertValidationError only checks the message text, so regressions in
category/subtype/param can slip through. Update assertValidationError to verify
the returned error with errs.ProblemOf and confirm the validation cause is
preserved, then keep TestAllowBlockValidate using that helper for
MailAllowBlockList, MailAllowBlockSearch, MailAllowBlockSet, and
MailAllowBlockDelete.
In `@shortcuts/mail/mail_allow_block.go`:
- Line 15: The shortcuts/mail package is importing internal/vfs directly, which
violates shortcuts-no-vfs. Update mail_allow_block.go to use runtime.FileIO()
and runtime.ValidatePath() for file access instead of vfs, and if the code needs
the entire file contents, open it through runtime.FileIO().Open() and read it
with io.ReadAll(); keep the change localized to the mail shortcut flow and any
helpers it calls.
In `@skills/lark-mail/references/lark-mail-allow-block.md`:
- Line 53: The allow/block list flow in the lark-mail reference should not
silently remove API-rejected senders and retry, because that makes the confirmed
payload differ from the actual write. Update the guidance to require surfacing
the rejected values, showing the adjusted final sender list/count again, and
asking the user to re-confirm before any retry or set/delete operation. Keep the
preview/confirmation requirement aligned with the final payload in the
allow/block list workflow.
---
Nitpick comments:
In `@shortcuts/mail/mail_allow_block_test.go`:
- Around line 273-293: The helper runtimeForAllowBlockDryRun is hardcoding
allowBlockDefaultPageSize for every int flag instead of using each flag’s own
default. Update the flag initialization loop to read fl.Default for int-typed
flags as well, so future int flags and any tests that rely on the declared
default behave correctly.
🪄 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: 59b152a4-abb9-4d10-8c7a-3198565a3698
📒 Files selected for processing (6)
shortcuts/mail/mail_allow_block.goshortcuts/mail/mail_allow_block_test.goshortcuts/mail/shortcuts.goskill-template/domains/mail.mdskills/lark-mail/SKILL.mdskills/lark-mail/references/lark-mail-allow-block.md
Use shortcut runtime FileIO for address files, strengthen validation assertions, and clarify rejected sender retry guidance. Change-Type: ci-fix
Change-Type: ci-fix
Adds mail shortcuts for managing allow and block sender lists.
Summary by CodeRabbit
+allow-block-list,+allow-block-search,+allow-block-set,+allow-block-delete(listing/searching, bulk add, and remove).--typerules, and--address-filebulk input with trimming/deduping; list output aggregates allow/block with per-list counts.+allow-block-deletepreserves original address casing and improves deletion success counting across response formats.