Skip to content

feat(im): return typed error envelopes across the im domain#1230

Merged
evandance merged 1 commit into
mainfrom
feat/errs-migrate-im
Jun 6, 2026
Merged

feat(im): return typed error envelopes across the im domain#1230
evandance merged 1 commit into
mainfrom
feat/errs-migrate-im

Conversation

@evandance

@evandance evandance commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

shortcuts/im previously returned many final errors through legacy output.Err*, output.Errorf, or untyped error shapes. That made agent/script consumers depend on free-form stderr text instead of stable fields. This PR migrates the IM domain to the typed errs.* contract so callers can reliably consume type, subtype, param, missing_scopes, log_id, and hint.

Changes

  • Migrates IM shortcut final error paths across chat, message, flag, thread, mute, media upload, and resource download flows to typed errors.
  • Preserves typed runtime/API errors instead of rewrapping them, including API log_id and response subtype details.
  • Adds IM-local error helpers for network wrapping, context cancellation/timeout classification, and recovery hints.
  • Emits structured validation params for media URL/local-file failures (--image, --file, --audio, --video, --video-cover) and resource-download path failures (--file-key, --output).
  • Uses runtime.OutPartialFailure(...) for IM batch-style partial failures so stdout reports ok:false while preserving per-item results.
  • Adds shared typed runtime support used by the migration, including typed API JSON helpers and partial-failure envelopes.
  • Extends lint guards so shortcuts/im/ cannot regress to legacy error constructors or legacy envelope literals.

Test Plan

  • git diff --check origin/main...HEAD
  • Static grep for legacy IM final-error patterns: no matches
  • GitHub Actions: fast-gate, unit-test, lint, coverage, deadcode, e2e-dry-run passed on the previous head before the final squash/rebase
  • GitHub Actions on the rebased/squashed head

Local Go is go1.20.14, while this repo requires go 1.23.0, so local go test cannot run on this machine and CI is the authoritative test run.

Related Issues

N/A

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Replaces legacy IM shortcut errors with typed errs errors, adds IM error mapping helpers and tests, introduces RuntimeContext.DoAPIJSONTyped and replaces untyped API calls with typed variants, and expands golangci lint allowlists for shortcuts/im/.

Changes

IM Shortcuts Error Handling Migration

Layer / File(s) Summary
Lint config and typed API foundation
.golangci.yml, shortcuts/common/runner.go, shortcuts/common/call_api_typed_test.go
Adds shortcuts/im/ to forbidigo allowlists, introduces RuntimeContext.DoAPIJSONTyped, and adds tests verifying typed envelope success and non-zero-code classification.
IM shared helpers & tests
shortcuts/im/helpers.go, shortcuts/im/im_errors.go, shortcuts/im/im_errors_test.go, shortcuts/im/helpers_network_test.go
Adds typed IM error helpers (wrapIMNetworkErr, imSaveError, imInputStatError, appendIMRecoveryHint), migrates helpers to use errs constructors, and adds/updates unit tests to assert typed error shapes and params.
Chat and flag shortcuts
shortcuts/im/im_chat_*.go, shortcuts/im/im_flag_*.go
Migrate Validate/Execute paths to use errs.NewValidationError(...).WithParam/WithParams, attach CLI param metadata, and switch API calls to typed helpers (DoAPIJSONTyped/CallAPITyped).
Messages, threads, download, mute flows
shortcuts/im/im_messages_*.go, shortcuts/im/im_threads_messages_list.go, shortcuts/im/im_messages_resources_download.go, shortcuts/im/mute_filter.go
Migrate validation and network/file error mapping to typed errs errors, switch API calls to typed helpers, and convert download/read/save failures to typed network/file IO errors.
Convert library & tests
shortcuts/im/convert_lib/*, shortcuts/im/convert_lib/card_test.go
Switch convert_lib API calls to typed helpers and update mention-resolution test fixtures/expected outputs.
Misc tests & integration
cmd/root_integration_test.go, various test imports/expectations
Adjust test imports and assertions to expect typed errors/envelope shapes and updated integration envelope formatting.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • YangJunzhou-01
  • liangshuo-1
  • jackie3927

🐰 I hopped through code with gentle paws,

Replaced plain strings with typed error laws,
Validation neat, network wraps tight,
IM shortcuts now handle faults just right,
Tests and lint rest easy through the night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.94% 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 accurately and concisely summarizes the main change: migrating the IM domain to return typed error envelopes instead of legacy free-form errors.
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.
Description check ✅ Passed The PR description includes all major sections (Summary, Changes, Test Plan, Related Issues) with substantive content addressing the migration from legacy error handling to typed errors.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/errs-migrate-im

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 and usage tips.

@github-actions github-actions Bot added domain/im PR touches the im domain size/L Large or sensitive change across domains or core paths labels Jun 2, 2026
@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.96491% with 97 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.00%. Comparing base (8c3cba1) to head (9136393).

Files with missing lines Patch % Lines
shortcuts/im/helpers.go 65.21% 28 Missing and 4 partials ⚠️
shortcuts/im/im_messages_resources_download.go 58.62% 12 Missing ⚠️
shortcuts/im/im_flag_create.go 65.00% 7 Missing ⚠️
shortcuts/im/im_chat_create.go 45.45% 6 Missing ⚠️
shortcuts/im/im_chat_messages_list.go 50.00% 4 Missing and 1 partial ⚠️
shortcuts/im/im_chat_search.go 28.57% 5 Missing ⚠️
shortcuts/im/im_flag_cancel.go 61.53% 5 Missing ⚠️
shortcuts/im/im_messages_reply.go 0.00% 5 Missing ⚠️
shortcuts/im/im_errors.go 85.71% 2 Missing and 2 partials ⚠️
shortcuts/im/im_messages_search.go 72.72% 3 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1230      +/-   ##
==========================================
+ Coverage   70.97%   71.00%   +0.02%     
==========================================
  Files         680      681       +1     
  Lines       65318    65367      +49     
==========================================
+ Hits        46362    46412      +50     
+ Misses      15316    15314       -2     
- Partials     3640     3641       +1     

☔ 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 Jun 2, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@9136393bda91e24064f0bff2508fe123dacd800c

🧩 Skill update

npx skills add larksuite/cli#feat/errs-migrate-im -y -g

@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

Caution

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

⚠️ Outside diff range comments (3)
shortcuts/im/im_messages_send.go (1)

218-224: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Treat missing local media files as invalid input.

Ignoring os.IsNotExist(err) lets --image/--file/--video/--audio point at a missing local path without producing the typed validation envelope this migration is adding. runtime.FileIO().Stat() already handles path-safety for these flags, so the remaining Stat errors should be surfaced here too.

Suggested fix
 func validateMediaFlagPath(fio fileio.FileIO, flagName, value string) error {
 	if value == "" || strings.HasPrefix(value, "http://") || strings.HasPrefix(value, "https://") || isMediaKey(value) {
 		return nil
 	}
-	if _, err := fio.Stat(value); err != nil && !os.IsNotExist(err) {
+	if _, err := fio.Stat(value); err != nil {
 		return errs.NewValidationError(errs.SubtypeInvalidArgument, "%s: %v", flagName, err).WithParam(flagName)
 	}
 	return nil
 }

Based on learnings, runtime.FileIO().Stat() already enforces path-safety for user-supplied local file paths, so suppressing Stat failures here only hides missing-file input errors.

🤖 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/im/im_messages_send.go` around lines 218 - 224, The
validateMediaFlagPath function currently ignores os.IsNotExist errors from
fio.Stat, allowing missing local media paths to pass validation; update the
error handling in validateMediaFlagPath so that any Stat error (including
os.IsNotExist) is returned as a typed validation error using
errs.NewValidationError with flagName context (i.e., replace the conditional
that skips os.IsNotExist with a straight check for err != nil and return the
validation error), preserving the initial checks for empty/HTTP/media-key
values.
shortcuts/im/im_messages_resources_download.go (1)

400-419: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Wrap the final transport error before returning it.

After the retry loop, lastErr is returned verbatim. If DoAPIStream keeps failing with a raw timeout/DNS/socket error, callers lose the typed IM envelope on the exact path this PR is migrating.

Suggested fix
 	if lastErr != nil {
-		return nil, lastErr
+		return nil, wrapIMNetworkErr(lastErr)
 	}
 	return nil, errs.NewNetworkError(errs.SubtypeNetworkTransport, "download request failed")
 }
🤖 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/im/im_messages_resources_download.go` around lines 400 - 419, The
loop currently returns lastErr verbatim which loses the IM-specific network
envelope; instead wrap lastErr in the IM network error before returning so
callers keep the typed envelope. Replace the final "return lastErr" with a
wrapped error (e.g. return errs.NewNetworkError(errs.SubtypeNetworkTransport,
"download request failed", lastErr) or otherwise attach lastErr as the cause),
leaving the retry logic using DoAPIStream, imDownloadRequestRetries and
sleepIMDownloadRetry unchanged; ensure the final return uses
errs.NewNetworkError with lastErr included.
shortcuts/im/im_messages_search.go (1)

360-366: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Reject oversized --page-size values instead of silently clamping.

This now returns a typed invalid-argument error for page-size < 1, but --page-size > 50 still succeeds and is quietly rewritten to 50. That makes the new validation contract asymmetric and hides caller mistakes.

Suggested fix
 	pageSize := runtime.Int("page-size")
-	if pageSize < 1 {
+	if pageSize < 1 || pageSize > messagesSearchMaxPageSize {
 		return nil, errs.NewValidationError(errs.SubtypeInvalidArgument, "--page-size must be an integer between 1 and 50").WithParam("--page-size")
 	}
-	if pageSize > messagesSearchMaxPageSize {
-		pageSize = messagesSearchMaxPageSize
-	}
🤖 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/im/im_messages_search.go` around lines 360 - 366, The code
currently clamps pageSize > messagesSearchMaxPageSize to 50; change this to
return a validation error instead so the contract is symmetric. In the function
that reads pageSize (the runtime.Int("page-size") branch), replace the clamp
block that references messagesSearchMaxPageSize with a check that if pageSize >
messagesSearchMaxPageSize you return
errs.NewValidationError(errs.SubtypeInvalidArgument, "--page-size must be an
integer between 1 and 50").WithParam("--page-size") (matching the existing
pageSize < 1 error) so oversized values are rejected rather than silently
rewritten.
🤖 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/helpers.go`:
- Around line 1052-1055: The validation errors for oversize uploads lose
structured attribution because upload helpers (e.g., uploadImageToIM) don't
include the originating flag; update the upload helper signatures to accept a
flagName string (e.g., add flagName param to uploadImageToIM and the other
upload helpers referenced around lines 1089–1092), pass s.flagName from
resolveLocalMedia into those helpers, and include that flagName as the param on
errs.NewValidationError calls so the error includes the source flag (use
s.flagName when calling the updated upload functions and set the param field in
the validation error construction).
- Around line 1371-1384: Change the error types returned from the API lookup:
when items is missing or empty (the items := data["items"].([]any) check) return
errs.NewAPIError(errs.SubtypeNotFound, ...) instead of errs.NewValidationError;
for malformed payload shapes — the msg type assertion
(items[0].(map[string]any)) and missing chat_id (msg["chat_id"].(string)) —
return errs.NewInternalError(errs.SubtypeInvalidResponse, ...) instead of
errs.NewValidationError so downstream callers get NotFound for lookups and
Internal/InvalidResponse for bad API payloads.

In `@shortcuts/im/im_errors.go`:
- Around line 32-33: The ValidationError returned when errors.Is(err,
fileio.ErrPathValidation) currently drops the param field; update the return in
im_errors.go for the fileio.ErrPathValidation case so it preserves the flag by
chaining .WithParam("--output") on the error (i.e., return
errs.NewValidationError(errs.SubtypeInvalidArgument, "unsafe output path: %s",
err).WithParam("--output").WithCause(err)), referencing the existing
errors.Is(err, fileio.ErrPathValidation) branch and the NewValidationError call.

In `@shortcuts/im/im_flag_create.go`:
- Around line 140-145: The current code around getMessageChatID (and likewise
resolveThreadFeedItemType at lines ~151-155) indiscriminately wraps all errors
into errs.NewValidationError, which hides upstream categories; change the logic
to return upstream errors unchanged unless the failure truly indicates invalid
caller input—i.e., detect the specific condition that means the caller must
change input and only then synthesize a ValidationError (using
errs.NewValidationError). For all other errors from getMessageChatID and
resolveThreadFeedItemType, propagate the original error (or map through the IM
network wrapper) instead of wrapping it into a ValidationError so
transport/auth/network failures keep their original types.

---

Outside diff comments:
In `@shortcuts/im/im_messages_resources_download.go`:
- Around line 400-419: The loop currently returns lastErr verbatim which loses
the IM-specific network envelope; instead wrap lastErr in the IM network error
before returning so callers keep the typed envelope. Replace the final "return
lastErr" with a wrapped error (e.g. return
errs.NewNetworkError(errs.SubtypeNetworkTransport, "download request failed",
lastErr) or otherwise attach lastErr as the cause), leaving the retry logic
using DoAPIStream, imDownloadRequestRetries and sleepIMDownloadRetry unchanged;
ensure the final return uses errs.NewNetworkError with lastErr included.

In `@shortcuts/im/im_messages_search.go`:
- Around line 360-366: The code currently clamps pageSize >
messagesSearchMaxPageSize to 50; change this to return a validation error
instead so the contract is symmetric. In the function that reads pageSize (the
runtime.Int("page-size") branch), replace the clamp block that references
messagesSearchMaxPageSize with a check that if pageSize >
messagesSearchMaxPageSize you return
errs.NewValidationError(errs.SubtypeInvalidArgument, "--page-size must be an
integer between 1 and 50").WithParam("--page-size") (matching the existing
pageSize < 1 error) so oversized values are rejected rather than silently
rewritten.

In `@shortcuts/im/im_messages_send.go`:
- Around line 218-224: The validateMediaFlagPath function currently ignores
os.IsNotExist errors from fio.Stat, allowing missing local media paths to pass
validation; update the error handling in validateMediaFlagPath so that any Stat
error (including os.IsNotExist) is returned as a typed validation error using
errs.NewValidationError with flagName context (i.e., replace the conditional
that skips os.IsNotExist with a straight check for err != nil and return the
validation error), preserving the initial checks for empty/HTTP/media-key
values.
🪄 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: 955ef48f-2fa5-4305-bc24-030443534482

📥 Commits

Reviewing files that changed from the base of the PR and between 04932c2 and a8c7535.

📒 Files selected for processing (20)
  • .golangci.yml
  • shortcuts/im/helpers.go
  • shortcuts/im/im_chat_create.go
  • shortcuts/im/im_chat_list.go
  • shortcuts/im/im_chat_messages_list.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/im_chat_update.go
  • shortcuts/im/im_errors.go
  • shortcuts/im/im_errors_test.go
  • shortcuts/im/im_flag_cancel.go
  • shortcuts/im/im_flag_create.go
  • shortcuts/im/im_flag_list.go
  • shortcuts/im/im_flag_test.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/mute_filter.go

Comment thread shortcuts/im/helpers.go Outdated
Comment thread shortcuts/im/helpers.go
Comment thread shortcuts/im/im_errors.go Outdated
Comment thread shortcuts/im/im_flag_create.go
@evandance evandance force-pushed the feat/errs-migrate-im branch 2 times, most recently from bc092b6 to a2b8d43 Compare June 3, 2026 03:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)
shortcuts/im/helpers.go (1)

397-423: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve typed API failures before falling back to not_found.

These two helpers still use runtime.DoAPI(...) and never inspect the response envelope code. If the backend returns an API error in an HTTP 200 response, the empty data path now falls through to P2P chat not found / thread ID not found, masking permission/auth/rate-limit failures as not_found. getMessageChatID was already moved to DoAPIJSONTyped for exactly this reason; these lookups need the same classification before the final not-found branch.

Also applies to: 435-457

🤖 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/im/helpers.go` around lines 397 - 423, The helper currently calls
runtime.DoAPI and parses apiResp.RawBody directly, which can mask API errors
returned in a 200 envelope and fall through to "not_found"; replace the
runtime.DoAPI usage with runtime.DoAPIJSONTyped (or explicitly inspect the
response envelope's "code" and "msg" from apiResp.RawBody/result before
accessing data) so any API-level errors (permission/auth/rate-limit, etc.) are
returned as typed errs.NewAPIError instead of falling through to the final
not-found branch; apply the same change to the analogous block at lines 435-457
and ensure you return the API error as-is when the envelope indicates failure,
only falling back to errs.SubtypeNotFound when the envelope is success but
data/p2p_chats (or thread) is actually empty.
🤖 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/helpers.go`:
- Around line 344-345: resolveLocalMedia currently sends local-path upload
failures through mediaFallbackOrError and then wraps them with wrapIMNetworkErr,
which misclassifies file I/O/validation errors (from runtime.FileIO().Stat/Open)
as network.transport; update the non-URL branch so that errors originating from
local file operations are not wrapped by wrapIMNetworkErr but are returned or
reclassified as file-IO/validation errors instead (i.e., preserve the original
error type and envelope from mediaFallbackOrError), and only apply
wrapIMNetworkErr to true network/URL upload failures (affecting
resolveLocalMedia, mediaFallbackOrError usage, and the call sites like
uploadImageToIM).

---

Outside diff comments:
In `@shortcuts/im/helpers.go`:
- Around line 397-423: The helper currently calls runtime.DoAPI and parses
apiResp.RawBody directly, which can mask API errors returned in a 200 envelope
and fall through to "not_found"; replace the runtime.DoAPI usage with
runtime.DoAPIJSONTyped (or explicitly inspect the response envelope's "code" and
"msg" from apiResp.RawBody/result before accessing data) so any API-level errors
(permission/auth/rate-limit, etc.) are returned as typed errs.NewAPIError
instead of falling through to the final not-found branch; apply the same change
to the analogous block at lines 435-457 and ensure you return the API error
as-is when the envelope indicates failure, only falling back to
errs.SubtypeNotFound when the envelope is success but data/p2p_chats (or thread)
is actually empty.
🪄 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: 658c0a22-b574-4279-aedf-22af7996e44b

📥 Commits

Reviewing files that changed from the base of the PR and between a8c7535 and bc092b6.

📒 Files selected for processing (28)
  • .golangci.yml
  • lint/errscontract/rule_no_legacy_envelope_literal.go
  • shortcuts/common/call_api_typed_test.go
  • shortcuts/common/runner.go
  • shortcuts/im/convert_lib/helpers.go
  • shortcuts/im/convert_lib/merge.go
  • shortcuts/im/convert_lib/reactions.go
  • shortcuts/im/convert_lib/thread.go
  • shortcuts/im/helpers.go
  • shortcuts/im/helpers_network_test.go
  • shortcuts/im/im_chat_create.go
  • shortcuts/im/im_chat_list.go
  • shortcuts/im/im_chat_messages_list.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/im_chat_update.go
  • shortcuts/im/im_errors.go
  • shortcuts/im/im_errors_test.go
  • shortcuts/im/im_flag_cancel.go
  • shortcuts/im/im_flag_create.go
  • shortcuts/im/im_flag_list.go
  • shortcuts/im/im_flag_test.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/mute_filter.go
✅ Files skipped from review due to trivial changes (1)
  • lint/errscontract/rule_no_legacy_envelope_literal.go
🚧 Files skipped from review as they are similar to previous changes (7)
  • shortcuts/im/im_messages_send.go
  • shortcuts/im/im_flag_cancel.go
  • shortcuts/im/im_flag_test.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/im_chat_create.go
  • shortcuts/im/im_chat_list.go
  • shortcuts/im/im_messages_resources_download.go

Comment thread shortcuts/im/helpers.go
@evandance evandance force-pushed the feat/errs-migrate-im branch from a2b8d43 to 76b0c22 Compare June 3, 2026 04:09

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

🧹 Nitpick comments (1)
shortcuts/im/convert_lib/merge.go (1)

203-207: 💤 Low value

Stale doc references to DoAPIJSON.

The call switched to runtime.DoAPIJSONTyped on Line 209, but the function godoc (Lines 203-207) and the inline comment on Line 216 still describe DoAPIJSON. Update the references to keep the docs accurate.

🤖 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/im/convert_lib/merge.go` around lines 203 - 207, Update the stale
documentation and inline comment that reference DoAPIJSON to instead reference
the actual function in use, runtime.DoAPIJSONTyped: edit the function godoc and
the inline comment near the call site so they describe runtime.DoAPIJSONTyped
(behavior, why it’s used, and that it checks the response envelope's code/msg)
and remove or replace mentions of DoAPIJSON to keep docs accurate relative to
the call to runtime.DoAPIJSONTyped.
🤖 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.

Nitpick comments:
In `@shortcuts/im/convert_lib/merge.go`:
- Around line 203-207: Update the stale documentation and inline comment that
reference DoAPIJSON to instead reference the actual function in use,
runtime.DoAPIJSONTyped: edit the function godoc and the inline comment near the
call site so they describe runtime.DoAPIJSONTyped (behavior, why it’s used, and
that it checks the response envelope's code/msg) and remove or replace mentions
of DoAPIJSON to keep docs accurate relative to the call to
runtime.DoAPIJSONTyped.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ec42a118-8d1b-4138-b879-c5d01a68eb1e

📥 Commits

Reviewing files that changed from the base of the PR and between a2b8d43 and 76b0c22.

📒 Files selected for processing (29)
  • .golangci.yml
  • lint/errscontract/rule_no_legacy_envelope_literal.go
  • shortcuts/common/call_api_typed_test.go
  • shortcuts/common/runner.go
  • shortcuts/im/convert_lib/card_test.go
  • shortcuts/im/convert_lib/helpers.go
  • shortcuts/im/convert_lib/merge.go
  • shortcuts/im/convert_lib/reactions.go
  • shortcuts/im/convert_lib/thread.go
  • shortcuts/im/helpers.go
  • shortcuts/im/helpers_network_test.go
  • shortcuts/im/im_chat_create.go
  • shortcuts/im/im_chat_list.go
  • shortcuts/im/im_chat_messages_list.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/im_chat_update.go
  • shortcuts/im/im_errors.go
  • shortcuts/im/im_errors_test.go
  • shortcuts/im/im_flag_cancel.go
  • shortcuts/im/im_flag_create.go
  • shortcuts/im/im_flag_list.go
  • shortcuts/im/im_flag_test.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/mute_filter.go
✅ Files skipped from review due to trivial changes (1)
  • lint/errscontract/rule_no_legacy_envelope_literal.go
🚧 Files skipped from review as they are similar to previous changes (25)
  • shortcuts/im/convert_lib/reactions.go
  • shortcuts/im/im_messages_mget.go
  • shortcuts/im/mute_filter.go
  • shortcuts/im/im_chat_update.go
  • shortcuts/im/convert_lib/thread.go
  • .golangci.yml
  • shortcuts/im/im_threads_messages_list.go
  • shortcuts/im/convert_lib/card_test.go
  • shortcuts/common/runner.go
  • shortcuts/im/im_chat_search.go
  • shortcuts/im/im_messages_search.go
  • shortcuts/im/im_flag_create.go
  • shortcuts/im/im_chat_messages_list.go
  • shortcuts/im/convert_lib/helpers.go
  • shortcuts/im/im_messages_send.go
  • shortcuts/im/helpers_network_test.go
  • shortcuts/im/im_flag_list.go
  • shortcuts/im/im_errors_test.go
  • shortcuts/common/call_api_typed_test.go
  • shortcuts/im/im_flag_cancel.go
  • shortcuts/im/im_chat_list.go
  • shortcuts/im/im_flag_test.go
  • shortcuts/im/im_messages_reply.go
  • shortcuts/im/im_chat_create.go
  • shortcuts/im/helpers.go

@evandance evandance force-pushed the feat/errs-migrate-im branch 13 times, most recently from ba0e4d2 to 5bb73f6 Compare June 5, 2026 14:46
@evandance evandance force-pushed the feat/errs-migrate-im branch from 5bb73f6 to 9136393 Compare June 5, 2026 14:54
@evandance evandance merged commit 5788a6c into main Jun 6, 2026
20 checks passed
@evandance evandance deleted the feat/errs-migrate-im branch June 6, 2026 09:07
pluginmd pushed a commit to larkcowork/lark-mcp-cli that referenced this pull request Jun 7, 2026
…ial rename

Official larksuite#1230 renamed common.ValidateChatID → ValidateChatIDTyped; the MCP
card-send command (added pre-rebase) still called the removed name. Restores
go build ./... after rebasing the MCP/Cowork work onto larkcowork/main.
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/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants