Skip to content

feat(docx): refine docs history revert guidance - #2149

Merged
yballul-bytedance merged 5 commits into
larksuite:mainfrom
yballul-bytedance:auto-research-sync/01KYSRNXC7EG74JKVFN4BKMMKA/mr-1340-33587d49
Aug 3, 2026
Merged

feat(docx): refine docs history revert guidance#2149
yballul-bytedance merged 5 commits into
larksuite:mainfrom
yballul-bytedance:auto-research-sync/01KYSRNXC7EG74JKVFN4BKMMKA/mr-1340-33587d49

Conversation

@yballul-bytedance

@yballul-bytedance yballul-bytedance commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Refines the lark-doc reference for Docx history versions and rollback (skills/lark-doc/references/lark-doc-history.md). The guidance now spells out safety constraints for overwrite-based recovery and documents a revision_id fallback path for restoring document body content when no matching history version exists.

Changes

  • Replace the ## 安全流程 section with ## 安全约束, covering: overwrite rebuilding body/block IDs and not preserving comments and other non-body objects, verifying latest content on warning / partial_success (stopping on verification failure or revision conflict), and preserving the original error classification for permission/network/transient errors instead of treating them as "version not found".
  • Consolidate the ## 按 revision_id 或时间点回滚 workflow: locate the target record with +history-list (paginating via has_more / page_token), always pass history_version_id (never revision_id) to +history-revert, poll with +history-revert-status, and treat only done as success.
  • Add a revision_id-based body recovery flow for when no history record matches: read the target version with docs +fetch --revision-id <revision_id> --detail full --format json, use the current revision_id as an optimistic lock, strip stale block IDs, and reapply content / reference_map via a single docs +update --command overwrite, then verify the latest document (ignoring regenerated block IDs).

