Add mail rule reorder shortcut - #2246
Conversation
Fetch the current mail rule list before reorder so callers can provide a partial front segment while the API still receives the complete rule ID order. Co-authored-by: TRAE CLI <noreply@bytedance.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR adds and registers ChangesMail rule reorder
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant MailRuleReorder
participant MailAPI
Client->>MailRuleReorder: Provide front-segment rule IDs
MailRuleReorder->>MailAPI: Fetch current rule list
MailAPI-->>MailRuleReorder: Return rule IDs and sequences
MailRuleReorder->>MailRuleReorder: Validate and build complete order
MailRuleReorder->>MailAPI: Submit complete rule ID list
MailAPI-->>MailRuleReorder: Return reorder result
MailRuleReorder-->>Client: Return structured or human-readable output
Possibly related PRs
🚥 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 |
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_rule_reorder_test.go`:
- Around line 245-260: Update shortcuts/mail/mail_rule_reorder_test.go:245-260
in requireMailRuleValidation to assert validation Category and Subtype via
errs.ProblemOf while retaining errors.As for ValidationError.Param; update
shortcuts/mail/mail_rule_reorder_test.go:142-148 to verify the list failure’s
API Category, populated Subtype, and preserved cause; update
shortcuts/mail/mail_rule_reorder_test.go:173-179 to retain the hint assertion
and add API metadata and cause-preservation checks for the wrapped reorder
failure.
In `@shortcuts/mail/mail_rule_reorder.go`:
- Line 33: Update the AuthTypes configuration used by executeMailRuleReorder to
include only "user", removing "bot" so this mail reorder write shortcut requires
user authentication.
- Around line 136-153: Update the rule-list parsing around the loop that builds
mailRuleOrderItem to validate the response shape before conversion: require
data["items"] to be an array, require each item to be an object with a string id
and a supported sequence representation, and return mailInvalidResponseError for
missing or unsupported values. Replace the mailRuleStringValue/int64PointerValue
coercion path with a typed boundary projection that rejects non-string IDs and
fractional or otherwise invalid sequence values while preserving valid ordering
behavior and sortMailRulesBySequenceWhenComplete.
🪄 Autofix
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 Plus
Run ID: 7c17d797-2ada-4d30-b404-d591760d6254
📒 Files selected for processing (6)
shortcuts/mail/mail_rule_reorder.goshortcuts/mail/mail_rule_reorder_test.goshortcuts/mail/shortcuts.goskill-template/domains/mail.mdskills/lark-mail/SKILL.mdskills/lark-mail/references/lark-mail-rules.md
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@06f576917e11c1c87d9d8a0d7cf0b40747f0c97d🧩 Skill updatenpx skills add yangr-happy/cli#feat/1759d14 -y -g |
Restrict the reorder shortcut to user auth, reject malformed rule list payloads, and assert typed error contracts in tests. Change-Type: ci-fix Co-authored-by: TRAE CLI <noreply@bytedance.com>
The sequence parser returns intermediate detail that fetchMailRulesForReorder wraps into the typed invalid_response error contract. Change-Type: ci-fix Co-authored-by: TRAE CLI <noreply@bytedance.com>
Adds a mail rule reorder shortcut that accepts a partial ordered list of rule IDs and expands it to the complete mailbox rule order before submitting the reorder request.
Changes include:
Summary by CodeRabbit
New Features
Documentation
Tests