Skip to content

feat(drive): add comment batch-query/resolve/restore, reply CRUD and reaction shortcuts - #1898

Merged
zzzchao123 merged 1 commit into
mainfrom
feat/drive-comment-shortcuts
Jul 30, 2026
Merged

feat(drive): add comment batch-query/resolve/restore, reply CRUD and reaction shortcuts#1898
zzzchao123 merged 1 commit into
mainfrom
feat/drive-comment-shortcuts

Conversation

@zzzchao123

@zzzchao123 zzzchao123 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add eight comment-operation shortcuts to the drive domain, covering the remaining comment APIs — +batch-query-comments, +resolve-comment / +restore-comment, the full reply family +add-reply / +list-replies / +update-reply / +delete-reply (batch_query / patch / reply create / list / update / delete), and +react-reply for reply emoji reactions (update_reaction) — with the same URL-parsing + wiki-unwrapping UX as +list-comments.

Changes

Command API Risk
+batch-query-comments POST /drive/v1/files/:token/comments/batch_query--comment-ids (CSV/repeated, max 100), --need-reaction, --need-relation (docx-gated) read
+resolve-comment PATCH /drive/v1/files/:token/comments/:comment_id — sends is_solved=true write
+restore-comment same PATCH endpoint — sends is_solved=false (reopen a solved comment) write
+add-reply POST /drive/v1/files/:token/comments/:comment_id/replies--content reuses the +add-comment reply_elements JSON (same escaping and 10k-rune preflight), mapped to text_run/person/docs_link write
+list-replies GET .../comments/:comment_id/replies--page-size/--page-token pagination, --need-reaction read
+update-reply PUT .../comments/:comment_id/replies/:reply_id — whole-content replacement, same --content JSON as +add-reply write
+delete-reply DELETE .../comments/:comment_id/replies/:reply_id — requires --yes high-risk-write
+react-reply POST /drive/v2/files/:token/comments/reaction--reply-id + --emoji + --action add|delete → body reply_id/reaction_type/action write
  • All eight accept --url or --token + --type and unwrap wiki nodes automatically; shared input resolution lives in drive_comment_common.go, parameterized by each endpoint's supported file_type set. All eight accept Base (/base/ URLs, bitable/base types) and Miaoda apps targets (/page/<token> URLs, file_type=apps), matching the platform API metadata.
  • +resolve-comment / +restore-comment are two commands sharing one constructor over the same patch endpoint (the original single +resolve-comment --action resolve|restore read ambiguously — a "resolve" command that can also reopen); intent mapping is documented in the skill guide.
  • +batch-query-comments --need-relation mirrors +list-comments: docx-only (silently omitted for other targets) and sent in the request body, whereas the list endpoint takes it as a query param. The parameter is absent from the platform metadata for batch_query but honored by the server — verified live, returning relation with the anchoring block position. Its wiki dry-run surfaces the docx gate as a need_relation: "<sent only when obj_type is docx>" placeholder, since the resolved type is unknown until step 1.
  • Scopes follow the per-endpoint metadata: +add-reply declares docs:document.comment:create — the replies create endpoint does not accept docs:document.comment:write_only, so declaring both would false-reject valid create-only tokens; resolve/restore/update/delete/react keep write_only, batch-query/list keep comment:read.
  • +add-reply deliberately does not use the documented "POST .../comments with comment_id in the body" form: verified live, that variant silently creates a new standalone comment instead of replying. The dedicated replies endpoint is used instead (noted in code and in the skill guide).
  • Reply semantics, live-verified and documented in Tips + the skill guide:
    • the root reply (the comment body itself) is items[0] of the first page only — after --page-token paging, items[0] is a regular reply, so position must not be used to identify the root when paging;
    • updating a comment's root reply rewrites the comment body; deleting it deletes the whole card;
    • only the identity that created a reply can update it — cross-identity updates return 1069303 forbidden (verified in both user→bot and bot→user directions);
  • Reaction semantics, live-verified and documented in Tips + the reactions guide:
    • the server does not validate reaction_type — arbitrary strings are accepted and persisted as broken reactions, so --emoji is validated locally against the 149-value platform enum from the API metadata (case-sensitive: THUMBSUP vs ThumbsDown);
    • deleted reactions linger as count=0 entries in need_reaction reads, so presence checks filter by count>0;
    • add/delete are idempotent, and delete cancels only the caller's own reaction.
  • Output hardening: +list-comments / +batch-query-comments / +list-replies now always emit items as a JSON array (shared driveCommentItems helper) — previously a server response omitting items would surface "items": null and break jq consumers iterating .data.items[].
  • The eight new commands declare wiki:node:read as the wiki-unwrap conditional scope: live verification with both identities showed get_node accepts wiki:wiki / wiki:wiki:readonly / wiki:node:read (a token carrying only wiki:node:retrieve is rejected with 99991679), and the sheets/slides domains already declare wiki:node:read for the same unwrap step. Existing drive/base commands that still declare wiki:node:retrieve are intentionally left unchanged in this PR; aligning them is a candidate follow-up.
  • Skill docs restructured around one-entry routing so the main skill only routes and each shortcut owns its reference (no knowledge drift): SKILL.md keeps a single comment entry into references/lark-drive-comments-guide.md and terse command-table rows, dropping the inlined params/limits/Base/escaping/raw-API detail. lark-drive-comments-guide.md is a second-level router (intent→command table + cross-command knowledge: target resolution, comment-card model, root reply, counting/sorting). Each shortcut gets its own ref (lark-drive-{batch-query-comments,resolve-comment,restore-comment,add-reply,list-replies,update-reply,delete-reply,react-reply}.md), and --content schema/escaping/10k-cap/raw-body conversion is centralized in the new lark-drive-comment-content.md. lark-drive-reactions.md and lark-drive-comment-location.md remain cross-cutting refs. Reply preconditions are written as executable steps (check is_whole/is_solved via +batch-query-comments, or +list-comments --solved-status all), and stale raw-API routing in the list-comments/location/reactions guides is reframed as fallback-only. Caveats above are retained (whole/solved comments reject replies; rapid resolve/restore flips can hit HTTP 429).