Test Plan

  • Documentation-only change to a skills/lark-doc/references/*.md reference file; no code paths affected.
  • git diff --check — passed (no whitespace errors or conflict markers).

Related Issues

Auto research task: 01KYSRNXC7EG74JKVFN4BKMMKA

Summary by CodeRabbit

  • Documentation
    • Added safety guidance for document overwrite and rollback operations.
    • Clarified handling of warnings, partial successes, and revision conflicts.
    • Documented rollback by revision or timestamp, including paginated version selection, status monitoring, and content verification.
    • Added guidance for fallback recovery when the requested revision cannot be found.

@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 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

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

更新 Lark 文档历史回滚说明,覆盖安全约束、版本选择、异步回滚、乐观锁恢复、冲突处理和结果核验。

Changes

文档历史回滚

Layer / File(s) Summary
回滚安全约束与恢复流程
skills/lark-doc/references/lark-doc-history.md
新增 overwrite 对象限制和错误分类。回滚流程支持按 revision_id 或时间点分页选择版本,并通过 history_version_id 执行回滚和轮询状态。目标记录缺失时,流程使用乐观锁恢复文档,并核验正文结构、文本、链接及引用资源。

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

Possibly related PRs

  • larksuite/cli#2127:同样修改版本获取、overwrite 回退和结果核验流程。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the documentation refinement for Docx history rollback guidance.
Description check ✅ Passed The description includes all required sections and clearly explains the documentation changes and verification performed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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)
skills/lark-doc/references/lark-doc-history.md (1)

16-16: 🩺 Stability & Availability | 🔵 Trivial

轮询时遵守 poll_after_ms

当状态为 running 时,应等待返回的 poll_after_ms 后再查询,并设置整体超时。当前文字只要求继续查询,可能导致紧密轮询和限流。

🤖 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-doc/references/lark-doc-history.md` at line 16, 更新历史回滚流程中状态为
running 的轮询说明:每次调用 +history-revert-status 后,等待响应中的 poll_after_ms
再发起下一次查询,并设置明确的整体超时;超时或返回非 done 的终态时停止轮询并报告失败。
🤖 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-doc/references/lark-doc-history.md`:
- Around line 18-19: 更新兜底恢复命令的文档示例:为 docs +fetch --revision-id 命令补充必需的 --doc
参数;为 docs +update --command overwrite 补充 --doc、--content 和当前版本的 --revision-id
<current_revision_id>,并同时传入目标响应中的 reference_map,确保其与 --content
一起提交。保持现有目标版本校验和乐观锁流程不变。

---

Nitpick comments:
In `@skills/lark-doc/references/lark-doc-history.md`:
- Line 16: 更新历史回滚流程中状态为 running 的轮询说明:每次调用 +history-revert-status 后,等待响应中的
poll_after_ms 再发起下一次查询,并设置明确的整体超时;超时或返回非 done 的终态时停止轮询并报告失败。
🪄 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: 4659f5d8-ebc6-4b63-aabe-ff9a0936ca88

📥 Commits

Reviewing files that changed from the base of the PR and between 427cbd6 and 005032f.

📒 Files selected for processing (1)
  • skills/lark-doc/references/lark-doc-history.md

Comment thread skills/lark-doc/references/lark-doc-history.md Outdated
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add yballul-bytedance/cli#auto-research-sync/01KYSRNXC7EG74JKVFN4BKMMKA/mr-1340-33587d49 -y -g

@yballul-bytedance
yballul-bytedance force-pushed the auto-research-sync/01KYSRNXC7EG74JKVFN4BKMMKA/mr-1340-33587d49 branch from 1d81242 to 6136cff Compare August 3, 2026 07:46
Comment thread skills/lark-doc/references/lark-doc-history.md Outdated
Comment thread skills/lark-doc/references/lark-doc-history.md Outdated
Comment thread skills/lark-doc/references/lark-doc-history.md
Comment thread skills/lark-doc/references/lark-doc-history.md Outdated
yballul-bytedance and others added 5 commits August 3, 2026 21:21
Restructure the docs history reference to add explicit safety
constraints for overwrite-based recovery and a revision_id fallback
path when no matching history version exists.

- Replace the '安全流程' section with '安全约束' covering overwrite
  block-ID/comment loss, warning/partial_success verification, and
  preserving original error classification.
- Consolidate the revert workflow: locate the target record via
  +history-list, use history_version_id (never revision_id) for
  +history-revert, and treat only 'done' as success.
- Add a revision_id-based body recovery flow using
  docs +fetch --revision-id and docs +update --command overwrite with
  optimistic locking and post-overwrite verification.

Co-authored-by: TRAE CLI <noreply@bytedance.com>
Sync incremental change from Codebase MR !1340 commit e1b0e649:
complete the +history-revert fallback command parameters
(--doc / --revision-id / --content / --reference-map) in the
lark-doc history restore reference.

Co-authored-by: TRAE CLI <noreply@bytedance.com>
Sync incremental change from Codebase MR !1340 commit bd66e0b5:
harden the full revision overwrite recovery flow in the lark-doc
history restore reference.

Co-authored-by: TRAE CLI <noreply@bytedance.com>
Sync incremental change from Codebase MR !1340 commit 567f71ba:
exhaust revision history pagination in the lark-doc history restore
reference.

Co-authored-by: TRAE CLI <noreply@bytedance.com>
Sync incremental change from Codebase MR !1340 commit fe278e9c:
skip redundant revision overwrite in the lark-doc history restore
reference.

Co-authored-by: TRAE CLI <noreply@bytedance.com>
@yballul-bytedance
yballul-bytedance force-pushed the auto-research-sync/01KYSRNXC7EG74JKVFN4BKMMKA/mr-1340-33587d49 branch from 15e9d39 to a63adac Compare August 3, 2026 13:21
@yballul-bytedance
yballul-bytedance merged commit f4cf768 into larksuite:main Aug 3, 2026
22 checks passed
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.

4 participants