fix(calendar): guide approval room booking fallback - #1637
Conversation
📝 WalkthroughWalkthroughAdds two helper functions to ChangesApproval Room Missing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 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.
🧹 Nitpick comments (1)
shortcuts/calendar/calendar_test.go (1)
726-743: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert cause preservation on the wrapped error.
This path is supposed to keep the original typed API error intact after
withStepContext, but the test only checksProblemOffields and hint text. Please also assert that the wrapped error still preserves its underlying cause so a future refactor cannot silently downgrade the error chain. As per coding guidelines,**/*_test.go: Error-path tests must assert typed metadata viaerrs.ProblemOf(category/subtype/param) and cause preservation, not message substrings alone.🤖 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/calendar/calendar_test.go` around lines 726 - 743, The test around withStepContext only verifies ProblemOf metadata and hint text, but it should also ensure the wrapped error still preserves the original cause. Update the calendar_test.go case to assert cause preservation on the error returned by withStepContext, using the existing err/p variables and the typed API error path already checked with errs.ProblemOf. Keep the current category, subtype, and code assertions, and add a direct cause-chain assertion so future refactors cannot break error wrapping while still passing this test.Source: Coding guidelines
🤖 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/calendar/calendar_test.go`:
- Around line 726-743: The test around withStepContext only verifies ProblemOf
metadata and hint text, but it should also ensure the wrapped error still
preserves the original cause. Update the calendar_test.go case to assert cause
preservation on the error returned by withStepContext, using the existing err/p
variables and the typed API error path already checked with errs.ProblemOf. Keep
the current category, subtype, and code assertions, and add a direct cause-chain
assertion so future refactors cannot break error wrapping while still passing
this test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6bd6ab5a-2c65-4a10-9168-e7fd04adbf0d
📒 Files selected for processing (3)
shortcuts/calendar/calendar_create.goshortcuts/calendar/calendar_test.goskills/lark-calendar/references/lark-calendar-create.md
|
I believe your feedback is valuable; we will take it into account to optimize the workflow for creating meetings in rooms that require approval. |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@26a5adaf64a99d4aa97dc84f750c94c565422f71🧩 Skill updatenpx skills add xu91102/cli#fix/calendar-approval-room-guidance -y -g |
Summary
Improve
calendar +creatediagnostics when adding an approval-required meeting room fails becauseattendees[].approval_reasonis required.Changes
approval_reasonand append actionable guidance to usecalendar event.attendees create --as user.api/invalid_parameters/ code) and existing rollback context.Verification
GOCACHE=$PWD/.cache/go-build GOPROXY=https://goproxy.cn,direct go test ./shortcuts/calendar -run TestCreate_ApprovalRoomMissingReason_GuidesRawAttendeesAPI -count=1GOCACHE=$PWD/.cache/go-build GOPROXY=https://goproxy.cn,direct go test ./shortcuts/calendar -run 'TestCreate_(ApprovalRoomMissingReason_GuidesRawAttendeesAPI|WithAttendees_InvalidParamsWithDetail_RollsBack|WithAttendees_APIError_RollsBack)' -count=1\n- [x]GOCACHE=$PWD/.cache/go-build GOPROXY=https://goproxy.cn,direct go test ./shortcuts/calendar -count=1\n- [x]git diff --check\n\n## Risk and rollback\n- Risk is limited to extra guidance in an existing error path and docs. Rollback is reverting this commit.\n\n## Related Issues\n- Fixes cli预定会议室,遇到需要审批的会议室预定失败,因为缺少approval_reason #1608Summary by CodeRabbit
Bug Fixes
approval_reasonfield.Documentation
approval_reasonfor approved meeting rooms.