Skip to content

feat: add calendar update shortcut#678

Merged
calendar-assistant merged 1 commit intomainfrom
feat/calendar-update-shortcut
Apr 27, 2026
Merged

feat: add calendar update shortcut#678
calendar-assistant merged 1 commit intomainfrom
feat/calendar-update-shortcut

Conversation

@calendar-assistant
Copy link
Copy Markdown
Collaborator

@calendar-assistant calendar-assistant commented Apr 27, 2026

Summary

Add a calendar +update shortcut for updating existing calendar events and incrementally adding or removing attendees, chats, and meeting rooms.

Changes

  • Register calendar +update with event field patching, attendee batch delete, attendee add, dry-run output, validation, and structured API errors.
  • Add unit coverage for event-only updates, attendee add/remove, combined multi-step updates, dry-run output, and validation failures.
  • Add calendar dry-run E2E coverage plus a live create-update-verify-delete workflow.
  • Update the lark-calendar skill docs and meeting scheduling workflow to route existing-event edits through +update.

Test Plan

  • make unit-test
  • go vet ./...
  • gofmt -l .
  • go mod tidy produced no go.mod/go.sum diff
  • go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6 run --new-from-rev=origin/main
  • go test -race -gcflags="all=-N -l" -count=1 ./shortcuts/calendar

Related Issues

  • None

Summary by CodeRabbit

Release Notes

  • New Features

    • Added calendar +update command to modify existing events: update event details (summary, description, start/end times, recurrence rules), incrementally add or remove attendees/rooms, and control attendee notifications. Includes dry-run preview mode.
  • Documentation

    • Added comprehensive reference guide for the update command with parameter details, examples, and workflow scenarios.

Change-Id: Ie2d4bde6cd28bbf4d7946db38c5c9be13edc6ba9
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

📝 Walkthrough

Walkthrough

A new calendar +update shortcut command is introduced with support for modifying event fields, adding/removing attendees and rooms, and controlling notifications. The implementation includes comprehensive unit tests, two end-to-end workflow tests, and documentation covering the command semantics and skill integration guidance.

Changes

Cohort / File(s) Summary
Calendar Update Feature Implementation
shortcuts/calendar/calendar_update.go, shortcuts/calendar/shortcuts.go
Introduces +update shortcut with flags for event/calendar IDs, editable fields (summary, description, rrule, start/end), attendee modifications, and notification control. Validates event-id presence, attendee-id formats, no overlap between add/remove lists, paired start/end with end > start, and at least one actionable update. Executes three sequential API calls: PATCH event, POST batch-delete attendees, POST add attendees with formatted result table output.
Unit and Integration Tests
shortcuts/calendar/calendar_test.go, tests/cli_e2e/calendar/calendar_update_dryrun_test.go, tests/cli_e2e/calendar/calendar_update_event_test.go
Adds 250+ unit tests verifying event patch payload, attendee add/remove request bodies, combined update flow, dry-run output, and comprehensive validation matrix (missing fields, invalid formats, duplicates, incomplete ranges). Includes two e2e tests: dry-run output verification and full update workflow with event creation, modification, verification, and cleanup.
Documentation and Skill Guidance
skills/lark-calendar/SKILL.md, skills/lark-calendar/references/lark-calendar-schedule-meeting.md, skills/lark-calendar/references/lark-calendar-update.md
Updates skill documentation with new vs edit task-type distinction for scheduling workflows, refines edit-flow requirements including pre-targeting for recurring instances, clarifies room handling (incremental add vs explicit replacement/removal), and updates confirmation blocking rules. Adds new reference guide documenting +update command parameters, update semantics, execution order, and room rescheduling/adding workflows.

Sequence Diagram

sequenceDiagram
    actor User
    participant CLI as CLI Client
    participant API as Lark API
    participant Response as Result Formatter

    User->>CLI: calendar +update --event-id=... --summary=... <br/> --add-attendee-ids=... --remove-attendee-ids=...
    CLI->>CLI: Validate flags & constraints
    
    rect rgba(100, 150, 255, 0.5)
    Note over CLI,API: Sequential Execution Flow
    
    CLI->>API: PATCH /events/{event_id}<br/>(summary, description, time, rrule,<br/>need_notification)
    API-->>CLI: Event updated
    
    CLI->>API: POST /events/{event_id}/<br/>attendees_batch_delete<br/>(user IDs, resource IDs)
    API-->>CLI: Attendees removed
    
    CLI->>API: POST /events/{event_id}/<br/>attendees<br/>(user, chat, resource entries)
    API-->>CLI: Attendees added
    end
    
    CLI->>Response: Format result table<br/>(event_id, counts,<br/>summary/description/times)
    Response-->>User: Display formatted output
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

domain/calendar, size/L, feature

Suggested reviewers

  • hugang-lark

Poem

🐰 A calendar twist, an update so neat,
Attendees dance in and out, oh so sweet!
Fields shift and shimmer with each clever flag,
Three API calls—no workflow lags!
Events bloom brighter in edit's delight! 📅✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a new calendar update shortcut feature.
Description check ✅ Passed The description follows the template structure with Summary, Changes, Test Plan, and Related Issues sections, providing comprehensive details about the implementation and verification.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/calendar-update-shortcut

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 and usage tips.

@github-actions github-actions Bot added domain/calendar PR touches the calendar domain size/L Large or sensitive change across domains or core paths labels Apr 27, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 75.20661% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.04%. Comparing base (8ec95a4) to head (44f84a8).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/calendar/calendar_update.go 75.10% 36 Missing and 24 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #678      +/-   ##
==========================================
+ Coverage   62.96%   63.04%   +0.08%     
==========================================
  Files         436      437       +1     
  Lines       38605    38847     +242     
==========================================
+ Hits        24307    24491     +184     
- Misses      12150    12184      +34     
- Partials     2148     2172      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@44f84a8aecf1eb624dd29258840c8cd898fbf62c

🧩 Skill update

npx skills add larksuite/cli#feat/calendar-update-shortcut -y -g

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
shortcuts/calendar/calendar_update.go (1)

98-104: Use trimmed comparisons here for consistency with the rest of the file.

hasCalendarUpdateOperation uses raw len(...) > 0, while the rest of the file (parseCalendarAttendeeIDs, the dry-run, and the executor) all guard with strings.TrimSpace(...) != "". A whitespace-only flag (e.g. --add-attendee-ids " ") would currently pass the "nothing to update" validation but result in zero API calls during execute, returning success with no actions taken.

♻️ Proposed fix
 func hasCalendarUpdateOperation(runtime *common.RuntimeContext) bool {
-	if len(runtime.Str("add-attendee-ids")) > 0 || len(runtime.Str("remove-attendee-ids")) > 0 {
+	if strings.TrimSpace(runtime.Str("add-attendee-ids")) != "" ||
+		strings.TrimSpace(runtime.Str("remove-attendee-ids")) != "" {
 		return true
 	}
 	body, hasEventFields, err := buildCalendarUpdateEventData(runtime)
 	return err == nil && hasEventFields && len(body) > 0
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shortcuts/calendar/calendar_update.go` around lines 98 - 104,
hasCalendarUpdateOperation currently uses raw len(...) > 0 checks which let
whitespace-only flags slip through; update it to mirror the rest of the file by
trimming values before comparing. Specifically, replace
len(runtime.Str("add-attendee-ids")) > 0 and
len(runtime.Str("remove-attendee-ids")) > 0 with
strings.TrimSpace(runtime.Str("add-attendee-ids")) != "" and
strings.TrimSpace(runtime.Str("remove-attendee-ids")) != "", and change the body
check from len(body) > 0 to strings.TrimSpace(body) != ""; keep the rest of the
logic (err == nil && hasEventFields) the same so hasCalendarUpdateOperation
returns true only for non-whitespace inputs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@shortcuts/calendar/calendar_update.go`:
- Around line 98-104: hasCalendarUpdateOperation currently uses raw len(...) > 0
checks which let whitespace-only flags slip through; update it to mirror the
rest of the file by trimming values before comparing. Specifically, replace
len(runtime.Str("add-attendee-ids")) > 0 and
len(runtime.Str("remove-attendee-ids")) > 0 with
strings.TrimSpace(runtime.Str("add-attendee-ids")) != "" and
strings.TrimSpace(runtime.Str("remove-attendee-ids")) != "", and change the body
check from len(body) > 0 to strings.TrimSpace(body) != ""; keep the rest of the
logic (err == nil && hasEventFields) the same so hasCalendarUpdateOperation
returns true only for non-whitespace inputs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a2063d6a-fc63-49c6-a75b-50a16a22b2e0

📥 Commits

Reviewing files that changed from the base of the PR and between 8ec95a4 and 44f84a8.

📒 Files selected for processing (8)
  • shortcuts/calendar/calendar_test.go
  • shortcuts/calendar/calendar_update.go
  • shortcuts/calendar/shortcuts.go
  • skills/lark-calendar/SKILL.md
  • skills/lark-calendar/references/lark-calendar-schedule-meeting.md
  • skills/lark-calendar/references/lark-calendar-update.md
  • tests/cli_e2e/calendar/calendar_update_dryrun_test.go
  • tests/cli_e2e/calendar/calendar_update_event_test.go

@calendar-assistant calendar-assistant merged commit 78d92de into main Apr 27, 2026
21 of 22 checks passed
@calendar-assistant calendar-assistant deleted the feat/calendar-update-shortcut branch April 27, 2026 11:27
@liangshuo-1 liangshuo-1 mentioned this pull request Apr 27, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/calendar PR touches the calendar 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.

3 participants