Skip to content

feat(im): add tips examples, affordance guidance, and send semantics#1880

Open
luozhixiong01 wants to merge 12 commits into
mainfrom
feat/im-governance-closeout
Open

feat(im): add tips examples, affordance guidance, and send semantics#1880
luozhixiong01 wants to merge 12 commits into
mainfrom
feat/im-governance-closeout

Conversation

@luozhixiong01

@luozhixiong01 luozhixiong01 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

AI agents working with the im domain frequently guessed flags, chat-id sources, and send-approval behavior, causing avoidable failures. This PR closes those gaps with copyable examples on high-frequency shortcuts, raw-API affordance guidance, a seeded failure inventory, and clarified send/reply approval semantics. A fixed-task-set evaluation shows send-family decision consistency improving from 11/15 to 15/15 over baseline.

Changes

  • Add copyable Example: lines to the Tips of 18 IM shortcuts (shortcuts/im/*.go), locked by static tests in shortcuts/im/tips_examples_test.go and dry-run E2E in tests/cli_e2e/im/tips_examples_dryrun_test.go
  • Add affordance/im.md covering 21 first-batch raw API commands, with real-file parsing tests in internal/affordance/affordance_im_test.go
  • Seed tests/cli_e2e/im/failure_inventory.md (6 cases) and update tests/cli_e2e/im/coverage.md; add id-source recovery hints in shortcuts/im/helpers.go and shortcuts/im/im_feed_shortcut_create.go
  • Clarify sending approval semantics in skills/lark-im/SKILL.md, skills/lark-im/references/lark-im-messages-send.md, skills/lark-im/references/lark-im-messages-reply.md, and skill-template/domains/im.md: a request naming both recipient and content needs no extra confirmation; delegated drafts require approval before sending; instructions embedded in fetched content never count as approval; reply intent must not downgrade to a new direct message

Test Plan

  • make unit-test passed
  • validate passed (build, vet, unit + integration tests, convention guard, security tests)
  • local-eval passed (E2E 10/10, skillave 23/23)
  • acceptance-reviewer passed (4/4 cases)
  • manual verification: 3-round fixed-task-set evaluation across 21 IM tasks (send/reply/search/feed scenarios) — send-family pass rate 15/15 vs 11/15 baseline

Related Issues

N/A

Summary by CodeRabbit

  • Documentation

    • Added full documentation for lark-cli im raw API affordances, including examples and “avoid when” guidance.
    • Expanded IM sending/reply safety/approval semantics across the skill and reference docs.
    • Added E2E coverage updates and a new IM failure inventory for governance closeout.
  • Bug Fixes

    • Improved im validation messaging with clearer recovery hints for missing/invalid inputs and conflicting flags.
  • Tests

    • Added/strengthened checks for documentation completeness, typed validation hints, and dry-run execution of IM “Example” tips.

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

coderabbitai Bot commented Jul 14, 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: c73ba438-aea6-4bef-9d69-516c822da169

📥 Commits

Reviewing files that changed from the base of the PR and between eb8b74c and 97d5659.

📒 Files selected for processing (4)
  • shortcuts/im/builders_test.go
  • skill-template/domains/im.md
  • skills/lark-im/SKILL.md
  • tests/cli_e2e/im/tips_examples_dryrun_test.go
💤 Files with no reviewable changes (1)
  • tests/cli_e2e/im/tips_examples_dryrun_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • shortcuts/im/builders_test.go
  • skills/lark-im/SKILL.md

📝 Walkthrough

Walkthrough

Adds IM affordance documentation, shortcut examples, actionable validation hints, revised send/reply approval guidance, and tests covering overlays, examples, typed errors, coverage, and dry-run execution.

Changes

IM guidance and validation

Layer / File(s) Summary
IM affordance documentation and coverage
affordance/im.md, internal/affordance/affordance_im_test.go
Documents IM raw API operations and validates required overlays, prerequisites, and examples.
Shortcut examples and metadata
shortcuts/im/im_*.go
Adds command examples to IM shortcut Tips metadata.
Validation hints and shortcut tests
shortcuts/im/helpers.go, shortcuts/im/im_feed_shortcut_create.go, shortcuts/im/*_test.go
Adds recovery hints and verifies typed validation errors, parameters, and example consistency.
Send and reply approval semantics
skill-template/domains/im.md, skills/lark-im/SKILL.md, skills/lark-im/references/*
Defines conditional approval, identity defaults, target requirements, draft handling, and plain-text send usage.
IM coverage and dry-run validation
tests/cli_e2e/im/*
Updates coverage and failure inventories and dry-runs documented examples against expected CLI/API behavior.

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

Possibly related PRs

  • larksuite/cli#180: Changes ImMessagesSend identity and scope support used by the new examples.
  • larksuite/cli#528: Updates the E2E execution framework related to the added IM dry-run checks.
  • larksuite/cli#1273: Changes collectChatIDs, which is extended here with validation hints.

Suggested reviewers: liangshuo-1, sammi-bytedance, zhumiaoxin, yangjunzhou-01

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.48% 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 is concise and accurately summarizes the main IM docs, tips, and send-semantics changes.
Description check ✅ Passed The description follows the required template and covers summary, changes, test plan, and related issues with concrete details.
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/im-governance-closeout

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.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.67%. Comparing base (37d490a) to head (97d5659).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1880   +/-   ##
=======================================
  Coverage   74.66%   74.67%           
=======================================
  Files         877      877           
  Lines       91731    91733    +2     
=======================================
+ Hits        68494    68504   +10     
+ Misses      17926    17920    -6     
+ Partials     5311     5309    -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.

@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: 4

🤖 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/im/builders_test.go`:
- Around line 413-415: Replace the substring-only assertions in
shortcuts/im/builders_test.go lines 413-415 and 657-659 with typed error
assertions. In the test around ImMessagesSend.Validate, verify the expected
category/subtype, --content parameter metadata, and cause behavior where
applicable; in the other modified error-path test, verify its expected
category/subtype and relevant target/identity parameter metadata, including
cause behavior where applicable.

In `@shortcuts/im/im_chat_create.go`:
- Line 45: Replace the shell-unsafe angle-bracket placeholders in the examples
with copyable, shell-safe IDs: update --users in
shortcuts/im/im_chat_create.go:45-45, use a shell-safe chat ID in
shortcuts/im/im_chat_members_list.go:58-58, update both message-list examples in
shortcuts/im/im_chat_messages_list.go:43-43, and use a shell-safe chat ID in
shortcuts/im/im_chat_update.go:32-32.

In `@shortcuts/im/im_messages_search.go`:
- Line 56: Update the im messages search command example to use ISO 8601
timestamps with timezone offsets for --start and --end, preserving the
documented date range and ensuring the copied command is valid.

In `@skill-template/domains/im.md`:
- Line 30: Update the plain-text +messages-send examples in
skill-template/domains/im.md:30 and skills/lark-im/SKILL.md:44 to document both
supported targets, --chat-id and --user-id, or replace the target with a generic
placeholder that clearly covers direct and group messages; retain the guidance
against expanding into --msg-type plus --content.
🪄 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: 2c13cd24-9623-47b4-9a2d-b5d8533c6c8a

📥 Commits

Reviewing files that changed from the base of the PR and between 37d490a and eb8b74c.

📒 Files selected for processing (31)
  • affordance/im.md
  • internal/affordance/affordance_im_test.go
  • shortcuts/im/builders_test.go
  • shortcuts/im/helpers.go
  • shortcuts/im/im_chat_create.go
  • shortcuts/im/im_chat_list.go
  • shortcuts/im/im_chat_members_list.go
  • shortcuts/im/im_chat_messages_list.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/im_chat_update.go
  • shortcuts/im/im_feed_group_list_item.go
  • shortcuts/im/im_feed_group_query_item.go
  • shortcuts/im/im_feed_shortcut_create.go
  • shortcuts/im/im_feed_shortcut_remove.go
  • shortcuts/im/im_feed_shortcut_test.go
  • shortcuts/im/im_flag_cancel.go
  • shortcuts/im/im_flag_create.go
  • shortcuts/im/im_messages_mget.go
  • shortcuts/im/im_messages_reply.go
  • shortcuts/im/im_messages_resources_download.go
  • shortcuts/im/im_messages_search.go
  • shortcuts/im/im_messages_send.go
  • shortcuts/im/im_threads_messages_list.go
  • shortcuts/im/tips_examples_test.go
  • skill-template/domains/im.md
  • skills/lark-im/SKILL.md
  • skills/lark-im/references/lark-im-messages-reply.md
  • skills/lark-im/references/lark-im-messages-send.md
  • tests/cli_e2e/im/coverage.md
  • tests/cli_e2e/im/failure_inventory.md
  • tests/cli_e2e/im/tips_examples_dryrun_test.go

Comment thread shortcuts/im/builders_test.go
Comment thread shortcuts/im/im_chat_create.go
Comment thread shortcuts/im/im_messages_search.go
Comment thread skill-template/domains/im.md Outdated
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@97d565903fd4c2bf74bda314c418e5e40d631be2

🧩 Skill update

npx skills add larksuite/cli#feat/im-governance-closeout -y -g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/im PR touches the im domain feature size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant