Include mailbox_id in mail +triage output for public mailbox support#1227
Include mailbox_id in mail +triage output for public mailbox support#1227xukuncx wants to merge 1 commit into
Conversation
When mail +triage reads messages from a public/shared mailbox, the structured output now includes the resolved mailbox_id so downstream consumers (e.g. mail +message) can use the correct mailbox instead of defaulting to /user_mailboxes/me. Changes: - Add mailbox_id to every message in JSON/data output - Add mailbox_id as a top-level field in JSON/data output - Add mailbox_id column to table output rows - Update tip text to include --mailbox flag with the resolved mailbox - Add unit tests for message builder field preservation sprint: S1
|
harness-agent seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
📝 WalkthroughWalkthroughThe ChangesMailbox ID in Triage Output
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 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)
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.
🧹 Nitpick comments (2)
shortcuts/mail/mail_triage.go (1)
314-314: 💤 Low valueConsider shell-quoting the mailbox value for consistency.
The hint on lines 304-312 uses
shellQuote()forquery,filter, andpage-tokenvalues. For consistency and safety, apply the same pattern here:fmt.Fprintf(runtime.IO().ErrOut, "tip: use mail +message --mailbox %s --message-id <id> to read full content\n", shellQuote(mailbox))While
mailboxis typically"me"or an email address (unlikely to contain shell metacharacters), quoting ensures the hint remains well-formed if the value ever includes spaces or special characters.🤖 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_triage.go` at line 314, Update the fmt.Fprintf call that prints the usage hint so the mailbox value is shell-quoted for consistency and safety: replace the current fmt.Fprintf(..., mailbox) usage with fmt.Fprintf(..., shellQuote(mailbox)) so the printed tip uses shellQuote(mailbox); this touches the fmt.Fprintf call writing to runtime.IO().ErrOut and uses the existing shellQuote function to ensure the mailbox is safely quoted.shortcuts/mail/mail_triage_test.go (1)
1408-1460: ⚖️ Poor tradeoffConsider adding test coverage for mailbox_id in output formats.
The new tests correctly verify that
buildTriageMessageMetaandbuildTriageMessagesFromSearchItemspreserve metadata fields. However, they don't test the actual feature introduced in this PR: thatmailbox_idappears in the final output.Consider adding tests that verify:
mailbox_idappears at the top level and in each message forjson/dataoutput (lines 270-274 in mail_triage.go)mailbox_idappears in each row fortableoutput (line 293 in mail_triage.go)You could follow the pattern of existing dry-run tests or add a focused Execute test with a mock HTTP response.
🤖 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_triage_test.go` around lines 1408 - 1460, Add focused tests that assert mailbox_id is included in outputs: extend or add tests that call buildTriageMessageMeta and buildTriageMessagesFromSearchItems and verify the returned map includes "mailbox_id" at the top level and inside each message; additionally add an Execute-style test (or adapt an existing dry-run test) for the table/json/data output paths to ensure "mailbox_id" is present in each row/message for table output and at top-level for json/data output (exercise the code path that formats outputs in mail_triage.go, referencing the formatting logic used by the Execute function and the output branches that consume the results of buildTriageMessageMeta/buildTriageMessagesFromSearchItems).
🤖 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_triage_test.go`:
- Around line 1408-1460: Add focused tests that assert mailbox_id is included in
outputs: extend or add tests that call buildTriageMessageMeta and
buildTriageMessagesFromSearchItems and verify the returned map includes
"mailbox_id" at the top level and inside each message; additionally add an
Execute-style test (or adapt an existing dry-run test) for the table/json/data
output paths to ensure "mailbox_id" is present in each row/message for table
output and at top-level for json/data output (exercise the code path that
formats outputs in mail_triage.go, referencing the formatting logic used by the
Execute function and the output branches that consume the results of
buildTriageMessageMeta/buildTriageMessagesFromSearchItems).
In `@shortcuts/mail/mail_triage.go`:
- Line 314: Update the fmt.Fprintf call that prints the usage hint so the
mailbox value is shell-quoted for consistency and safety: replace the current
fmt.Fprintf(..., mailbox) usage with fmt.Fprintf(..., shellQuote(mailbox)) so
the printed tip uses shellQuote(mailbox); this touches the fmt.Fprintf call
writing to runtime.IO().ErrOut and uses the existing shellQuote function to
ensure the mailbox is safely quoted.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6724f3d9-3cf1-49cd-8bbb-1ef4a55b37bd
📒 Files selected for processing (2)
shortcuts/mail/mail_triage.goshortcuts/mail/mail_triage_test.go
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@79be1c40b6f881310063f923ef263e1f21e2574f🧩 Skill updatenpx skills add xukuncx/cli#feat/c5b5818 -y -g |
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
mail +triageoutput now includes mailbox ID in results across all formats (JSON, data, and table).Documentation
mail +messagecommand with mailbox parameter.Tests