Skip to content

fix(calendar): support all-day event creation#1603

Open
xu91102 wants to merge 2 commits into
larksuite:mainfrom
xu91102:fix/calendar-create-all-day
Open

fix(calendar): support all-day event creation#1603
xu91102 wants to merge 2 commits into
larksuite:mainfrom
xu91102:fix/calendar-create-all-day

Conversation

@xu91102

@xu91102 xu91102 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds --all-day support to calendar +create so the shortcut can create true date-based all-day events instead of timestamp-only events.

Changes

  • Add --all-day to calendar +create.
  • Validate all-day --start / --end as YYYY-MM-DD, including single-day events where start equals end.
  • Send start_time.date / end_time.date for all-day events, with free_busy_status: free and vchat.vc_type: no_meeting.
  • Keep existing timed event defaults unchanged.
  • Update CLI help, unit coverage, dry-run E2E coverage, and calendar skill docs.

Test Plan

  • Unit tests pass: GOPROXY=https://goproxy.cn,direct go test ./shortcuts/calendar -count=1
  • Targeted unit tests pass: GOPROXY=https://goproxy.cn,direct go test ./shortcuts/calendar -run 'TestCreate_AllDay|TestBuildEventData_DefaultVChat|TestCreate_CreateEventOnly' -count=1
  • Dry-run E2E passes: LARK_CLI_BIN=/Users/xu/Documents/Codex/2026-06-24/ba/work/larksuite-cli-862/lark-cli GOPROXY=https://goproxy.cn,direct go test ./tests/cli_e2e/calendar -run TestCalendar_CreateAllDayDryRun -count=1
  • Formatting check passes: gofmt -l shortcuts/calendar/calendar_create.go shortcuts/calendar/calendar_test.go tests/cli_e2e/calendar/calendar_create_dryrun_test.go
  • Diff check passes: git diff --check

Related Issues

Summary by CodeRabbit

  • New Features

    • Added calendar +create --all-day to create all-day events.
    • All-day events now use YYYY-MM-DD start/end (date fields) and apply all-day defaults (free/busy and video-meeting disabled).
  • Bug Fixes

    • Strengthened validation for --all-day date format and ensures the end date is on/after the start date.
    • Dry-run now reports payload/validation errors more consistently.
  • Documentation

    • Updated usage docs and reference examples for --all-day.
    • Expanded e2e coverage notes for the all-day dry-run request shape.

@github-actions github-actions Bot added domain/calendar PR touches the calendar domain size/M Single-domain feat or fix with limited business impact labels Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 53a4df94-71ba-4307-bc7a-ccce17dbe381

📥 Commits

Reviewing files that changed from the base of the PR and between 9a8db93 and e911063.

📒 Files selected for processing (2)
  • shortcuts/calendar/calendar_create.go
  • shortcuts/calendar/calendar_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • shortcuts/calendar/calendar_test.go
  • shortcuts/calendar/calendar_create.go

📝 Walkthrough

Walkthrough

calendar +create now accepts --all-day, builds date-based payloads for all-day events, routes validation and execution through a shared payload builder, and adds tests plus documentation for the new request shape and defaults.

Changes

Calendar all-day create support

Layer / File(s) Summary
All-day payload builder and flag
shortcuts/calendar/calendar_create.go
Adds all-day payload construction and YYYY-MM-DD validation, and exposes the --all-day CLI flag.
Validation and command flow
shortcuts/calendar/calendar_create.go
Routes Validate, DryRun, and Execute through buildCalendarCreateEventData, with DryRun returning the validation error string when payload construction fails.
Tests and docs
shortcuts/calendar/calendar_test.go, tests/cli_e2e/calendar/*, tests/cli_e2e/calendar/coverage.md, skills/lark-calendar/SKILL.md, skills/lark-calendar/references/lark-calendar-create.md
Adds all-day request-shape and validation tests, dry-run coverage, coverage notes, and updated shortcut/reference docs for date-only creation and defaults.

Sequence Diagram(s)

sequenceDiagram
  participant CalendarCreate
  participant buildCalendarCreateEventData
  participant calendarEventsCreate
  CalendarCreate->>buildCalendarCreateEventData: build payload from --all-day, --start, --end
  buildCalendarCreateEventData-->>CalendarCreate: eventData or validation error
  CalendarCreate->>calendarEventsCreate: POST create event request
  calendarEventsCreate-->>CalendarCreate: response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • larksuite/cli#245: Also changes shortcuts/calendar/calendar_create.go validation flow in CalendarCreate.Validate.
  • larksuite/cli#383: Also touches the calendar create payload defaults, including vchat.vc_type.

Suggested labels

feature

Suggested reviewers

  • hugang-lark

Poem

I hopped through dates with quiet cheer,
and --all-day brought the garden near.
Free little petals, no meeting bell,
a moonlit calendar fits me well. 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding all-day event creation support to calendar +create.
Description check ✅ Passed The description matches the template with Summary, Changes, Test Plan, and Related Issues filled in.
Linked Issues check ✅ Passed The PR implements the requested #862 all-day flag, date validation, date-based payloads, and all-day defaults.
Out of Scope Changes check ✅ Passed The changes shown are focused on the all-day calendar feature, its tests, and related documentation updates.
✨ 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.

@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

Caution

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

⚠️ Outside diff range comments (1)
shortcuts/calendar/calendar_create.go (1)

145-152: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the CLI help text for --start / --end now that --all-day exists.

--all-day is documented here, but the adjacent --start and --end flag descriptions still say ISO 8601 only. calendar +create --help will therefore contradict the new validation path that requires YYYY-MM-DD in all-day mode.

🤖 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_create.go` around lines 145 - 152, Update the CLI
help text in the calendar create command so the `start` and `end` flag
descriptions reflect the `all-day` mode added alongside them. In
`calendar_create.go`, adjust the flag metadata for the `start` and `end` entries
used by the create command so their descriptions mention ISO 8601 for normal
events and YYYY-MM-DD when `all-day` is enabled, keeping the help text
consistent with the validation logic and the `all-day` flag documentation.
🤖 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 `@shortcuts/calendar/calendar_test.go`:
- Around line 269-326: Add a positive all-day create test for the allowed
single-day case where start equals end, since
TestCreate_AllDayValidationTypedErrors only covers rejection paths. Extend the
calendar create test coverage around CalendarCreate/mountAndRun to assert that
an all-day event with identical --start and --end succeeds, so a regression that
re-rejects end == start will fail.

---

Outside diff comments:
In `@shortcuts/calendar/calendar_create.go`:
- Around line 145-152: Update the CLI help text in the calendar create command
so the `start` and `end` flag descriptions reflect the `all-day` mode added
alongside them. In `calendar_create.go`, adjust the flag metadata for the
`start` and `end` entries used by the create command so their descriptions
mention ISO 8601 for normal events and YYYY-MM-DD when `all-day` is enabled,
keeping the help text consistent with the validation logic and the `all-day`
flag documentation.
🪄 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: 5720233c-9079-4fd1-b168-74c071d7add8

📥 Commits

Reviewing files that changed from the base of the PR and between d9330b7 and 9a8db93.

📒 Files selected for processing (6)
  • shortcuts/calendar/calendar_create.go
  • shortcuts/calendar/calendar_test.go
  • skills/lark-calendar/SKILL.md
  • skills/lark-calendar/references/lark-calendar-create.md
  • tests/cli_e2e/calendar/calendar_create_dryrun_test.go
  • tests/cli_e2e/calendar/coverage.md

Comment thread shortcuts/calendar/calendar_test.go
@xu91102

xu91102 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Addressed CodeRabbit follow-ups in e911063: updated the --start/--end CLI help text to mention YYYY-MM-DD with --all-day, and added positive coverage for a single-day all-day event where start equals end.

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/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: calendar +create --all-day for all-day events

1 participant