Test Plan

  • Unit tests pass — make unit-test (-race) green; new-file statement coverage 94%+ (remaining lines are the CLI-unreachable defensive branches in DryRun/Execute closures); contract tests assert payload values directly (returned reply IDs and nested content on +list-replies, converted text_run.text / person.user_id in +add-reply / +update-reply request bodies)
  • Manual local verification confirms the lark-cli drive +<command> flows work as expected — full live round trips on a real wiki→docx document with both --as user and --as bot: list → batch-query → add-reply → list-replies (incl. --page-size 1 two-page paging ) → update-reply → react add/delete → resolve/restore → delete-reply, document restored to its original state afterwards; cross-identity update rejection probed in both directions, and the unvalidated-reaction_type / count=0 tombstone behaviors probed live
  • Dry-run e2e contract tests (tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go) pin method/URL/params/body shapes for all eight commands incl. base/apps targets, the wiki 2-step plans, the resolve/restore split, and the need_relation body gating (present for docx, omitted for base); tests/cli_e2e/drive/coverage.md updated (40 leaf commands, 21 covered, 52.5%)
  • Self-contained live E2E workflow (tests/cli_e2e/drive/drive_comment_ops_workflow_test.go, opt-in via LARK_DRIVE_MD_COMMENT_E2E=1, same gate as the existing file-comment workflow): creates a Markdown file + file comment fixture, batch-queries it by ID, attaches a reply, lists it back, rewrites it via +update-reply (polling +list-replies until the new text lands), attaches and removes a THUMBSUP reaction (polling +list-replies --need-reaction with count>0 presence checks), resolves/restores with polling reads between state flips, deletes the reply, and cleans up — passed live in 19.8s
  • go vet ./..., gofmt -l . clean, go mod tidy no-op, golangci-lint run --new-from-rev=origin/main 0 issues

Related Issues

  • None

Summary by CodeRabbit

Summary

  • New Features
    • Added Drive comment/reply shortcuts: +batch-query-comments, +resolve-comment, +restore-comment, +add-reply, +list-replies, +update-reply, +delete-reply, +react-reply, including Wiki vs direct flows and --dry-run request planning.
  • Bug Fixes
    • Normalized missing/null items to [] and count to 0 for comment/reply listing outputs.
  • Documentation
    • Updated Drive/Lark skill routing and added reference pages for comment content, location, and each new shortcut.
  • Tests
    • Expanded unit and CLI E2E coverage, including opt-in live comment/reply workflows.

@zzzchao123
zzzchao123 requested a review from liangshuo-1 as a code owner July 15, 2026 07:04
@CLAassistant

CLAassistant commented Jul 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added domain/base PR touches the base domain domain/ccm PR touches the ccm domain size/L Large or sensitive change across domains or core paths labels Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds Drive comment and reply shortcuts for querying, solved-state management, reply lifecycle operations, and reactions. Shared handling supports URL/token/type resolution, Wiki unwrapping, validation, dry-run planning, output normalization, tests, registry integration, and documentation.

Changes

Drive comment workflows

Layer / File(s) Summary
Comment target resolution and validation
shortcuts/drive/drive_comment_common.go, shortcuts/drive/drive_comment_common_test.go
Shared parsing validates targets, normalizes types, resolves Wiki nodes, validates identifiers, normalizes missing items, and builds common output fields.
Comment querying and reply listing
shortcuts/drive/drive_batch_query_comments.go, shortcuts/drive/drive_list_replies.go, shortcuts/drive/drive_list_comments.go, shortcuts/drive/*_test.go
Adds batch querying, pagination, reaction and relation flags, Wiki plans, and normalized empty-item outputs.
Reply lifecycle and solved state
shortcuts/drive/drive_add_reply.go, shortcuts/drive/drive_update_reply.go, shortcuts/drive/drive_delete_reply.go, shortcuts/drive/drive_resolve_comment.go, shortcuts/drive/drive_add_comment.go, shortcuts/drive/*_test.go
Adds structured reply creation and updates, encoded reply deletion, resolve/restore PATCH operations, content limits, and direct/Wiki dry-run flows.
Reply reactions and integration
shortcuts/drive/drive_react_reply.go, shortcuts/drive/shortcuts.go, shortcuts/drive/shortcuts_test.go
Adds reaction validation and registers the new comment-operation shortcuts.
Documentation and end-to-end coverage
skills/lark-drive/*, tests/cli_e2e/drive/*
Documents comment and reply command contracts and adds dry-run and opt-in live lifecycle coverage.

Estimated code review effort: 5 (Critical) | ~90 minutes

Possibly related PRs

Suggested labels: feature

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.37% 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
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.
Title check ✅ Passed The title clearly summarizes the main change set: adding Drive comment, reply, and reaction shortcuts.
Description check ✅ Passed The description follows the required template and includes a solid summary, detailed changes, test plan, and related issues.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/drive-comment-shortcuts

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.

@zzzchao123
zzzchao123 requested a review from wittam-01 July 15, 2026 07:05
@zzzchao123
zzzchao123 force-pushed the feat/drive-comment-shortcuts branch from 81c45ba to e1e08b2 Compare July 15, 2026 07:12

@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

🤖 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 `@tests/cli_e2e/drive/coverage.md`:
- Around line 32-35: Add a self-contained live E2E workflow test file covering
the shortcut flows in TestDrive_CommentOpsDryRun: +batch-query-comments,
+resolve-comment, +add-reply, and +delete-reply. Use the live API to create
required comments and replies, exercise each operation including both resolve
and restore behavior, verify responses and state changes, then clean up all
created resources even when assertions fail.

In `@tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go`:
- Around line 18-181: Add a self-contained live E2E test alongside
TestDrive_CommentOpsDryRun covering +batch-query-comments, +resolve-comment,
+add-reply, and +delete-reply. Create the required document/comment fixture,
exercise each shortcut against the live service with assertions on the
round-trip results, and ensure cleanup runs reliably via test cleanup even when
assertions fail.
🪄 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: c98e4543-2937-4a11-9d83-f1381cd3423b

📥 Commits

Reviewing files that changed from the base of the PR and between 49b4ccc and 81c45ba.

📒 Files selected for processing (23)
  • internal/qualitygate/diff/diff.go
  • internal/qualitygate/diff/diff_test.go
  • shortcuts/base/base_resolve.go
  • shortcuts/drive/drive_add_reply.go
  • shortcuts/drive/drive_add_reply_test.go
  • shortcuts/drive/drive_batch_query_comments.go
  • shortcuts/drive/drive_batch_query_comments_test.go
  • shortcuts/drive/drive_comment_common.go
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_delete_reply.go
  • shortcuts/drive/drive_delete_reply_test.go
  • shortcuts/drive/drive_export.go
  • shortcuts/drive/drive_import.go
  • shortcuts/drive/drive_inspect.go
  • shortcuts/drive/drive_list_comments.go
  • shortcuts/drive/drive_resolve_comment.go
  • shortcuts/drive/drive_resolve_comment_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-comments-guide.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go

Comment thread tests/cli_e2e/drive/coverage.md Outdated
Comment thread tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
Comment thread internal/qualitygate/diff/diff.go Outdated
Comment thread shortcuts/base/base_resolve.go
Comment thread shortcuts/drive/shortcuts_test.go
@zzzchao123
zzzchao123 force-pushed the feat/drive-comment-shortcuts branch from e1e08b2 to 3ea7e26 Compare July 15, 2026 07:39
@github-actions github-actions Bot removed the domain/base PR touches the base domain label Jul 15, 2026
@zzzchao123
zzzchao123 force-pushed the feat/drive-comment-shortcuts branch from 3ea7e26 to 11e1595 Compare July 15, 2026 07:47
Comment thread shortcuts/drive/drive_batch_query_comments.go Outdated
Comment thread shortcuts/drive/drive_add_reply.go Outdated
@wittam-01

Copy link
Copy Markdown
Contributor

Current PR head is still mergeable=CONFLICTING against latest main. Please rebase/merge main and resolve the doc/coverage conflicts while preserving the existing +list-comments apps support from main.

For the apps regression check, I used the provided page URL:

./lark-cli drive +list-comments --url "https://bytedance.feishu.cn/page/N1BWmMrqndT5ZcamAIBcnvDLnOf/" --solved-status all --page-size 100 --as bot --format json

This succeeds as bot and returns file_type=apps, count=15, has_more=false, so it is a good fixture to keep the apps path covered after the rebase.

@zzzchao123
zzzchao123 force-pushed the feat/drive-comment-shortcuts branch from 11e1595 to 41a7462 Compare July 15, 2026 08:02

@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

🤖 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-drive/SKILL.md`:
- Around line 104-105: 更新 SKILL.md 中关于评论文本转义的说明,明确使用 drive +add-comment 或 drive
+add-reply shortcut 时传入原始文本,由 shortcut 自动转义;直接调用 drive file.comments create_v2 或
drive file.comment.replys update 时,调用方必须先将文本中的 < 和 > 转义后再提交,避免 shortcut 调用方重复转义。
🪄 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: 7ec789d4-d494-456d-87e5-e38253e05dac

📥 Commits

Reviewing files that changed from the base of the PR and between 3ea7e26 and 41a7462.

📒 Files selected for processing (16)
  • shortcuts/drive/drive_add_reply.go
  • shortcuts/drive/drive_add_reply_test.go
  • shortcuts/drive/drive_batch_query_comments.go
  • shortcuts/drive/drive_batch_query_comments_test.go
  • shortcuts/drive/drive_comment_common.go
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_delete_reply.go
  • shortcuts/drive/drive_delete_reply_test.go
  • shortcuts/drive/drive_resolve_comment.go
  • shortcuts/drive/drive_resolve_comment_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-comments-guide.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
🚧 Files skipped from review as they are similar to previous changes (15)
  • shortcuts/drive/drive_delete_reply_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/drive_batch_query_comments.go
  • shortcuts/drive/drive_delete_reply.go
  • shortcuts/drive/drive_batch_query_comments_test.go
  • shortcuts/drive/drive_resolve_comment_test.go
  • shortcuts/drive/shortcuts_test.go
  • shortcuts/drive/drive_comment_common.go
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
  • shortcuts/drive/drive_resolve_comment.go
  • tests/cli_e2e/drive/coverage.md
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_add_reply.go
  • shortcuts/drive/drive_add_reply_test.go
  • skills/lark-drive/references/lark-drive-comments-guide.md

Comment thread skills/lark-drive/SKILL.md Outdated
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00533% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.40%. Comparing base (7081960) to head (3fced0e).
⚠️ Report is 107 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/drive/drive_react_reply.go 93.40% 3 Missing and 3 partials ⚠️
shortcuts/drive/drive_add_reply.go 96.55% 2 Missing and 2 partials ⚠️
shortcuts/drive/drive_batch_query_comments.go 95.29% 2 Missing and 2 partials ⚠️
shortcuts/drive/drive_delete_reply.go 94.28% 2 Missing and 2 partials ⚠️
shortcuts/drive/drive_list_replies.go 95.12% 2 Missing and 2 partials ⚠️
shortcuts/drive/drive_resolve_comment.go 95.40% 2 Missing and 2 partials ⚠️
shortcuts/drive/drive_update_reply.go 95.06% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1898      +/-   ##
==========================================
+ Coverage   74.96%   75.40%   +0.44%     
==========================================
  Files         892      924      +32     
  Lines       94058    97923    +3865     
==========================================
+ Hits        70506    73843    +3337     
- Misses      18139    18452     +313     
- Partials     5413     5628     +215     

☔ 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.

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@3fced0e1d3a1bae27520ac9a73b0bbc2ee4e99c5

🧩 Skill update

npx skills add larksuite/cli#feat/drive-comment-shortcuts -y -g

@zzzchao123
zzzchao123 force-pushed the feat/drive-comment-shortcuts branch from 41a7462 to b7aea0b Compare July 15, 2026 09:37
@zzzchao123
zzzchao123 requested a review from wittam-01 July 15, 2026 09:44
@zzzchao123
zzzchao123 force-pushed the feat/drive-comment-shortcuts branch from b7aea0b to a5e2d29 Compare July 15, 2026 10:14

@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/drive/drive_batch_query_comments_test.go (1)

1-1: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

API-error propagation tests only assert on message substrings, not on typed error classification.

All four "PropagatesAPIError" tests share the same gap: they check strings.Contains(err.Error(), "...") but never verify the error remains a typed API error (e.g., via errs.ProblemOf(err)Category == errs.CategoryAPI). A regression where runtime.CallAPITyped's typed error gets rewrapped as a plain error would pass all four tests silently.

  • shortcuts/drive/drive_batch_query_comments_test.go#L353-373: after the substring check, add if p, ok := errs.ProblemOf(err); !ok || p.Category != errs.CategoryAPI { t.Fatalf(...) }.
  • shortcuts/drive/drive_add_reply_test.go#L261-282: add the same errs.ProblemOf Category assertion after the substring check.
  • shortcuts/drive/drive_resolve_comment_test.go#L266-287: add the same errs.ProblemOf Category assertion after the substring check.
  • shortcuts/drive/drive_delete_reply_test.go#L176-198: add the same errs.ProblemOf Category assertion after the substring check.

Based on learnings, in larksuite/cli Go test suites for shortcuts domain packages, when exercising error paths, tests should "assert Category == errs.CategoryAPI and verify Subtype is non-empty/populated" rather than relying only on message text. This is also consistent with the path instruction that "**/*_test.go... contract tests must assert the new field or behavior directly rather than relying only on happy-path substrings."

🤖 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/drive/drive_batch_query_comments_test.go` at line 1, Update all
four PropagatesAPIError tests in the drive shortcuts test suite to classify the
returned error with errs.ProblemOf(err) after the existing message assertion.
Fail unless extraction succeeds, Category equals errs.CategoryAPI, and Subtype
is non-empty, preserving the current message checks while directly validating
typed API-error propagation.

Sources: Path instructions, 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 `@shortcuts/drive/drive_add_reply_test.go`:
- Around line 308-320: Update TestDriveAddReplyInvalidContent to call
assertDriveCommentValidationError(t, err, "--content") in addition to verifying
the invalid-JSON message, ensuring the returned error is typed and attributed to
the --content flag.

---

Nitpick comments:
In `@shortcuts/drive/drive_batch_query_comments_test.go`:
- Line 1: Update all four PropagatesAPIError tests in the drive shortcuts test
suite to classify the returned error with errs.ProblemOf(err) after the existing
message assertion. Fail unless extraction succeeds, Category equals
errs.CategoryAPI, and Subtype is non-empty, preserving the current message
checks while directly validating typed API-error propagation.
🪄 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: e8d2da51-2003-4953-8cf2-384b1db7f06a

📥 Commits

Reviewing files that changed from the base of the PR and between b7aea0b and a5e2d29.

📒 Files selected for processing (17)
  • shortcuts/drive/drive_add_reply.go
  • shortcuts/drive/drive_add_reply_test.go
  • shortcuts/drive/drive_batch_query_comments.go
  • shortcuts/drive/drive_batch_query_comments_test.go
  • shortcuts/drive/drive_comment_common.go
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_delete_reply.go
  • shortcuts/drive/drive_delete_reply_test.go
  • shortcuts/drive/drive_resolve_comment.go
  • shortcuts/drive/drive_resolve_comment_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-comments-guide.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
  • tests/cli_e2e/drive/drive_comment_ops_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (12)
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/drive_delete_reply.go
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
  • shortcuts/drive/drive_batch_query_comments.go
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_resolve_comment.go
  • tests/cli_e2e/drive/drive_comment_ops_workflow_test.go
  • shortcuts/drive/drive_comment_common.go
  • shortcuts/drive/drive_add_reply.go
  • shortcuts/drive/shortcuts_test.go
  • tests/cli_e2e/drive/coverage.md
  • skills/lark-drive/references/lark-drive-comments-guide.md

Comment thread shortcuts/drive/drive_add_reply_test.go
@github-actions github-actions Bot added size/XL Architecture-level or global-impact change and removed size/L Large or sensitive change across domains or core paths labels Jul 17, 2026
@zzzchao123 zzzchao123 changed the title feat(drive): add comment batch-query/resolve/reply shortcuts feat(drive): add comment batch-query/resolve and reply CRUD shortcuts Jul 17, 2026
@zzzchao123 zzzchao123 self-assigned this Jul 17, 2026
Comment thread skills/lark-drive/references/lark-drive-add-reply.md Outdated
Comment thread skills/lark-drive/references/lark-drive-add-reply.md Outdated
Comment thread skills/lark-drive/references/lark-drive-add-reply.md Outdated
Comment thread skills/lark-drive/references/lark-drive-add-reply.md Outdated
Comment thread skills/lark-drive/references/lark-drive-add-reply.md Outdated
Comment thread skills/lark-drive/references/lark-drive-add-reply.md Outdated
Comment thread skills/lark-drive/references/lark-drive-add-reply.md Outdated

@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

🤖 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/drive/drive_batch_query_comments.go`:
- Around line 43-45: After resolving the target in the drive batch query flow,
reject --need-relation whenever the resolved file type is not docx, including
Wiki targets resolving to non-docx, by returning a typed validation error with
Param("--need-relation") instead of silently omitting need_relation. Update the
existing non-docx handling message accordingly, and revise
tests/cli_e2e/drive/coverage.md at line 34 to document rejection; add direct and
Wiki rejection coverage as requested.

