feat: add comment-aware document fetch - #2244
Conversation
📝 WalkthroughWalkthroughDocs fetch now supports opt-in comment retrieval. Validation enforces compatible output, identity, document format, and scope settings. Tests cover request construction and rendered comment references. Documentation describes the new option and response structure. ChangesDocument comment fetching
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant DocsFetchV2
participant DocsAPI
CLI->>DocsFetchV2: pass --comments
DocsFetchV2->>DocsFetchV2: validate format, identity, and scope
DocsFetchV2->>DocsAPI: send include_comments
DocsAPI-->>DocsFetchV2: return document and comment data
DocsFetchV2-->>CLI: render document with comment references
Possibly related PRs
Suggested labels: 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2244 +/- ##
==========================================
- Coverage 76.41% 76.37% -0.04%
==========================================
Files 1010 1011 +1
Lines 111104 111301 +197
==========================================
+ Hits 84895 85002 +107
- Misses 19737 19815 +78
- Partials 6472 6484 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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-fetch.md`:
- Line 117: 更新 lark-doc 的格式说明,删除对未在参数表中列出的 table 格式的引用;若 CLI 实际支持
table,则同步将其加入参数表并确保相关格式校验与文档契约一致。
In `@tests/cli_e2e/docs/docs_fetch_comments_workflow_test.go`:
- Around line 42-46: Register t.Cleanup immediately after creating the document
and folder in the test workflow, using the existing document and folder
identifiers to delete the document first and then the folder. Ensure cleanup
runs whether assertions pass or fail, while preserving the current
comment-creation and verification flow.
🪄 Autofix
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: f2adbc6f-abe1-4dbe-a71a-d273b30d84aa
📒 Files selected for processing (8)
shortcuts/doc/docs_fetch.goshortcuts/doc/docs_fetch_im_markdown_test.goshortcuts/doc/docs_fetch_v2.goshortcuts/doc/docs_fetch_v2_test.goskills/lark-doc/SKILL.mdskills/lark-doc/references/lark-doc-fetch.mdtests/cli_e2e/docs/docs_fetch_comments_workflow_test.gotests/cli_e2e/docs/docs_fetch_dryrun_test.go
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@0377b32d5e8acaa261fabc8293b37d4f8320c10d🧩 Skill updatenpx skills add larksuite/cli#sun/docx-fetch-comments -y -g |
|
交付状态更新(本条替代此前摘要中的 IM Markdown 表述):
|
Summary
Add opt-in, AI-friendly visible comment context to
docs +fetchwhile preserving the existing comment-free default and the existing IM Markdown behavior.Contract
--commentsis effective only for non-outline reads and requires--format jsonplus--as bot.comment-refs="c1 c2"; Markdown uses<comment-ref refs="c1 c2"/>.xmlandmarkdown.im-markdownremains unchanged; an effective--comments --doc-format im-markdowncombination is rejected before any API request.reference_map.commentandreference_map.document-comment.Implementation
include_commentsonly when comments are effective and require the conditional comment-read scope.Validation
boe_sun_ai_testreal-document matrix: 15 local + 806 whole-document discussions with exact marker/sidecar closure in XML and Markdown.--comments --doc-format im-markdownreturns a typed--doc-formatvalidation error before the request.drive:drive/space:document:delete; no comment-fetch package failed.0377b32d(evidence: CI31239377111, CodeQL31239322520).Dependencies and boundaries
OpenAPIListBlockByCommentIDsonly for comment-ID-to-block association. Comment headers and discussion content come from the comment service (GetCommentByNoteandAPIBatchGetComment).Related Issues