feat: append default mail signatures on send#1332
Conversation
Resolve the sender's default USER signature during mail +send and keep plain-text sends text/plain by rendering signature HTML to text. Users can pass --no-signature to skip the default lookup. sprint: S1
📝 WalkthroughWalkthroughThis PR adds signature support to the mail ChangesMail Send Signature Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsStopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a 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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1332 +/- ##
==========================================
+ Coverage 71.47% 71.56% +0.08%
==========================================
Files 688 688
Lines 65482 65560 +78
==========================================
+ Hits 46806 46918 +112
+ Misses 15031 14984 -47
- Partials 3645 3658 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@8003378c68a39418c1b06f2af5c6824dbf12b869🧩 Skill updatenpx skills add bubbmon233/cli#feat/26bb14a -y -g |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
shortcuts/mail/mail_send_signature_test.go (1)
49-89: ⚡ Quick winAdd a happy-path test for auto-detected plain bodies.
The suite verifies
--plain-textand the fail-open fallback, but it never asserts the new success path where--body "Hello"without--plain-textappends a text-converted signature. A small case for that branch would lock down the behavior added inmail_send.go.Also applies to: 155-186
🤖 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_send_signature_test.go` around lines 49 - 89, Add a new happy-path test that exercises the auto-detection branch when the user provides --body "Hello" without --plain-text: create a test (e.g., TestMailSendAutoDetectPlainBodyAppendsTextSignature) using the same fixtures/helpers used in TestMailSendPlainTextDefaultSignatureKeepsTextPlain—call mailShortcutTestFactoryWithSendScope, registerSignatureListStub (with a USER signature containing HTML content), registerSendAsStub, registerDraftCreateStub, then run runMountedMailShortcut with MailSend and arguments including "--body", "Hello" (but omit "--plain-text"); assert the drafted EML (via mustDecodeRawEMLFromStub) contains Content-Type: text/plain and that the text-converted signature text (e.g., "Regards" and name) is appended, and that no HTML parts or "lark-mail-signature" are present so the auto-detect plain path is locked down.shortcuts/mail/signature_compose.go (1)
164-170: Document the"0"sentinel meaning for signature IDs
normalizeSignatureIDtreats"0"as empty (returns""whensignatureID == "0"), and default-selection code/tests also ignore"0"as an unset ID; the current search found no supporting inline docs/comments for this convention, so add a clarifying comment or named constant.🤖 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/signature_compose.go` around lines 164 - 170, normalizeSignatureID currently treats the string "0" as a sentinel for an unset signature but has no documentation; update the code by introducing a named constant (e.g., unsetSignatureID = "0") and/or add a concise inline comment above the normalizeSignatureID function explaining that "0" is treated as an unset/placeholder ID and should be treated the same as an empty string, then use that constant in normalizeSignatureID (and update any related default-selection code/tests to reference the constant) so the convention is explicit and discoverable.
🤖 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.
Nitpick comments:
In `@shortcuts/mail/mail_send_signature_test.go`:
- Around line 49-89: Add a new happy-path test that exercises the auto-detection
branch when the user provides --body "Hello" without --plain-text: create a test
(e.g., TestMailSendAutoDetectPlainBodyAppendsTextSignature) using the same
fixtures/helpers used in
TestMailSendPlainTextDefaultSignatureKeepsTextPlain—call
mailShortcutTestFactoryWithSendScope, registerSignatureListStub (with a USER
signature containing HTML content), registerSendAsStub, registerDraftCreateStub,
then run runMountedMailShortcut with MailSend and arguments including "--body",
"Hello" (but omit "--plain-text"); assert the drafted EML (via
mustDecodeRawEMLFromStub) contains Content-Type: text/plain and that the
text-converted signature text (e.g., "Regards" and name) is appended, and that
no HTML parts or "lark-mail-signature" are present so the auto-detect plain path
is locked down.
In `@shortcuts/mail/signature_compose.go`:
- Around line 164-170: normalizeSignatureID currently treats the string "0" as a
sentinel for an unset signature but has no documentation; update the code by
introducing a named constant (e.g., unsetSignatureID = "0") and/or add a concise
inline comment above the normalizeSignatureID function explaining that "0" is
treated as an unset/placeholder ID and should be treated the same as an empty
string, then use that constant in normalizeSignatureID (and update any related
default-selection code/tests to reference the constant) so the convention is
explicit and discoverable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c21a0c96-6a65-4206-a421-a9410006e7fc
📒 Files selected for processing (8)
shortcuts/mail/draft/htmltext.goshortcuts/mail/mail_send.goshortcuts/mail/mail_send_signature_test.goshortcuts/mail/signature_compose.goshortcuts/mail/signature_compose_test.goskill-template/domains/mail.mdskills/lark-mail/SKILL.mdskills/lark-mail/references/lark-mail-send.md
Generated by the harness-coding skill.
Sprints
Source specs
This MR was created autonomously. Quality gates were enforced by the repo's own pre-commit hooks.
Summary by CodeRabbit
New Features
+sendshortcut now appends the sender's default signature by default.--no-signatureflag to skip signature appending.--signature-idflag to explicitly select a specific signature.text/plainformat when signatures are appended.Documentation
+sendshortcut documentation to explain signature behavior and new flags.