In `@tests/cli_e2e/drive/coverage.md`:
- Line 16: Correct the manual-verification count in TestDrive_CommentOpsDryRun
to eight, matching the eight listed drive shortcuts including +restore-comment;
leave the rest of the coverage description unchanged.
🪄 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: 87f15e63-83d2-4f31-be59-aa6b42ae3902

📥 Commits

Reviewing files that changed from the base of the PR and between 09112f6 and 0555bec.

📒 Files selected for processing (30)
  • shortcuts/drive/drive_batch_query_comments.go
  • shortcuts/drive/drive_batch_query_comments_test.go
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_list_replies.go
  • shortcuts/drive/drive_list_replies_test.go
  • shortcuts/drive/drive_react_reply.go
  • shortcuts/drive/drive_react_reply_test.go
  • shortcuts/drive/drive_resolve_comment.go
  • shortcuts/drive/drive_resolve_comment_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-add-comment.md
  • skills/lark-drive/references/lark-drive-add-reply.md
  • skills/lark-drive/references/lark-drive-batch-query-comments.md
  • skills/lark-drive/references/lark-drive-comment-content.md
  • skills/lark-drive/references/lark-drive-comment-location.md
  • skills/lark-drive/references/lark-drive-comments-guide.md
  • skills/lark-drive/references/lark-drive-delete-reply.md
  • skills/lark-drive/references/lark-drive-list-comments.md
  • skills/lark-drive/references/lark-drive-list-replies.md
  • skills/lark-drive/references/lark-drive-react-reply.md
  • skills/lark-drive/references/lark-drive-reactions.md
  • skills/lark-drive/references/lark-drive-resolve-comment.md
  • skills/lark-drive/references/lark-drive-restore-comment.md
  • skills/lark-drive/references/lark-drive-update-reply.md
  • skills/lark-slides/references/lark-slides-media-upload.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
  • tests/cli_e2e/drive/drive_comment_ops_workflow_test.go
💤 Files with no reviewable changes (1)
  • shortcuts/drive/drive_list_replies.go
🚧 Files skipped from review as they are similar to previous changes (9)
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • shortcuts/drive/drive_react_reply.go
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
  • shortcuts/drive/drive_react_reply_test.go
  • skills/lark-drive/references/lark-drive-reactions.md
  • tests/cli_e2e/drive/drive_comment_ops_workflow_test.go
  • shortcuts/drive/drive_list_replies_test.go
  • shortcuts/drive/drive_batch_query_comments_test.go

Comment thread shortcuts/drive/drive_batch_query_comments.go
Comment thread tests/cli_e2e/drive/coverage.md Outdated
@zzzchao123
zzzchao123 force-pushed the feat/drive-comment-shortcuts branch from 0555bec to d0ae983 Compare July 28, 2026 08:55
Comment thread shortcuts/drive/drive_delete_reply.go Outdated
Comment thread shortcuts/drive/drive_add_reply.go
Comment thread shortcuts/drive/drive_batch_query_comments.go
Comment thread tests/cli_e2e/drive/coverage.md Outdated
@zzzchao123
zzzchao123 force-pushed the feat/drive-comment-shortcuts branch from d0ae983 to c50d03e Compare July 28, 2026 11:33

@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

🤖 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/drive/drive_resolve_comment_test.go`:
- Around line 253-272: Update TestDriveResolveCommentPropagatesAPIError and the
related test to inspect errs.ProblemOf(err), asserting CategoryAPI and a
non-empty subtype while retaining the existing message or cause checks. Use the
typed API-error metadata assertions for both error-path cases instead of relying
only on strings.Contains.
🪄 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: 142ad389-1dc1-4035-86a8-07e0cbe10adf

📥 Commits

Reviewing files that changed from the base of the PR and between d0ae983 and c50d03e.

📒 Files selected for processing (40)
  • shortcuts/drive/drive_add_comment.go
  • shortcuts/drive/drive_add_reply.go
  • shortcuts/drive/drive_add_reply_test.go
  • shortcuts/drive/drive_batch_query_comments.go
  • shortcuts/drive/drive_batch_query_comments_test.go
  • shortcuts/drive/drive_comment_common.go
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_delete_reply.go
  • shortcuts/drive/drive_delete_reply_test.go
  • shortcuts/drive/drive_list_comments.go
  • shortcuts/drive/drive_list_comments_test.go
  • shortcuts/drive/drive_list_replies.go
  • shortcuts/drive/drive_list_replies_test.go
  • shortcuts/drive/drive_react_reply.go
  • shortcuts/drive/drive_react_reply_test.go
  • shortcuts/drive/drive_resolve_comment.go
  • shortcuts/drive/drive_resolve_comment_test.go
  • shortcuts/drive/drive_update_reply.go
  • shortcuts/drive/drive_update_reply_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-add-comment.md
  • skills/lark-drive/references/lark-drive-add-reply.md
  • skills/lark-drive/references/lark-drive-batch-query-comments.md
  • skills/lark-drive/references/lark-drive-comment-content.md
  • skills/lark-drive/references/lark-drive-comment-location.md
  • skills/lark-drive/references/lark-drive-comments-guide.md
  • skills/lark-drive/references/lark-drive-delete-reply.md
  • skills/lark-drive/references/lark-drive-list-comments.md
  • skills/lark-drive/references/lark-drive-list-replies.md
  • skills/lark-drive/references/lark-drive-react-reply.md
  • skills/lark-drive/references/lark-drive-reactions.md
  • skills/lark-drive/references/lark-drive-resolve-comment.md
  • skills/lark-drive/references/lark-drive-restore-comment.md
  • skills/lark-drive/references/lark-drive-update-reply.md
  • skills/lark-slides/references/lark-slides-media-upload.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
  • tests/cli_e2e/drive/drive_comment_ops_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (27)
  • shortcuts/drive/shortcuts.go
  • skills/lark-drive/references/lark-drive-list-comments.md
  • skills/lark-drive/references/lark-drive-restore-comment.md
  • skills/lark-drive/references/lark-drive-react-reply.md
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/references/lark-drive-comment-content.md
  • shortcuts/drive/drive_list_comments_test.go
  • skills/lark-drive/references/lark-drive-add-comment.md
  • skills/lark-drive/references/lark-drive-add-reply.md
  • skills/lark-drive/references/lark-drive-batch-query-comments.md
  • skills/lark-drive/references/lark-drive-comment-location.md
  • shortcuts/drive/drive_comment_common.go
  • skills/lark-drive/references/lark-drive-update-reply.md
  • shortcuts/drive/drive_delete_reply_test.go
  • skills/lark-drive/references/lark-drive-delete-reply.md
  • shortcuts/drive/drive_update_reply_test.go
  • skills/lark-drive/references/lark-drive-resolve-comment.md
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
  • skills/lark-drive/references/lark-drive-list-replies.md
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_react_reply_test.go
  • shortcuts/drive/drive_add_reply_test.go
  • tests/cli_e2e/drive/drive_comment_ops_workflow_test.go
  • shortcuts/drive/drive_list_replies_test.go
  • skills/lark-drive/references/lark-drive-reactions.md
  • shortcuts/drive/drive_batch_query_comments_test.go
  • tests/cli_e2e/drive/coverage.md

Comment thread shortcuts/drive/drive_resolve_comment_test.go
Comment thread shortcuts/drive/drive_add_comment.go Outdated
Comment thread shortcuts/drive/drive_batch_query_comments.go
@zzzchao123
zzzchao123 force-pushed the feat/drive-comment-shortcuts branch from c50d03e to bf483ca Compare July 28, 2026 12:28

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

🤖 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/drive/drive_update_reply_test.go`:
- Around line 260-262: Update both error-path tests at
shortcuts/drive/drive_update_reply_test.go:260-262 and 287-289 to inspect
errs.ProblemOf(err) instead of relying only on message text. For the API
response case, assert CategoryAPI, a populated subtype, and preservation of the
underlying cause; for the incomplete-node case, assert its typed metadata and
applicable cause while retaining any necessary message validation.

In `@skills/lark-drive/references/lark-drive-resolve-comment.md`:
- Line 12: Update the supported URL-type list in lark-drive-resolve-comment.md
to include bitable alongside docx, doc, sheet, file, slides, base, and apps,
matching the parameter contract referenced later in the document.

In `@skills/lark-drive/SKILL.md`:
- Line 31: Update the document-comment routing instruction so comment statistics
requests use the +list-comments shortcut and requests to locate comment text use
lark-drive-comment-location.md; keep other comment operations routed through the
guide’s intent table and specific command refs.
🪄 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: c9798ac1-25c7-4fa9-add4-0665df0fc757

📥 Commits

Reviewing files that changed from the base of the PR and between c50d03e and bf483ca.

📒 Files selected for processing (41)
  • shortcuts/drive/drive_add_comment.go
  • shortcuts/drive/drive_add_comment_test.go
  • shortcuts/drive/drive_add_reply.go
  • shortcuts/drive/drive_add_reply_test.go
  • shortcuts/drive/drive_batch_query_comments.go
  • shortcuts/drive/drive_batch_query_comments_test.go
  • shortcuts/drive/drive_comment_common.go
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_delete_reply.go
  • shortcuts/drive/drive_delete_reply_test.go
  • shortcuts/drive/drive_list_comments.go
  • shortcuts/drive/drive_list_comments_test.go
  • shortcuts/drive/drive_list_replies.go
  • shortcuts/drive/drive_list_replies_test.go
  • shortcuts/drive/drive_react_reply.go
  • shortcuts/drive/drive_react_reply_test.go
  • shortcuts/drive/drive_resolve_comment.go
  • shortcuts/drive/drive_resolve_comment_test.go
  • shortcuts/drive/drive_update_reply.go
  • shortcuts/drive/drive_update_reply_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-add-comment.md
  • skills/lark-drive/references/lark-drive-add-reply.md
  • skills/lark-drive/references/lark-drive-batch-query-comments.md
  • skills/lark-drive/references/lark-drive-comment-content.md
  • skills/lark-drive/references/lark-drive-comment-location.md
  • skills/lark-drive/references/lark-drive-comments-guide.md
  • skills/lark-drive/references/lark-drive-delete-reply.md
  • skills/lark-drive/references/lark-drive-list-comments.md
  • skills/lark-drive/references/lark-drive-list-replies.md
  • skills/lark-drive/references/lark-drive-react-reply.md
  • skills/lark-drive/references/lark-drive-reactions.md
  • skills/lark-drive/references/lark-drive-resolve-comment.md
  • skills/lark-drive/references/lark-drive-restore-comment.md
  • skills/lark-drive/references/lark-drive-update-reply.md
  • skills/lark-slides/references/lark-slides-media-upload.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
  • tests/cli_e2e/drive/drive_comment_ops_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (35)
  • shortcuts/drive/shortcuts.go
  • skills/lark-drive/references/lark-drive-restore-comment.md
  • shortcuts/drive/drive_list_comments.go
  • skills/lark-slides/references/lark-slides-media-upload.md
  • shortcuts/drive/drive_update_reply.go
  • shortcuts/drive/drive_react_reply.go
  • skills/lark-drive/references/lark-drive-comment-location.md
  • shortcuts/drive/drive_list_comments_test.go
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_add_comment.go
  • shortcuts/drive/drive_delete_reply.go
  • skills/lark-drive/references/lark-drive-delete-reply.md
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/references/lark-drive-add-comment.md
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
  • shortcuts/drive/drive_resolve_comment.go
  • skills/lark-drive/references/lark-drive-update-reply.md
  • skills/lark-drive/references/lark-drive-react-reply.md
  • skills/lark-drive/references/lark-drive-batch-query-comments.md
  • shortcuts/drive/drive_batch_query_comments.go
  • tests/cli_e2e/drive/drive_comment_ops_workflow_test.go
  • skills/lark-drive/references/lark-drive-add-reply.md
  • shortcuts/drive/drive_comment_common.go
  • shortcuts/drive/drive_resolve_comment_test.go
  • skills/lark-drive/references/lark-drive-comment-content.md
  • skills/lark-drive/references/lark-drive-list-replies.md
  • shortcuts/drive/drive_list_replies.go
  • shortcuts/drive/drive_react_reply_test.go
  • shortcuts/drive/drive_list_replies_test.go
  • shortcuts/drive/drive_delete_reply_test.go
  • shortcuts/drive/drive_add_reply_test.go
  • skills/lark-drive/references/lark-drive-reactions.md
  • shortcuts/drive/drive_add_reply.go
  • tests/cli_e2e/drive/coverage.md
  • shortcuts/drive/drive_batch_query_comments_test.go

Comment thread shortcuts/drive/drive_update_reply_test.go
Comment thread skills/lark-drive/references/lark-drive-resolve-comment.md Outdated
Comment thread skills/lark-drive/SKILL.md Outdated
fangshuyu-768
fangshuyu-768 previously approved these changes Jul 28, 2026
Add comment-domain shortcuts: +batch-query-comments, +resolve-comment,
+restore-comment, +add-reply, +list-replies, +update-reply, +delete-reply
and +react-reply, sharing one target resolver with per-endpoint file_type
sets.

Flatten the comment reference docs by dropping the comments-guide routing
layer and folding its cross-command knowledge into the command refs:
comment-card model, comment/reply/interaction counting and sorting rules
into lark-drive-list-comments.md; the --solved-status prerequisite into
lark-drive-restore-comment.md; the apps exception into
lark-drive-add-comment.md. Comment intents now route straight from the
drive SKILL.md Shortcuts table to each command ref.

Cover the new shortcuts with unit tests, dry-run e2e and live workflow
e2e behind LARK_DRIVE_MD_COMMENT_E2E=1, and register them in
tests/cli_e2e/drive/coverage.md.

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

🧹 Nitpick comments (3)
shortcuts/drive/drive_comment_common.go (1)

83-160: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting the duplicated type-conflict/unsupported-type error blocks.

Lines 103-120 and 126-143 build identical errors for the ParseResourceURL and apps-page-URL branches. A small helper taking (refType, sourceFlag) would keep the two branches in sync as types evolve.

🤖 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/drive/drive_comment_common.go` around lines 83 - 160, The
duplicated type-conflict and unsupported-type validation in
resolveDriveCommentInput should be extracted into a small helper accepting
refType and sourceFlag, using op to validate against the explicit type and
supported types. Call the helper from both the common ParseResourceURL and
parseDriveListCommentsAppsURL branches, preserving their existing error behavior
before returning the parsed reference.
shortcuts/drive/drive_delete_reply_test.go (1)

227-279: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider covering the destructive-confirmation gate.

+delete-reply is high-risk-write and every execute test passes --yes; nothing asserts the command refuses to delete without it. A single test omitting --yes (non-interactive) would lock that behavior in.

🤖 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/drive/drive_delete_reply_test.go` around lines 227 - 279, Add a
non-interactive test for the DriveDeleteReply command that omits --yes while
retaining the required delete-reply arguments, and assert it returns an error
without issuing a delete API call. Place it alongside
TestDriveDeleteReplyDryRunDirect and TestDriveDeleteReplyDryRunWiki to cover the
high-risk confirmation gate.
skills/lark-drive/references/lark-drive-batch-query-comments.md (1)

27-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Avoid documenting undocumented-metadata/compatibility internals.

"该参数未收录于平台 metadata,但服务端支持" exposes an internal compatibility nuance rather than caller-facing guidance.

Based on learnings, when writing lark-drive skill docs, avoid exposing internal implementation/compatibility details and keep guidance for callers concise.

🤖 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 `@skills/lark-drive/references/lark-drive-batch-query-comments.md` at line 27,
Revise the guidance around --need-relation in lark-drive-batch-query.md to
remove the platform-metadata and server-compatibility detail. Keep only concise
caller-facing behavior: that it is sent in the request body, applies when the
parsed target is docx, and returns relation and block-location data.

Source: 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 `@shortcuts/drive/drive_add_reply_test.go`:
- Around line 265-286: Update TestDriveAddReplyPropagatesAPIError in
shortcuts/drive/drive_add_reply_test.go:265-286 to inspect errs.ProblemOf(err),
asserting category errs.CategoryAPI and a non-empty subtype in addition to the
message. Update TestDriveDeleteReplyPropagatesAPIError and
TestDriveDeleteReplyWikiNodeIncompleteResponse in
shortcuts/drive/drive_delete_reply_test.go:176-225 to assert category, non-empty
subtype, and param through errs.ProblemOf(err), with the incomplete-response
test also verifying the original cause is preserved.

In `@shortcuts/drive/drive_batch_query_comments_test.go`:
- Around line 370-372: Strengthen both API-error tests by calling
assertDriveCommentAPIError after the existing message check: update
shortcuts/drive/drive_batch_query_comments_test.go lines 370-372 with status
1069307 and shortcuts/drive/drive_list_replies_test.go lines 300-302 with status
1069301. Preserve the message assertions while using the helper to validate
typed metadata and cause preservation.

In `@shortcuts/drive/drive_batch_query_comments.go`:
- Line 58: Update the ConditionalScopes declaration in DriveBatchQueryComments
at shortcuts/drive/drive_batch_query_comments.go:58-58 from wiki:node:read to
wiki:node:retrieve, and make the same change in DriveListReplies at
shortcuts/drive/drive_list_replies.go:38-38, matching the +list-comments scope
for the get_node endpoint.

In `@shortcuts/drive/drive_react_reply_test.go`:
- Around line 237-240: Strengthen the error-path assertions in
shortcuts/drive/drive_react_reply_test.go at lines 237-240 and 257-259 by using
errs.ProblemOf plus the established validation-error helper or errors.As to
verify invalid emoji errors are validation errors for --emoji and invalid action
errors are validation errors for --action. At lines 309-311, assert the
incomplete Wiki-node failure’s typed category, subtype, and relevant parameter
instead of checking only its message.

In `@skills/lark-drive/references/lark-drive-batch-query-comments.md`:
- Around line 22-23: Update the validation handling for the --need-relation
option in the batch comment query flow so non-docx targets return a typed
validation error instead of silently omitting need_relation from RequestBody.
Preserve the existing behavior for docx targets, and ensure the error identifies
the invalid option/target combination.

In `@tests/cli_e2e/drive/drive_comment_ops_workflow_test.go`:
- Around line 1-203: Update TestDriveListCommentsDryRun_AppsPageURL in
drive_list_comments_dryrun_test.go to execute the +list-comments request with
DefaultAs set to "bot". Preserve the existing file_type=apps and /page/<token>
URL assertions, ensuring the regression explicitly covers the Bot persona
described in coverage.md.

---

Nitpick comments:
In `@shortcuts/drive/drive_comment_common.go`:
- Around line 83-160: The duplicated type-conflict and unsupported-type
validation in resolveDriveCommentInput should be extracted into a small helper
accepting refType and sourceFlag, using op to validate against the explicit type
and supported types. Call the helper from both the common ParseResourceURL and
parseDriveListCommentsAppsURL branches, preserving their existing error behavior
before returning the parsed reference.

In `@shortcuts/drive/drive_delete_reply_test.go`:
- Around line 227-279: Add a non-interactive test for the DriveDeleteReply
command that omits --yes while retaining the required delete-reply arguments,
and assert it returns an error without issuing a delete API call. Place it
alongside TestDriveDeleteReplyDryRunDirect and TestDriveDeleteReplyDryRunWiki to
cover the high-risk confirmation gate.

In `@skills/lark-drive/references/lark-drive-batch-query-comments.md`:
- Line 27: Revise the guidance around --need-relation in
lark-drive-batch-query.md to remove the platform-metadata and
server-compatibility detail. Keep only concise caller-facing behavior: that it
is sent in the request body, applies when the parsed target is docx, and returns
relation and block-location data.
🪄 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: fed6d444-322a-4340-9b31-0aa99c2ce9d5

📥 Commits

Reviewing files that changed from the base of the PR and between bf483ca and 3fced0e.

📒 Files selected for processing (41)
  • shortcuts/drive/drive_add_comment.go
  • shortcuts/drive/drive_add_comment_test.go
  • shortcuts/drive/drive_add_reply.go
  • shortcuts/drive/drive_add_reply_test.go
  • shortcuts/drive/drive_batch_query_comments.go
  • shortcuts/drive/drive_batch_query_comments_test.go
  • shortcuts/drive/drive_comment_common.go
  • shortcuts/drive/drive_comment_common_test.go
  • shortcuts/drive/drive_delete_reply.go
  • shortcuts/drive/drive_delete_reply_test.go
  • shortcuts/drive/drive_list_comments.go
  • shortcuts/drive/drive_list_comments_test.go
  • shortcuts/drive/drive_list_replies.go
  • shortcuts/drive/drive_list_replies_test.go
  • shortcuts/drive/drive_react_reply.go
  • shortcuts/drive/drive_react_reply_test.go
  • shortcuts/drive/drive_resolve_comment.go
  • shortcuts/drive/drive_resolve_comment_test.go
  • shortcuts/drive/drive_update_reply.go
  • shortcuts/drive/drive_update_reply_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-add-comment.md
  • skills/lark-drive/references/lark-drive-add-reply.md
  • skills/lark-drive/references/lark-drive-batch-query-comments.md
  • skills/lark-drive/references/lark-drive-comment-content.md
  • skills/lark-drive/references/lark-drive-comment-location.md
  • skills/lark-drive/references/lark-drive-comments-guide.md
  • skills/lark-drive/references/lark-drive-delete-reply.md
  • skills/lark-drive/references/lark-drive-list-comments.md
  • skills/lark-drive/references/lark-drive-list-replies.md
  • skills/lark-drive/references/lark-drive-react-reply.md
  • skills/lark-drive/references/lark-drive-reactions.md
  • skills/lark-drive/references/lark-drive-resolve-comment.md
  • skills/lark-drive/references/lark-drive-restore-comment.md
  • skills/lark-drive/references/lark-drive-update-reply.md
  • skills/lark-slides/references/lark-slides-media-upload.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_comment_ops_dryrun_test.go
  • tests/cli_e2e/drive/drive_comment_ops_workflow_test.go
💤 Files with no reviewable changes (1)
  • skills/lark-drive/references/lark-drive-comments-guide.md
🚧 Files skipped from review as they are similar to previous changes (11)
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-slides/references/lark-slides-media-upload.md
  • shortcuts/drive/drive_add_comment.go
  • skills/lark-drive/references/lark-drive-restore-comment.md
  • skills/lark-drive/references/lark-drive-comment-content.md
  • skills/lark-drive/references/lark-drive-add-comment.md
  • skills/lark-drive/references/lark-drive-comment-location.md
  • tests/cli_e2e/drive/coverage.md
  • skills/lark-drive/references/lark-drive-list-comments.md
  • skills/lark-drive/references/lark-drive-update-reply.md
  • skills/lark-drive/references/lark-drive-reactions.md

Comment thread shortcuts/drive/drive_add_reply_test.go
Comment thread shortcuts/drive/drive_batch_query_comments_test.go
Comment thread shortcuts/drive/drive_batch_query_comments.go
Comment thread shortcuts/drive/drive_react_reply_test.go
Comment thread skills/lark-drive/references/lark-drive-batch-query-comments.md
Comment thread tests/cli_e2e/drive/drive_comment_ops_workflow_test.go
@zzzchao123
zzzchao123 merged commit ba95252 into main Jul 30, 2026
63 of 70 checks passed
@zzzchao123
zzzchao123 deleted the feat/drive-comment-shortcuts branch July 30, 2026 13:53
@liangshuo-1 liangshuo-1 mentioned this pull request Jul 31, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/ccm PR touches the ccm domain size/XL Architecture-level or global-impact change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants