Skip to content

Document mail sender allow and block APIs#1900

Open
infeng wants to merge 5 commits into
larksuite:mainfrom
infeng:feat/1a3e5a9
Open

Document mail sender allow and block APIs#1900
infeng wants to merge 5 commits into
larksuite:mainfrom
infeng:feat/1a3e5a9

Conversation

@infeng

@infeng infeng commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Updates the mail skill documentation with user sender allow/block API coverage.

  • Adds guidance for listing, adding, and removing allow-listed senders.
  • Adds matching block-list sender operations.
  • Refreshes the action routing notes for these mailbox sender controls.

Summary by CodeRabbit

  • Documentation
    • Expanded and revised lark-mail skill guidance: improved first-use (-h) requirements, recipient search, send/schedule/recall flows, HTML writing defaults with +lint-html, invites/read receipts, templates, and sender allow/block management. Also refreshed API resources and permission mappings.
  • Bug Fixes
    • Improved allow/block sender keyword cache warm-up error handling with clearer, retryable classification and recovery hints.
    • Safer remote overlay merging now preserves embedded mail resources/methods when cache is newer.
  • Tests
    • Added coverage for cache-preparing error classification (including scope mismatch) and overlay merge preservation behavior.

@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 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Expanded skills/lark-mail/SKILL.md with revised workflows, recipient and sending safeguards, HTML and template guidance, sender management, API resources, and permissions. Added scoped retryable classification for sender-list cache-preparing errors and recursive registry overlay merging with tests.

Changes

Mail operations and API behavior

Layer / File(s) Summary
Mail workflow and send safety
skills/lark-mail/SKILL.md
Updates prerequisites, command discovery, recipient confirmation, sending and scheduling rules, recall behavior, and workflow steps.
Composition and message operations
skills/lark-mail/SKILL.md
Documents calendar invites, IM sharing, HTML/plain-text behavior, linting, templates, and native API usage.
Sender management and API permissions
skills/lark-mail/SKILL.md
Adds personal allow/block sender operations and expands shortcuts, API resources, and permission documentation.
Cache-preparing API error classification
errs/subtypes.go, cmd/service/service.go
Adds a cache-preparing error subtype and applies scoped retryable annotations to matching sender-list API responses.
Classification behavior tests
cmd/service/service_test.go
Validates error annotations, preserved metadata, retryability, and exclusions for unmatched methods or keywords.
Remote registry overlay merging
internal/registry/remote.go, internal/registry/remote_test.go
Recursively merges cached service resources and methods so embedded mail entries remain available alongside cache overrides.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • larksuite/cli#1885: Covers related mail sender allow/block command, documentation, schema, and dry-run test changes.

Suggested labels: bugfix, feature

Suggested reviewers: chanthuang

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description does not follow the required template and omits the Summary, Changes, Test Plan, and Related Issues sections. Rewrite it using the repo template with all four sections, and add a brief test plan plus related issue links or None.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: documenting mail sender allow/block APIs.
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

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@205a03af027a48e69b40d4b9194cfa12334801f7

🧩 Skill update

npx skills add infeng/cli#feat/1a3e5a9 -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: 4

🤖 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 `@skills/lark-mail/SKILL.md`:
- Line 306: Update the scheduling example’s --event-start timestamp to use a
clearly future placeholder or dynamically generated future value, ensuring it
remains at least five minutes ahead of execution and passes --send-time
validation.
- Around line 421-429: Update the warning in the shortcut recipient-merge
documentation to match the no-deduplication behavior: remove the claim that
--to/--cc/--bcc override or prevent repeated template recipients, and direct
users to clear template addresses with +template-update instead.
- Around line 300-309: Update the “发送带日程邀请的新邮件(先保存草稿,确认后发送)” example to preserve
its draft-first behavior by removing the --confirm-send flag from the lark-cli
mail +send invocation. Keep the event-related options unchanged.
- Around line 721-726: Update the scope table entries for
user_mailbox.templates.get/list to include mail:user_mailbox.message:readonly
rather than relying only on the broader modify scope. Clarify whether the
readonly and modify scopes listed for allow_sender.list and blocked_sender.list
are alternatives or both required, and state that requirement explicitly in the
table or surrounding guidance.
🪄 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: 5091625f-6d1f-4477-8936-c4c2113b080d

📥 Commits

Reviewing files that changed from the base of the PR and between 49b4ccc and a2ac6f6.

📒 Files selected for processing (1)
  • skills/lark-mail/SKILL.md

Comment thread skills/lark-mail/SKILL.md Outdated
Comment thread skills/lark-mail/SKILL.md Outdated
Comment thread skills/lark-mail/SKILL.md Outdated
Comment thread skills/lark-mail/SKILL.md

@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: 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 `@cmd/service/service_test.go`:
- Around line 206-319: Expand the classifier tests around
TestClassifyServiceAPIError_UserAllowBlockCachePreparing to cover the positive
user_mailbox.allow_sender.list keyword-search path and negative cases for a
non-456 code, a message without 15190000, and a message without ErrCacheEmpty.
Assert directly that only the matching code/message combination receives
SubtypeUserAllowBlockCachePreparing, while each negative case retains generic
classification.

In `@cmd/service/service.go`:
- Around line 488-522: The helpers serviceRequestHasKeyword and
serviceCachePreparingText currently accept unsupported values through
fmt.Sprint; update these boundary projections to use typed structs and type
assertions instead. Treat keyword as present only when it is a non-empty string,
and accept response message fields only when they are strings, preserving cache
classification for valid typed responses while ignoring nil, collections, and
other unsupported values.
- Around line 470-475: Update the error handling branch around
errs.SubtypeUserAllowBlockCachePreparing so it preserves any existing
Problem.Hint populated by errclass.BuildAPIError while adding
userAllowBlockCachePreparingHint as recovery guidance. Replace the direct p.Hint
assignment with append/merge behavior, retaining the existing hint and avoiding
duplicate guidance when already present.
🪄 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: abdd7554-1f4c-477c-abde-8f6aa4773f67

📥 Commits

Reviewing files that changed from the base of the PR and between a2ac6f6 and 1dbf0e6.

📒 Files selected for processing (3)
  • cmd/service/service.go
  • cmd/service/service_test.go
  • errs/subtypes.go

Comment thread cmd/service/service_test.go
Comment thread cmd/service/service.go
Comment thread cmd/service/service.go Outdated
Merge newer remote service snapshots over embedded metadata instead of replacing the whole service. This keeps commands compiled into a fresh binary visible when a cached remote registry has a newer version but lacks those resources, while still allowing cached methods to override matching embedded methods.
@infeng infeng requested a review from liangshuo-1 as a code owner July 16, 2026 07:20

@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 `@skills/lark-mail/SKILL.md`:
- Line 428: Update the duplicate-recipient warning in the shortcut documentation
to cover all five affected commands: +send, +draft-create, +forward, +reply, and
+reply-all. Keep the existing warning behavior and guidance unchanged, unless
the implementation explicitly demonstrates that any listed flow differs.
🪄 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: 8fdc73b8-a631-46d2-ab10-55c72e795e5d

📥 Commits

Reviewing files that changed from the base of the PR and between 9124118 and adf972f.

📒 Files selected for processing (3)
  • cmd/service/service.go
  • cmd/service/service_test.go
  • skills/lark-mail/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/service/service_test.go
  • cmd/service/service.go

Comment thread skills/lark-mail/SKILL.md Outdated

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
skills/lark-mail/SKILL.md (2)

115-117: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Apply the -h rule to the canonical workflow.

The first workflow step at Line 96 directly invokes user_mailboxes profile, so copying the documented “first operation” still violates this new help-first requirement. Add the required help invocation before that command, or clarify that the workflow assumes prior command discovery.

As per coding guidelines, CLI behavior documentation must accurately describe machine-consumed command usage.

🤖 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 `@skills/lark-mail/SKILL.md` around lines 115 - 117, Update the canonical
workflow before the first user_mailboxes profile invocation to include the
required -h help command, ensuring the documented first operation follows the
help-first rule. Keep the existing profile workflow unchanged after command
discovery.

Source: Coding guidelines


229-231: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reconcile the scheduled-send status documentation.

Line 231 introduces a “待发送” status, but Line 229 documents only numeric statuses 1–6. Document the actual pending status code/field, or avoid presenting it as the same status enum.

🤖 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 `@skills/lark-mail/SKILL.md` around lines 229 - 231, Update the scheduled-send
guidance near the status definitions to clarify whether “待发送” is represented by
a separate field or a specific code. Document its actual field/code if it
belongs to the status response; otherwise distinguish it from the numeric status
enum and avoid implying it is one of statuses 1–6.
🤖 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.

Outside diff comments:
In `@skills/lark-mail/SKILL.md`:
- Around line 115-117: Update the canonical workflow before the first
user_mailboxes profile invocation to include the required -h help command,
ensuring the documented first operation follows the help-first rule. Keep the
existing profile workflow unchanged after command discovery.
- Around line 229-231: Update the scheduled-send guidance near the status
definitions to clarify whether “待发送” is represented by a separate field or a
specific code. Document its actual field/code if it belongs to the status
response; otherwise distinguish it from the numeric status enum and avoid
implying it is one of statuses 1–6.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 443bc969-0175-492e-9e0c-e90ac0cc4779

📥 Commits

Reviewing files that changed from the base of the PR and between adf972f and 205a03a.

📒 Files selected for processing (1)
  • skills/lark-mail/SKILL.md

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