feat(docx): refine docs history revert guidance - #2149
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough更新 Lark 文档历史回滚说明,覆盖安全约束、版本选择、异步回滚、乐观锁恢复、冲突处理和结果核验。 Changes文档历史回滚
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
skills/lark-doc/references/lark-doc-history.md
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@a63adacc11459ce9c75b296d247a22e62175f759🧩 Skill updatenpx skills add yballul-bytedance/cli#auto-research-sync/01KYSRNXC7EG74JKVFN4BKMMKA/mr-1340-33587d49 -y -g |
1d81242 to
6136cff
Compare
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>
15e9d39 to
a63adac
Compare
Summary
Refines the
lark-docreference for Docx history versions and rollback (skills/lark-doc/references/lark-doc-history.md). The guidance now spells out safety constraints foroverwrite-based recovery and documents arevision_idfallback path for restoring document body content when no matching history version exists.Changes
## 安全流程section with## 安全约束, covering:overwriterebuilding body/block IDs and not preserving comments and other non-body objects, verifying latest content onwarning/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".## 按 revision_id 或时间点回滚workflow: locate the target record with+history-list(paginating viahas_more/page_token), always passhistory_version_id(neverrevision_id) to+history-revert, poll with+history-revert-status, and treat onlydoneas success.revision_id-based body recovery flow for when no history record matches: read the target version withdocs +fetch --revision-id <revision_id> --detail full --format json, use the currentrevision_idas an optimistic lock, strip stale block IDs, and reapplycontent/reference_mapvia a singledocs +update --command overwrite, then verify the latest document (ignoring regenerated block IDs).Test Plan
skills/lark-doc/references/*.mdreference file; no code paths affected.git diff --check— passed (no whitespace errors or conflict markers).Related Issues
Auto research task: 01KYSRNXC7EG74JKVFN4BKMMKA
Summary by CodeRabbit