Skip to content

Feat/task app members#712

Merged
zero-my merged 2 commits into
larksuite:mainfrom
zero-my:feat/task-app-members
Apr 29, 2026
Merged

Feat/task app members#712
zero-my merged 2 commits into
larksuite:mainfrom
zero-my:feat/task-app-members

Conversation

@zero-my

@zero-my zero-my commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Support app task members in task shortcuts by inferring member type from the input ID. This also adds follower support during task creation and keeps member construction consistent across assign/follower shortcuts.

Changes

  • infer task member type from ID (cli_ => app, otherwise user)
  • support --follower in task +create
  • reuse the same task member builder across +assign and +followers
  • add tests for inferred app/user member types and create/assign/follower flows

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark xxx command works as expected

Related Issues

  • None

Summary by CodeRabbit

Release Notes

  • New Features
    • Added follower support for task assignments, allowing tasks to include both assignees and followers.
    • Enhanced member identification to automatically distinguish between user and app members based on ID format.
    • Improved CLI flag documentation to clearly specify required ID formats for different member types.

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Task creation and assignment workflows now support distinguishing between user and app members based on ID prefixes (cli_ → "app", otherwise "user"). Members are constructed using a new buildTaskMember function. Task creation now accepts both assignee and follower inputs, and all member operations properly infer the type field.

Changes

Cohort / File(s) Summary
Member type inference and command updates
shortcuts/task/shortcuts.go, shortcuts/task/task_assign.go, shortcuts/task/task_followers.go
Flag documentation updated to specify ID formats for users (ou_xxx) vs apps (cli_xxx). Member construction now delegates to buildTaskMember(id, role) which infers type from ID prefix. buildMembersBody signature updated to accept a role parameter. Task creation supports both assignee and follower flags.
Command and member construction tests
shortcuts/task/task_assign_test.go, shortcuts/task/task_followers_test.go
Test suite extended to validate role/type construction, type inference from ID prefixes, and correct member ordering in members array. Added test for task creation with both assignee and follower inputs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A member came hopping through the code,
With IDs in two formats shown—
cli_ for apps, ou_ for users true,
Type inference blooms in what we do!
Assignees, followers, now they shine,
With roles and types defined so fine! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% 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 'Feat/task app members' directly describes the main feature addition: support for app task members in task shortcuts.
Description check ✅ Passed The pull request description covers all required template sections including summary, changes, test plan, and related issues.
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 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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added domain/task PR touches the task domain size/M Single-domain feat or fix with limited business impact labels Apr 29, 2026

@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

🧹 Nitpick comments (1)
shortcuts/task/shortcuts.go (1)

115-120: Consider trimming create-time member IDs before building payloads.

buildMembersBody/buildFollowersBody normalize whitespace, but create-path IDs currently pass through raw. Trimming here would make behavior consistent and reduce avoidable API failures from accidental spaces.

♻️ Suggested refactor
-	if assignee := runtime.Str("assignee"); assignee != "" {
+	if assignee := strings.TrimSpace(runtime.Str("assignee")); assignee != "" {
 		members = append(members, buildTaskMember(assignee, "assignee"))
 	}
-	if follower := runtime.Str("follower"); follower != "" {
+	if follower := strings.TrimSpace(runtime.Str("follower")); follower != "" {
 		members = append(members, buildTaskMember(follower, "follower"))
 	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shortcuts/task/shortcuts.go` around lines 115 - 120, The assignee and
follower IDs read via runtime.Str are not trimmed before being passed to
buildTaskMember, causing inconsistency with buildMembersBody/buildFollowersBody;
update the code around the runtime.Str("assignee") and runtime.Str("follower")
usages to call strings.TrimSpace on the returned values (or an equivalent trim
helper) and only append when the trimmed value is non-empty, so buildTaskMember
always receives normalized IDs; apply the same trimming pattern to any other
create-path ID reads to avoid accidental-space API failures.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@shortcuts/task/task_assign.go`:
- Around line 127-135: Update the user-facing strings that misspell "assignees":
replace the fmt.Fprintf call currently printing "✅ Task assignes updated
successfully!" with "✅ Task assignees updated successfully!" and change the
fmt.Fprintf that prints "Current Assignes: %d\n" to "Current Assignees: %d\n";
locate these calls in task_assign.go (the fmt.Fprintf calls that format
taskId/url and members count) and correct the two string literals to the proper
spelling.

---

Nitpick comments:
In `@shortcuts/task/shortcuts.go`:
- Around line 115-120: The assignee and follower IDs read via runtime.Str are
not trimmed before being passed to buildTaskMember, causing inconsistency with
buildMembersBody/buildFollowersBody; update the code around the
runtime.Str("assignee") and runtime.Str("follower") usages to call
strings.TrimSpace on the returned values (or an equivalent trim helper) and only
append when the trimmed value is non-empty, so buildTaskMember always receives
normalized IDs; apply the same trimming pattern to any other create-path ID
reads to avoid accidental-space API failures.
🪄 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: 9e612c2e-b98c-40b3-ac3e-13bf36f1349f

📥 Commits

Reviewing files that changed from the base of the PR and between 7752afa and f962317.

📒 Files selected for processing (5)
  • shortcuts/task/shortcuts.go
  • shortcuts/task/task_assign.go
  • shortcuts/task/task_assign_test.go
  • shortcuts/task/task_followers.go
  • shortcuts/task/task_followers_test.go

Comment thread shortcuts/task/task_assign.go
@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.17%. Comparing base (6bb988a) to head (f962317).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/task/task_assign.go 25.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #712      +/-   ##
==========================================
+ Coverage   63.80%   64.17%   +0.37%     
==========================================
  Files         500      504       +4     
  Lines       43531    44287     +756     
==========================================
+ Hits        27773    28420     +647     
- Misses      13317    13393      +76     
- Partials     2441     2474      +33     

☔ 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@f9623177b042f7c11ad7902c6a065e537ea4d0d1

🧩 Skill update

npx skills add zero-my/cli#feat/task-app-members -y -g

@zero-my
zero-my merged commit 2eb9fae into larksuite:main Apr 29, 2026
18 checks passed
HomyeeKing pushed a commit to HomyeeKing/cli that referenced this pull request May 6, 2026
* feat: support app task members by id

* docs: clarify task member id formats
tuxedomm pushed a commit to zhumiaoxin/cli that referenced this pull request Jun 6, 2026
* feat: support app task members by id

* docs: clarify task member id formats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

3 participants