feat: add Base table copy shortcuts - #2019
Conversation
📝 WalkthroughWalkthroughAdds ChangesBase table copy workflow
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant executeTableCopy
participant BaseAPI
participant pollTableCopy
participant StatusAPI
CLI->>executeTableCopy: submit table-copy request
executeTableCopy->>BaseAPI: create table copy
BaseAPI-->>executeTableCopy: return state and task_id
executeTableCopy->>pollTableCopy: wait when requested
pollTableCopy->>StatusAPI: fetch status with remaining deadline
StatusAPI-->>pollTableCopy: return task state
pollTableCopy-->>CLI: success, timeout, or continuation command
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2019 +/- ##
==========================================
+ Coverage 75.39% 75.44% +0.04%
==========================================
Files 924 928 +4
Lines 98005 98389 +384
==========================================
+ Hits 73895 74225 +330
- Misses 18478 18514 +36
- Partials 5632 5650 +18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
5884cdf to
3159090
Compare
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@efc9e79eba0c6a92ec60e095bbddf84d4d52b7a0🧩 Skill updatenpx skills add larksuite/cli#codex/base-table-copy -y -g |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (6)
shortcuts/base/table_copy.go (2)
111-113: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDerive the limit text from
tableCopyTimeoutMax.Both this message and the
--timeoutusage string on Line 46 hardcode30m, so changing the constant silently desyncs user-facing text.♻️ Suggested change
- if wait && (timeout <= 0 || timeout > tableCopyTimeoutMax) { - return errs.NewValidationError(errs.SubtypeInvalidArgument, "--timeout must be greater than 0 and at most 30m").WithParam("--timeout") - } + if wait && (timeout <= 0 || timeout > tableCopyTimeoutMax) { + return errs.NewValidationError(errs.SubtypeInvalidArgument, "--timeout must be greater than 0 and at most %s", tableCopyTimeoutMax).WithParam("--timeout") + }🤖 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/base/table_copy.go` around lines 111 - 113, Update the timeout validation message and the `--timeout` usage string to derive their limit text from `tableCopyTimeoutMax` instead of hardcoding `30m`. Keep the existing validation behavior unchanged and use the shared constant consistently so both user-facing messages stay synchronized.
86-91: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the blank
--table-id/--nameguards.Codecov flags Lines 87 and 90 as uncovered.
TestBaseTableCopyRejectsInvalidFlagCombinationsnever exercises whitespace-only values for these two flags, so reverting either guard would not fail the suite. A whitespace case per flag (mirroring the--task-idblank case) closes this.As per coding guidelines, "Every behavior change must have an accompanying test, and contract tests must assert the changed field or behavior directly so reverting the implementation causes failure."
🤖 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/base/table_copy.go` around lines 86 - 91, Add whitespace-only cases for both --table-id and --name to TestBaseTableCopyRejectsInvalidFlagCombinations, mirroring the existing blank --task-id coverage. Assert each case returns the invalid-argument validation error for its specific flag so removing either guard causes the test to fail.Sources: Coding guidelines, Linters/SAST tools
shortcuts/base/table_copy_ops.go (2)
85-90: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
submitTableCopyignores thectxpassed intoexecuteTableCopyWithClock.The status path uses
baseV3CallContext(ctx, ...), but submission goes throughbaseV3Call, which falls back toruntime.Ctx(). Today these are the same context, so behavior is correct, but the asymmetry means a future caller passing a derived/boundedctx(as the polling path already does) would silently not bound the submit request.♻️ Suggested change
- submit, err := submitTableCopy(runtime, rangeValue) + submit, err := submitTableCopy(ctx, runtime, rangeValue)func submitTableCopy(ctx context.Context, runtime *common.RuntimeContext, rangeValue string) (tableCopySubmitResult, error) { // ... data, err := baseV3CallContext(ctx, runtime, "POST", baseV3Path("bases", baseToken, "tables", tableRef, "copy"), nil, body)Also applies to: 251-258
🤖 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/base/table_copy_ops.go` around lines 85 - 90, Update submitTableCopy to accept a context.Context parameter and use it for the submission request via baseV3CallContext; pass the ctx received by executeTableCopyWithClock through to submitTableCopy, preserving the existing error handling and polling behavior.
304-308: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueName the magic values.
800010109here and the"failed"state literal on Line 338 are the only unnamed values in a file that otherwise usestableCopyState*constants;800010109is also duplicated ininternal/errclass/codemeta_base.go. AtableCopyStateFailed = "failed"const and a named code const would keep this consistent.Also applies to: 338-339
🤖 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/base/table_copy_ops.go` around lines 304 - 308, The table-copy code uses unnamed status and error-code values; define named constants for the failed state and code 800010109, reusing the existing shared code constant from internal/errclass/codemeta_base.go if appropriate. Update tableCopyStatusError and the state handling around the “failed” literal to reference these constants, following the existing tableCopyState* naming convention.shortcuts/base/table_copy_poll.go (2)
56-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the repeated timeout-finalization branch.
The
if !hasStatus && lastErr != nil { return tableCopyStatus{}, false, lastErr }; return lastStatus, true, nilpattern (or itserr-based variant) is duplicated at lines 59-63, 77-81, 84-88, and 96-99. Consolidating into a helper reduces the risk of the branches drifting apart on future edits.♻️ Proposed refactor
+func tableCopyTimeoutResult(hasStatus bool, lastStatus tableCopyStatus, err error) (tableCopyStatus, bool, error) { + if !hasStatus && err != nil { + return tableCopyStatus{}, false, err + } + return lastStatus, true, nil +} + func pollTableCopy( ctx context.Context, timeout time.Duration, clock tableCopyClock, fetch tableCopyStatusFetcher, ) (tableCopyStatus, bool, error) { deadline := clock.Now().Add(timeout) delay := tableCopyPollInitial var lastStatus tableCopyStatus var lastErr error hasStatus := false for { remaining := deadline.Sub(clock.Now()) if remaining <= 0 { - if !hasStatus && lastErr != nil { - return tableCopyStatus{}, false, lastErr - } - return lastStatus, true, nil + return tableCopyTimeoutResult(hasStatus, lastStatus, lastErr) } ... if !clock.Now().Before(deadline) { - if !hasStatus && lastErr != nil { - return tableCopyStatus{}, false, lastErr - } - return lastStatus, true, nil + return tableCopyTimeoutResult(hasStatus, lastStatus, lastErr) } requestBudget := deadline.Sub(clock.Now()) if requestBudget <= 0 { - if !hasStatus && lastErr != nil { - return tableCopyStatus{}, false, lastErr - } - return lastStatus, true, nil + return tableCopyTimeoutResult(hasStatus, lastStatus, lastErr) } ... if !clock.Now().Before(deadline) { - if !hasStatus && err != nil { - return tableCopyStatus{}, false, err - } - return lastStatus, true, nil + return tableCopyTimeoutResult(hasStatus, lastStatus, err) }🤖 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/base/table_copy_poll.go` around lines 56 - 100, Extract the duplicated timeout-finalization logic from the polling loop into a local helper that accepts the relevant error value and returns the appropriate status, completion flag, and error. Replace the repeated branches around deadline checks, preserving the distinct use of lastErr before fetch and err after fetch while keeping existing return behavior unchanged.
56-139: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the untested deadline/error and retry-classification branches.
Static analysis flags several non-trivial branches as untested: the deadline-reached-with-only-an-error paths (lines 59-60, 84-85, 87, 97), the ctx-cancellation return (70-72), the invalid-state error (113-114), and the default
false(non-retryable) branch oftableCopyPollErrorRetryable(line 128). These are exactly the edge cases that make deadline-bounded polling correct; locking them down with tests would catch regressions if the branch order or classification logic changes later.🤖 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/base/table_copy_poll.go` around lines 56 - 139, Add tests covering the deadline/error return paths in the polling loop, including expiration before polling, after timer wait, and after fetch when no successful status exists; verify context cancellation returns ctx.Err(). Exercise invalid table-copy states and assert the resulting internal error. Add tableCopyPollErrorRetryable tests for non-retryable network/API and unknown errors, confirming the default false classification while preserving existing retryable cases.Source: Linters/SAST tools
🤖 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/base/base_table_copy_dryrun_test.go`:
- Around line 68-85: Extend the status coverage in
tests/cli_e2e/base/base_table_copy_dryrun_test.go:68-85 with a bot-authenticated
dry-run case that asserts the status request fields. In
tests/cli_e2e/base/base_table_copy_workflow_test.go:100-145, submit and poll one
copy task using bot identity, preserving that identity through status checks.
Update tests/cli_e2e/base/coverage.md:16-17 and :79-80 to retain the user/bot
coverage claims only if the new bot status coverage is present; otherwise narrow
those notes.
In `@tests/cli_e2e/base/base_table_copy_workflow_test.go`:
- Around line 29-38: Add a uniquely named field to the source schema created in
the base table-copy workflow, then inspect the copied table’s schema and assert
that field exists with the expected definition. Update the related assertions in
the workflow around the copied-table validation so the test directly fails when
source fields are omitted, while preserving the existing table-copy checks.
---
Nitpick comments:
In `@shortcuts/base/table_copy_ops.go`:
- Around line 85-90: Update submitTableCopy to accept a context.Context
parameter and use it for the submission request via baseV3CallContext; pass the
ctx received by executeTableCopyWithClock through to submitTableCopy, preserving
the existing error handling and polling behavior.
- Around line 304-308: The table-copy code uses unnamed status and error-code
values; define named constants for the failed state and code 800010109, reusing
the existing shared code constant from internal/errclass/codemeta_base.go if
appropriate. Update tableCopyStatusError and the state handling around the
“failed” literal to reference these constants, following the existing
tableCopyState* naming convention.
In `@shortcuts/base/table_copy_poll.go`:
- Around line 56-100: Extract the duplicated timeout-finalization logic from the
polling loop into a local helper that accepts the relevant error value and
returns the appropriate status, completion flag, and error. Replace the repeated
branches around deadline checks, preserving the distinct use of lastErr before
fetch and err after fetch while keeping existing return behavior unchanged.
- Around line 56-139: Add tests covering the deadline/error return paths in the
polling loop, including expiration before polling, after timer wait, and after
fetch when no successful status exists; verify context cancellation returns
ctx.Err(). Exercise invalid table-copy states and assert the resulting internal
error. Add tableCopyPollErrorRetryable tests for non-retryable network/API and
unknown errors, confirming the default false classification while preserving
existing retryable cases.
In `@shortcuts/base/table_copy.go`:
- Around line 111-113: Update the timeout validation message and the `--timeout`
usage string to derive their limit text from `tableCopyTimeoutMax` instead of
hardcoding `30m`. Keep the existing validation behavior unchanged and use the
shared constant consistently so both user-facing messages stay synchronized.
- Around line 86-91: Add whitespace-only cases for both --table-id and --name to
TestBaseTableCopyRejectsInvalidFlagCombinations, mirroring the existing blank
--task-id coverage. Assert each case returns the invalid-argument validation
error for its specific flag so removing either guard causes the test to 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 Plus
Run ID: 9a6d8fb7-1d23-4d8e-a8eb-cff874583487
📒 Files selected for processing (16)
internal/errclass/codemeta_base.gointernal/errclass/codemeta_base_test.gointernal/httpmock/registry.gointernal/httpmock/registry_test.goshortcuts/base/base_shortcuts_test.goshortcuts/base/helpers.goshortcuts/base/shortcuts.goshortcuts/base/table_copy.goshortcuts/base/table_copy_ops.goshortcuts/base/table_copy_poll.goshortcuts/base/table_copy_test.goshortcuts/common/runner.goskills/lark-base/SKILL.mdtests/cli_e2e/base/base_table_copy_dryrun_test.gotests/cli_e2e/base/base_table_copy_workflow_test.gotests/cli_e2e/base/coverage.md
| baseToken := createBaseWithRetry(t, ctx, "lark-cli-e2e-table-copy-"+clie2e.GenerateSuffix()) | ||
| sourceTableID, _, _ := createTableWithRetry( | ||
| t, | ||
| parentT, | ||
| ctx, | ||
| baseToken, | ||
| "Copy source "+clie2e.GenerateSuffix(), | ||
| `[{"name":"Name","type":"text"}]`, | ||
| `{"name":"Main","type":"grid"}`, | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Assert that the schema itself was copied.
This only proves an empty target table was created. Add a distinct source field and assert it exists on the copied table; an implementation that omits source fields currently passes.
As per coding guidelines, “contract tests must assert the changed field or behavior directly so reverting the implementation causes failure.”
Also applies to: 80-97
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/cli_e2e/base/base_table_copy_workflow_test.go` around lines 29 - 38,
Add a uniquely named field to the source schema created in the base table-copy
workflow, then inspect the copied table’s schema and assert that field exists
with the expected definition. Update the related assertions in the workflow
around the copied-table validation so the test directly fails when source fields
are omitted, while preserving the existing table-copy checks.
Source: Coding guidelines
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
shortcuts/base/table_copy_test.go (1)
735-804: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winAdd Category/Subtype assertions to these error-path tests.
As per coding guidelines,
**/*_test.go: "Error-path tests must assert typed metadata througherrs.ProblemOf(category,subtype, andparam) and verify cause preservation rather than relying only on message substrings." These three tests only checkproblem.Code(Line 806-861 additionally checksSubtype), leavingCategory(and, where applicable,Subtype) unverified for a PR whose main goal is fixing error classification/continuation gating.✅ Suggested additions
problem, ok := errs.ProblemOf(err) - if !ok || problem.Code != 800010109 { + if !ok || problem.Code != 800010109 || problem.Category != errs.CategoryAPI || problem.Subtype != /* expected subtype */ { t.Fatalf("error = %T %v, problem=%#v", err, err, problem) }problem, ok := errs.ProblemOf(err) - if !ok || problem.Code != 800030110 || problem.Subtype != errs.SubtypeNotFound { + if !ok || problem.Code != 800030110 || problem.Category != errs.CategoryAPI || problem.Subtype != errs.SubtypeNotFound { t.Fatalf("error = %T %v, problem=%#v", err, err, problem) }problem, ok := errs.ProblemOf(err) - if !ok || problem.Code != 800070111 { + if !ok || problem.Code != 800070111 || problem.Category != errs.CategoryAPI || problem.Subtype != /* expected subtype */ { t.Fatalf("error = %T %v, problem=%#v", err, err, problem) }Also applies to: 806-861, 862-932
🤖 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/base/table_copy_test.go` around lines 735 - 804, Add typed error assertions to TestBaseTableCopyWaitInvalidTaskDoesNotSuggestMorePolling and the two adjacent table-copy error-path tests: after errs.ProblemOf, verify the expected Category, Subtype, and Param values for each classification, and assert the underlying cause is preserved using the test’s existing cause/error sentinel. Keep the current code and hint assertions while covering all metadata required by the error contract.Source: Coding guidelines
🧹 Nitpick comments (1)
shortcuts/base/table_copy_ops.go (1)
139-161: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCompute
tableCopyWaitCanContinueonce and thread it through.
tableCopyWaitCanContinue(pollErr)is evaluated independently in the recovery-envelope path (Line 151) and insidetableCopyWaitError(Line 221). Both use the samepollErr, so today they can't diverge, but the duplication couples two decision points to one pure function by convention only — a future change to the classifier (e.g., adding any non-deterministic or stateful check) could make stdout and the returned error disagree about continuability.♻️ Suggested refactor
- if pollErr != nil { + if pollErr != nil { + canContinue := tableCopyWaitCanContinue(pollErr) recoveryState := status.State if recoveryState == "" { recoveryState = submit.State } recovery := tableCopyOutput{ Table: submit.Table, Range: rangeValue, State: recoveryState, Completed: false, TaskID: submit.TaskID, } - if tableCopyWaitCanContinue(pollErr) { + if canContinue { recovery.NextAction = "poll_status" recovery.NextCommand = tableCopyNextCommand(runtime, runtime.Str("base-token"), submit.TaskID) } recoveryErr := runtime.OutPartialFailure(recovery, nil) var partialFailure *output.PartialFailureError if !errors.As(recoveryErr, &partialFailure) { return recoveryErr } - return tableCopyWaitError(pollErr) + return tableCopyWaitError(pollErr, canContinue) }-func tableCopyWaitError(err error) error { - if !tableCopyWaitCanContinue(err) { +func tableCopyWaitError(err error, canContinue bool) error { + if !canContinue {Also applies to: 213-227
🤖 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/base/table_copy_ops.go` around lines 139 - 161, Compute tableCopyWaitCanContinue(pollErr) once in the poll-error handling flow and pass the resulting boolean into tableCopyWaitError, reusing it for both recovery.NextAction/NextCommand and the returned error. Update the tableCopyWaitError signature and its caller consistently while preserving the existing behavior.
🤖 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.
Outside diff comments:
In `@shortcuts/base/table_copy_test.go`:
- Around line 735-804: Add typed error assertions to
TestBaseTableCopyWaitInvalidTaskDoesNotSuggestMorePolling and the two adjacent
table-copy error-path tests: after errs.ProblemOf, verify the expected Category,
Subtype, and Param values for each classification, and assert the underlying
cause is preserved using the test’s existing cause/error sentinel. Keep the
current code and hint assertions while covering all metadata required by the
error contract.
---
Nitpick comments:
In `@shortcuts/base/table_copy_ops.go`:
- Around line 139-161: Compute tableCopyWaitCanContinue(pollErr) once in the
poll-error handling flow and pass the resulting boolean into tableCopyWaitError,
reusing it for both recovery.NextAction/NextCommand and the returned error.
Update the tableCopyWaitError signature and its caller consistently while
preserving the existing behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0cd7b70e-8854-44cf-b79b-ca31a142a6e2
📒 Files selected for processing (7)
shortcuts/base/table_copy.goshortcuts/base/table_copy_ops.goshortcuts/base/table_copy_test.goskills/lark-base/SKILL.mdtests/cli_e2e/base/base_table_copy_dryrun_test.gotests/cli_e2e/base/base_table_copy_workflow_test.gotests/cli_e2e/base/coverage.md
💤 Files with no reviewable changes (1)
- skills/lark-base/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (2)
- shortcuts/base/table_copy.go
- tests/cli_e2e/base/coverage.md
There was a problem hiding this comment.
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/base/table_copy_test.go`:
- Around line 923-925: Update the error assertions in the table-copy error-path
tests around ProblemOf to require a non-empty problem subtype, and verify the
original upstream API error remains discoverable through errors.Is or errors.As.
Preserve the existing code and category checks while ensuring
tableCopyWaitError’s typed metadata and cause wrapping are covered.
🪄 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: 49fa8656-335d-416f-b51e-e72942d9a26d
📒 Files selected for processing (2)
shortcuts/base/table_copy_ops.goshortcuts/base/table_copy_test.go
9dc8143 to
efc9e79
Compare
There was a problem hiding this comment.
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-base/SKILL.md`:
- Line 91: Update the +table-copy --wait recovery guidance to apply only when an
asynchronous wait remains unfinished: state that the task_id is printed to
stderr in that wait path, while immediately completed submissions should use the
stdout result. Preserve the existing Ctrl-C recovery instructions for unfinished
waits.
🪄 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: 5f672b7a-22e5-412e-bfb1-7dbabad24fbd
📒 Files selected for processing (16)
internal/errclass/codemeta_base.gointernal/errclass/codemeta_base_test.gointernal/httpmock/registry.gointernal/httpmock/registry_test.goshortcuts/base/base_shortcuts_test.goshortcuts/base/helpers.goshortcuts/base/shortcuts.goshortcuts/base/table_copy.goshortcuts/base/table_copy_ops.goshortcuts/base/table_copy_poll.goshortcuts/base/table_copy_test.goshortcuts/common/runner.goskills/lark-base/SKILL.mdtests/cli_e2e/base/base_table_copy_dryrun_test.gotests/cli_e2e/base/base_table_copy_workflow_test.gotests/cli_e2e/base/coverage.md
🚧 Files skipped from review as they are similar to previous changes (14)
- shortcuts/base/shortcuts.go
- shortcuts/base/base_shortcuts_test.go
- internal/errclass/codemeta_base.go
- internal/errclass/codemeta_base_test.go
- tests/cli_e2e/base/coverage.md
- internal/httpmock/registry.go
- shortcuts/base/helpers.go
- internal/httpmock/registry_test.go
- shortcuts/common/runner.go
- shortcuts/base/table_copy_poll.go
- tests/cli_e2e/base/base_table_copy_dryrun_test.go
- tests/cli_e2e/base/base_table_copy_workflow_test.go
- shortcuts/base/table_copy_ops.go
- shortcuts/base/table_copy_test.go
| ## 身份与权限降级 | ||
|
|
||
| - 默认显式使用 `--as user` 操作用户资源;只有用户明确要求应用身份时,才直接用 `--as bot`。 | ||
| - `+table-copy --wait` 提交成功后会在 stderr 打印完整 `task_id`;若进程被 Ctrl-C 终止,可用该 ID 和原身份执行 `+table-copy-status` 续查,不要重新提交复制。 |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Limit this recovery instruction to unfinished asynchronous waits.
shortcuts/base/table_copy_ops.go:85-197 prints the task_id progress message only after an all-range submission returns a non-success state and enters the wait path. If the submission completes immediately, the command returns before printing that stderr message. State that unfinished asynchronous waits print the task_id; use the stdout result when the task completes immediately.
🤖 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-base/SKILL.md` at line 91, Update the +table-copy --wait recovery
guidance to apply only when an asynchronous wait remains unfinished: state that
the task_id is printed to stderr in that wait path, while immediately completed
submissions should use the stdout result. Preserve the existing Ctrl-C recovery
instructions for unfinished waits.
Summary
Add Base shortcuts for copying a table and querying asynchronous copy status. Table copies default to schema-only, with explicit support for copying all records and optionally waiting for completion.
Changes
base +table-copywith table ID/name support, schema-safe defaults, asynchronous continuation output, and bounded wait polling.base +table-copy-statusfor one-shot task status queries using the original identity.Test Plan
make unit-testgo vet ./...gofmt -l .go mod tidyleavesgo.modandgo.sumunchangedRelated Issues
Summary by CodeRabbit
base +table-copyfor structure-only or full-record copying, with dry-run, asynchronous waiting, and timeout options.base +table-copy-statusto monitor copy progress.