feat(docs): support html5-block reference map roundtrip#1380
Conversation
📝 WalkthroughWalkthroughAdds HTML5-block support across docs v2 create/update/fetch flows: runtime raw partial-failure output, HTML5-block parsing/rewriting and reference_map handling, hidden write-input flags and request-body wiring, fetch post-processing with externalization, tests, and updated documentation. ChangesHTML5 Block Support for Document Commands
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 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 |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@1b83ff40edb35e0586b455465b25e7e2008f0f14🧩 Skill updatenpx skills add larksuite/cli#codex/html5-block-resources -y -g |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1380 +/- ##
=======================================
Coverage 75.05% 75.05%
=======================================
Files 901 901
Lines 95391 95391
=======================================
Hits 71591 71591
Misses 18307 18307
Partials 5493 5493 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/doc/html5_block_resources_test.go`:
- Around line 305-306: Replace the substring-based assertion on err with typed
assertions: use errs.ProblemOf(err) to assert the problem-level fields (e.g.,
Category/Subtype match the expected "reference_map.html5-block.html5_1"), and
use errors.As(err, &ve) into a *errs.ValidationError (variable name like ve) to
assert Param equals the expected parameter and that the underlying cause is
preserved (compare ve.Cause or unwrap(err) to the original cause). Apply the
same pattern for the other checks in this test file (the cases around the checks
at the other mentioned locations) instead of relying on err.Error() substring
matching.
In `@shortcuts/doc/html5_block_resources.go`:
- Around line 187-189: The error message format string passed to
common.ValidationErrorf is missing its format argument; update the call in the
block that checks `out == nil` so the format string receives `label` (i.e., pass
`label` as an argument to common.ValidationErrorf("%s must be a JSON object",
label) while keeping the existing .WithParam(label) usage) so the formatted
message prints the label instead of `%!s(MISSING)`.
In `@skills/lark-doc/references/lark-doc-xml.md`:
- Around line 52-74: The heading "### HTML5 block / 外部 HTML" is using an h3 and
breaks the document hierarchy after the h1 "三、资源块"; change that heading marker
to h2 (use "## HTML5 block / 外部 HTML") so the section correctly nests under the
top-level resource section and preserves proper heading structure in the
document.
🪄 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
Run ID: aa3f74cb-27fa-4fd5-857e-bcd70b2ffab4
📒 Files selected for processing (12)
shortcuts/common/runner.goshortcuts/doc/docs_ai_result.goshortcuts/doc/docs_create_v2.goshortcuts/doc/docs_fetch_v2.goshortcuts/doc/docs_update_v2.goshortcuts/doc/html5_block_resources.goshortcuts/doc/html5_block_resources_test.goskills/lark-doc/SKILL.mdskills/lark-doc/references/lark-doc-create.mdskills/lark-doc/references/lark-doc-fetch.mdskills/lark-doc/references/lark-doc-update.mdskills/lark-doc/references/lark-doc-xml.md
c123880 to
86ecbd8
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 `@shortcuts/doc/html5_block_resources.go`:
- Around line 500-510: The fence detection only checks for backtick fences and
ignores tilde fences, causing HTML5-block tags inside ~~~ blocks to be
processed; update the loop that iterates over strings.SplitAfter(content, "\n")
(the block that uses inFence, flush(), and out.WriteString) to trim the line
into a variable (e.g., trimmed := strings.TrimSpace(line)) and treat a line
starting with either "```" or "~~~" as a fence opener/closer (i.e., if
strings.HasPrefix(trimmed, "```") || strings.HasPrefix(trimmed, "~~~") then
toggle inFence and call flush() when opening); optionally improve robustness by
recording which fence char opened the block and require the same char to close
it.
🪄 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
Run ID: 9ab82f18-c342-4d05-b076-eb36c40d6f77
📒 Files selected for processing (13)
shortcuts/common/runner.goshortcuts/doc/docs_ai_result.goshortcuts/doc/docs_create_v2.goshortcuts/doc/docs_fetch_v2.goshortcuts/doc/docs_fetch_v2_test.goshortcuts/doc/docs_update_v2.goshortcuts/doc/html5_block_resources.goshortcuts/doc/html5_block_resources_test.goskills/lark-doc/SKILL.mdskills/lark-doc/references/lark-doc-create.mdskills/lark-doc/references/lark-doc-fetch.mdskills/lark-doc/references/lark-doc-update.mdskills/lark-doc/references/lark-doc-xml.md
💤 Files with no reviewable changes (5)
- skills/lark-doc/references/lark-doc-fetch.md
- skills/lark-doc/references/lark-doc-xml.md
- skills/lark-doc/SKILL.md
- skills/lark-doc/references/lark-doc-create.md
- skills/lark-doc/references/lark-doc-update.md
🚧 Files skipped from review as they are similar to previous changes (6)
- shortcuts/doc/docs_fetch_v2.go
- shortcuts/doc/docs_ai_result.go
- shortcuts/common/runner.go
- shortcuts/doc/docs_create_v2.go
- shortcuts/doc/html5_block_resources_test.go
- shortcuts/doc/docs_update_v2.go
86ecbd8 to
3b3c462
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
skills/lark-doc/references/lark-doc-xml.md (1)
52-52:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix heading level to maintain proper document structure.
The heading jumps from h1 (line 39 "三、资源块") directly to h3. It should be h2 to maintain proper heading hierarchy.
📝 Proposed fix
-### HTML5 block / 外部 HTML +## HTML5 block / 外部 HTML🤖 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-xml.md` at line 52, The heading "### HTML5 block / 外部 HTML" is incorrectly at h3 and breaks the hierarchy after the h1 "三、资源块"; change that heading from h3 to h2 (i.e., replace the leading "###" with "##") so the section becomes "## HTML5 block / 外部 HTML" and restores proper document structure.
🧹 Nitpick comments (1)
skills/lark-doc/references/lark-doc-xml.md (1)
114-119: 💤 Low valueConsider whether user citation documentation belongs in this PR.
These additions document user citation rules but appear unrelated to the HTML5-block feature this PR is adding. While the content is valuable documentation, bundling unrelated changes can complicate PR review and git history.
If this is intentional consolidation of documentation improvements, consider noting it in the PR description for clarity.
🤖 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-xml.md` around lines 114 - 119, The new "用户名写入规则" section in skills/lark-doc/references/lark-doc-xml.md is unrelated to the HTML5-block feature in this PR; either move these user-citation documentation changes into a separate documentation-only PR or clearly call out in this PR description that it intentionally includes unrelated docs, so reviewers know it’s deliberate; locate the "## 用户名写入规则" heading and extract or split those bullet points into their own commit/PR or add a note to the PR description explaining the consolidation.
🤖 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.
Duplicate comments:
In `@skills/lark-doc/references/lark-doc-xml.md`:
- Line 52: The heading "### HTML5 block / 外部 HTML" is incorrectly at h3 and
breaks the hierarchy after the h1 "三、资源块"; change that heading from h3 to h2
(i.e., replace the leading "###" with "##") so the section becomes "## HTML5
block / 外部 HTML" and restores proper document structure.
---
Nitpick comments:
In `@skills/lark-doc/references/lark-doc-xml.md`:
- Around line 114-119: The new "用户名写入规则" section in
skills/lark-doc/references/lark-doc-xml.md is unrelated to the HTML5-block
feature in this PR; either move these user-citation documentation changes into a
separate documentation-only PR or clearly call out in this PR description that
it intentionally includes unrelated docs, so reviewers know it’s deliberate;
locate the "## 用户名写入规则" heading and extract or split those bullet points into
their own commit/PR or add a note to the PR description explaining the
consolidation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 87ed256a-a62f-430d-82cf-1f8518eca837
📒 Files selected for processing (13)
shortcuts/common/runner.goshortcuts/doc/docs_ai_result.goshortcuts/doc/docs_create_v2.goshortcuts/doc/docs_fetch_v2.goshortcuts/doc/docs_fetch_v2_test.goshortcuts/doc/docs_update_v2.goshortcuts/doc/html5_block_resources.goshortcuts/doc/html5_block_resources_test.goskills/lark-doc/SKILL.mdskills/lark-doc/references/lark-doc-create.mdskills/lark-doc/references/lark-doc-fetch.mdskills/lark-doc/references/lark-doc-update.mdskills/lark-doc/references/lark-doc-xml.md
✅ Files skipped from review due to trivial changes (3)
- skills/lark-doc/references/lark-doc-create.md
- skills/lark-doc/references/lark-doc-fetch.md
- skills/lark-doc/references/lark-doc-update.md
🚧 Files skipped from review as they are similar to previous changes (8)
- shortcuts/doc/docs_fetch_v2_test.go
- shortcuts/doc/docs_ai_result.go
- shortcuts/common/runner.go
- skills/lark-doc/SKILL.md
- shortcuts/doc/docs_update_v2.go
- shortcuts/doc/docs_create_v2.go
- shortcuts/doc/html5_block_resources_test.go
- shortcuts/doc/html5_block_resources.go
3b3c462 to
1fe89f3
Compare
PR Quality SummaryCI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun. Failed checksdeterministic-gate
|
711dfae to
29a284d
Compare
29a284d to
da237cc
Compare
53f4302 to
0942f5d
Compare
51a6c71 to
7d752ca
Compare
7d752ca to
1b83ff4
Compare
Summary
<html5-block path=\"@relative.html\"></html5-block>packaging and fetch-time large HTML materialization underdoc-fetch-resources.Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests