Skip to content

fix(wiki): correct copy semantics and rename routing - #2238

Merged
fangshuyu-768 merged 1 commit into
mainfrom
fix/wiki-copy-rename-bugs
Aug 8, 2026
Merged

fix(wiki): correct copy semantics and rename routing#2238
fangshuyu-768 merged 1 commit into
mainfrom
fix/wiki-copy-rename-bugs

Conversation

@fangshuyu-768

@fangshuyu-768 fangshuyu-768 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix two deterministic Wiki agent failures: +node-copy was documented as recursive even though it copies only the requested node, and Wiki rename tasks were not routed to the existing drive +update-title shortcut.

Changes

  • Clarify in +node-copy help and the lark-wiki reference that copying is non-recursive.
  • Route in-place Wiki node renames to drive +update-title in the lark-wiki Skill, so agents avoid raw API probing and receive the shortcut's scope recovery hints.
  • Replace the stale copy-then-delete migration note with the existing wiki +move shortcut.

Test Plan

  • Unit tests pass (make unit-test)
  • Wiki shortcut unit tests pass (go test ./shortcuts/wiki)
  • Manual live verification: copied a real parent node with one child and confirmed the copied node had zero children
  • Manual live verification: renamed a newly created Wiki node with drive +update-title and confirmed the same node_token returned the new title
  • go vet ./...
  • gofmt -l . returns no files
  • go mod tidy leaves go.mod and go.sum unchanged
  • golangci-lint reports 0 issues

Related Issues

  • None

Summary by CodeRabbit

  • New Features
    • Wiki node copying now copies only the selected node and its content, excluding descendants.
  • Documentation
    • Added guidance for renaming Wiki nodes in place while preserving their existing identifiers.
    • Clarified authorization and scope feedback for title updates.
    • Updated migration guidance to handle descendants separately and use Wiki move functionality when relocating nodes.
  • Tests
    • Added coverage confirming that Wiki node copies are non-recursive.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 61d02805-cc7f-41ad-ae8e-b645ba9d8a7e

📥 Commits

Reviewing files that changed from the base of the PR and between 46e2186 and f3244a1.

📒 Files selected for processing (4)
  • shortcuts/wiki/wiki_list_copy_test.go
  • shortcuts/wiki/wiki_node_copy.go
  • skills/lark-wiki/SKILL.md
  • skills/lark-wiki/references/lark-wiki-node-copy.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • shortcuts/wiki/wiki_node_copy.go
  • skills/lark-wiki/SKILL.md
  • shortcuts/wiki/wiki_list_copy_test.go
  • skills/lark-wiki/references/lark-wiki-node-copy.md

📝 Walkthrough

Walkthrough

The change documents non-recursive Wiki node copying, adds test coverage for that behavior, and directs in-place Wiki node renaming through drive +update-title.

Changes

Wiki shortcut guidance

Layer / File(s) Summary
Node-only copy semantics
shortcuts/wiki/wiki_node_copy.go, shortcuts/wiki/wiki_list_copy_test.go, skills/lark-wiki/references/lark-wiki-node-copy.md
Copy tips, tests, and reference guidance state that only the requested node is copied. Descendants require separate handling.
In-place rename routing
skills/lark-wiki/SKILL.md
Wiki node title changes use drive +update-title, retain the existing node_token, and report scope or authorization errors from the API response.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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
Description check ✅ Passed The description includes complete Summary, Changes, Test Plan, and Related Issues sections with specific verification results.
Title check ✅ Passed The title concisely identifies the Wiki copy-semantics correction and rename-routing change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wiki-copy-rename-bugs

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.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
shortcuts/wiki/wiki_node_copy.go (1)

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

Add coverage for the pretty output contract.

The changed renderer emits copy_scope, but the shown test only checks the structured JSON field. Add or verify a --format pretty case that checks copy_scope: node_only. This protects the pretty output if this line is removed or renamed.

🤖 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/wiki/wiki_node_copy.go` at line 118, Add coverage for the
pretty-rendering path that exercises the output around
valueOrDash(out["copy_scope"]) and asserts the rendered text contains
“copy_scope: node_only”. Keep the existing structured JSON assertion and verify
the pretty output contract through the relevant CLI/test entry point.

Source: Coding guidelines

🤖 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/wiki/wiki_node_copy.go`:
- Line 118: Add coverage for the pretty-rendering path that exercises the output
around valueOrDash(out["copy_scope"]) and asserts the rendered text contains
“copy_scope: node_only”. Keep the existing structured JSON assertion and verify
the pretty output contract through the relevant CLI/test entry point.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e9545bfb-e3a9-4d56-b1ae-a03cba0ba5be

📥 Commits

Reviewing files that changed from the base of the PR and between bc0ba22 and 565c278.

📒 Files selected for processing (8)
  • shortcuts/wiki/wiki_list_copy_test.go
  • shortcuts/wiki/wiki_node_copy.go
  • shortcuts/wiki/wiki_node_create.go
  • shortcuts/wiki/wiki_node_create_test.go
  • skills/lark-wiki/SKILL.md
  • skills/lark-wiki/references/lark-wiki-node-copy.md
  • tests/cli_e2e/wiki/coverage.md
  • tests/cli_e2e/wiki/wiki_shortcut_workflow_test.go

@fangshuyu-768

Copy link
Copy Markdown
Collaborator Author

Manual live verification completed in an authorized tenant: created a new Wiki docx node, renamed it in place with drive +update-title --url <wiki-url> --title <new-title>, and read it back. The Wiki node_token stayed unchanged, wiki +node-get returned the new title, and drive +inspect on the underlying docx token returned the same new title. No existing document was modified.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#fix/wiki-copy-rename-bugs -y -g

@fangshuyu-768

Copy link
Copy Markdown
Collaborator Author

Live verification completed against a real personal Wiki space using the PR branch:

  • Created a source parent node and one direct child.
  • Confirmed the source parent reports has_child: true and +node-list returns exactly 1 child.
  • Copied the parent with wiki +node-copy into the same space.
  • Confirmed the copied node reports has_child: false and +node-list returns 0 children.

This verifies the API/CLI behavior is node-only, not recursive. Tokens and internal document links are intentionally omitted.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.34%. Comparing base (bc0ba22) to head (f3244a1).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2238   +/-   ##
=======================================
  Coverage   76.33%   76.34%           
=======================================
  Files         993      993           
  Lines      106633   106691   +58     
=======================================
+ Hits        81400    81450   +50     
- Misses      19032    19037    +5     
- Partials     6201     6204    +3     

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

@fangshuyu-768
fangshuyu-768 force-pushed the fix/wiki-copy-rename-bugs branch from bee7cb0 to f3244a1 Compare August 7, 2026 09:09
@fangshuyu-768 fangshuyu-768 changed the title fix(wiki): clarify copy scope and rename routing fix(wiki): correct copy semantics and rename routing Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@fangshuyu-768
fangshuyu-768 merged commit fb4fc26 into main Aug 8, 2026
29 of 43 checks passed
@fangshuyu-768
fangshuyu-768 deleted the fix/wiki-copy-rename-bugs branch August 8, 2026 02:26
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/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants