Skip to content

0727 fix rich text - #2062

Merged
zhangjun-bytedance merged 1 commit into
mainfrom
feat/0727_rich_text
Jul 27, 2026
Merged

0727 fix rich text#2062
zhangjun-bytedance merged 1 commit into
mainfrom
feat/0727_rich_text

Conversation

@zhangjun-bytedance

@zhangjun-bytedance zhangjun-bytedance commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Changes

  • Change 1
  • Change 2

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark-cli <domain> <command> flow works as expected

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Unified calendar event descriptions under the --description Markdown field for creating and updating events.
    • Local images referenced in Markdown descriptions are resolved and uploaded automatically.
  • Bug Fixes

    • Calendar event views now consistently return a single normalized description field.
    • Empty descriptions are omitted, and rich text takes precedence when available.
  • Documentation

    • Updated calendar command guidance and examples to use --description instead of the deprecated description flag.

@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 Jul 27, 2026
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Calendar create, update, get, and agenda commands now use description as the unified Markdown description field. Rich descriptions remain mapped to description_rich in API requests, while CLI output removes that internal field. Local image resolution and documentation now use --description.

Changes

Calendar description unification

Layer / File(s) Summary
Description normalization and output
shortcuts/calendar/helpers.go, shortcuts/calendar/calendar_get.go, shortcuts/calendar/calendar_agenda.go, shortcuts/calendar/calendar_test.go
Replaces rich-description backfilling with unified description normalization for get and agenda output, with tests covering rich, plain, and empty descriptions.
Unified create and update input
shortcuts/calendar/calendar_create.go, shortcuts/calendar/calendar_update.go, shortcuts/calendar/description_rich_images.go, shortcuts/calendar/*_test.go, tests/cli_e2e/calendar/*
Uses --description for Markdown input, maps it to description_rich in requests, resolves local images from the unified field, and updates validation and dry-run coverage.
Calendar description contract documentation
skills/lark-calendar/SKILL.md, skills/lark-calendar/references/*
Documents --description as the Markdown description flag for create, update, and recurring-event operations.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • larksuite/cli#678: Also changes calendar +update description flag interpretation and output mapping.
  • larksuite/cli#1768: Introduces the calendar +get output transformation touched by this normalization change.
  • larksuite/cli#1975: Modifies the calendar rich-description pipeline that this change unifies.

Suggested labels: documentation

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The body is only the template with placeholders and lacks any actual summary, changes, test plan, or issue links. Fill in the Summary, Changes, Test Plan, and Related Issues sections with concrete details about the rich-text description updates and validation.
Docstring Coverage ⚠️ Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is brief and refers to the rich text description change, which matches the main theme of the PR.
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.
✨ 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/0727_rich_text

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: 2

Caution

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

⚠️ Outside diff range comments (3)
tests/cli_e2e/calendar/calendar_description_rich_dryrun_test.go (2)

90-117: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert that update omits the plain description field.

The create tests verify this, but TestCalendar_UpdateDescriptionRichDryRun checks only description_rich. A request that sends both fields could therefore pass.

🤖 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 `@tests/cli_e2e/calendar/calendar_description_rich_dryrun_test.go` around lines
90 - 117, Update TestCalendar_UpdateDescriptionRichDryRun to also assert that
api.0.body.description is absent from the dry-run request, while preserving the
existing description_rich assertion.

20-42: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Add live E2E coverage for rich --description.

The calendar E2E workflows only cover plain Description payloads; TestCalendar_CreateEvent and TestCalendar_UpdateEventWorkflow assert data.event.description and use simple strings, while calendar_description_rich_dryrun_test.go only covers description_rich via dry-run. Add a self-contained live create/update workflow with credentials that sends Markdown --description and asserts it is persisted/returned with the service’s description_rich representation, or reference equivalent coverage if it exists.

🤖 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 `@tests/cli_e2e/calendar/calendar_description_rich_dryrun_test.go` around lines
20 - 42, Add self-contained live E2E coverage for rich Markdown descriptions,
using the existing calendar create/update workflow symbols such as
TestCalendar_CreateEvent and TestCalendar_UpdateEventWorkflow as references.
Create an event with Markdown passed via --description, update it if needed, and
assert the live service response persists and returns the content through
data.event.description_rich rather than data.event.description; reuse existing
credential and cleanup patterns, or reference equivalent coverage if already
present.

Source: Coding guidelines

shortcuts/calendar/description_rich_images_test.go (1)

256-277: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Assert the complete typed error contract.

This test checks only ValidationError and Param. Use errs.ProblemOf for category/subtype, retain the ValidationError assertion for Param, and verify that the underlying path-validation cause is preserved.

🤖 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/description_rich_images_test.go` around lines 256 - 277,
Expand TestCreate_LocalImageAbsolutePathRejected to assert the complete typed
error contract: use errs.ProblemOf to verify the expected category and subtype,
retain the *errs.ValidationError assertion for Param, and confirm the underlying
absolute-path validation cause is preserved.

Sources: Coding guidelines, Learnings

🤖 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 `@skills/lark-calendar/references/lark-calendar-create.md`:
- Line 35: Update the --description row in the documentation table to remove
spaces immediately inside the inline-code spans for the heading and quote
markers, while preserving the displayed Markdown syntax and all surrounding
description text.

In `@skills/lark-calendar/references/lark-calendar-update.md`:
- Line 46: Update the Markdown table entry for --description to remove spaces
immediately inside every inline-code span, including the heading-level examples,
while preserving the documented syntax and spacing outside the backticks.

---

Outside diff comments:
In `@shortcuts/calendar/description_rich_images_test.go`:
- Around line 256-277: Expand TestCreate_LocalImageAbsolutePathRejected to
assert the complete typed error contract: use errs.ProblemOf to verify the
expected category and subtype, retain the *errs.ValidationError assertion for
Param, and confirm the underlying absolute-path validation cause is preserved.

In `@tests/cli_e2e/calendar/calendar_description_rich_dryrun_test.go`:
- Around line 90-117: Update TestCalendar_UpdateDescriptionRichDryRun to also
assert that api.0.body.description is absent from the dry-run request, while
preserving the existing description_rich assertion.
- Around line 20-42: Add self-contained live E2E coverage for rich Markdown
descriptions, using the existing calendar create/update workflow symbols such as
TestCalendar_CreateEvent and TestCalendar_UpdateEventWorkflow as references.
Create an event with Markdown passed via --description, update it if needed, and
assert the live service response persists and returns the content through
data.event.description_rich rather than data.event.description; reuse existing
credential and cleanup patterns, or reference equivalent coverage if already
present.
🪄 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 Plus

Run ID: 27d964fb-7721-4abc-80b5-bb7f29741f8b

📥 Commits

Reviewing files that changed from the base of the PR and between 56c9a2a and 73712c7.

📒 Files selected for processing (13)
  • shortcuts/calendar/calendar_agenda.go
  • shortcuts/calendar/calendar_create.go
  • shortcuts/calendar/calendar_get.go
  • shortcuts/calendar/calendar_test.go
  • shortcuts/calendar/calendar_update.go
  • shortcuts/calendar/description_rich_images.go
  • shortcuts/calendar/description_rich_images_test.go
  • shortcuts/calendar/helpers.go
  • skills/lark-calendar/SKILL.md
  • skills/lark-calendar/references/lark-calendar-create.md
  • skills/lark-calendar/references/lark-calendar-recurring.md
  • skills/lark-calendar/references/lark-calendar-update.md
  • tests/cli_e2e/calendar/calendar_description_rich_dryrun_test.go

Comment thread skills/lark-calendar/references/lark-calendar-create.md
Comment thread skills/lark-calendar/references/lark-calendar-update.md
@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@73712c7aa0fa0ece62b799e665325e70336ba57c

🧩 Skill update

npx skills add larksuite/cli#feat/0727_rich_text -y -g

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.41935% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.16%. Comparing base (56c9a2a) to head (73712c7).

Files with missing lines Patch % Lines
shortcuts/calendar/calendar_update.go 37.50% 2 Missing and 3 partials ⚠️
shortcuts/calendar/description_rich_images.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2062   +/-   ##
=======================================
  Coverage   75.15%   75.16%           
=======================================
  Files         912      912           
  Lines       96453    96451    -2     
=======================================
+ Hits        72492    72495    +3     
+ Misses      18383    18380    -3     
+ Partials     5578     5576    -2     

☔ View full report in Codecov by Harness.
📢 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.

@zhangjun-bytedance
zhangjun-bytedance merged commit 8fb2476 into main Jul 27, 2026
38 of 45 checks passed
@zhangjun-bytedance
zhangjun-bytedance deleted the feat/0727_rich_text branch July 27, 2026 08:17
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.

2 participants