fix(doc): warn on markdown heading numbering loss - #1819
Conversation
📝 WalkthroughWalkthroughAdds a new warning emitted by ChangesMarkdown heading seq/seq-level loss warning
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
🧹 Nitpick comments (1)
shortcuts/doc/docs_fetch_v2_test.go (1)
709-753: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding a pretty-mode assertion for the heading seq warning.
The new test covers JSON output, but the pretty-mode stderr path for the heading seq warning is not explicitly asserted anywhere. The existing
TestDocsFetchMarkdownDetailDowngradeWarnsInPrettyOutput(line 756) exercises--doc-format markdown --format prettyand now receives both warnings in stderr, but only checks for the downgrade warning strings. Per coding guidelines, every behavior change needs a test alongside the change — consider adding an assertion for the heading seq warning in that test or adding a dedicated pretty-mode test.🤖 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/doc/docs_fetch_v2_test.go` around lines 709 - 753, Add pretty-mode coverage for the heading sequence warning in the docs fetch tests. Update TestDocsFetchMarkdownDetailDowngradeWarnsInPrettyOutput, or add a dedicated pretty-output test, so it asserts stderr includes the new heading seq warning emitted by DocsFetch/mountAndRunDocs when --doc-format markdown --format pretty is used. Keep the existing downgrade-warning checks and extend them to validate the warning text from the heading sequence loss path.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/doc/docs_fetch_v2_test.go`:
- Around line 709-753: Add pretty-mode coverage for the heading sequence warning
in the docs fetch tests. Update
TestDocsFetchMarkdownDetailDowngradeWarnsInPrettyOutput, or add a dedicated
pretty-output test, so it asserts stderr includes the new heading seq warning
emitted by DocsFetch/mountAndRunDocs when --doc-format markdown --format pretty
is used. Keep the existing downgrade-warning checks and extend them to validate
the warning text from the heading sequence loss path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 373f40cc-4421-4c63-878b-ad50891b3c13
📒 Files selected for processing (3)
shortcuts/doc/docs_fetch_v2.goshortcuts/doc/docs_fetch_v2_test.goskills/lark-doc/references/lark-doc-fetch.md
Summary
Warn callers when
docs +fetch --doc-format markdownorim-markdowncannot preserve headingseq/seq-levelmetadata, so agents know to fetch XML when numbering fidelity matters.Changes
Test Plan
GOCACHE=$PWD/.cache/go-build GOPROXY=https://goproxy.cn,direct go test ./shortcuts/doc -count=1GOCACHE=$PWD/.cache/go-build GOPROXY=https://goproxy.cn,direct go build -o ./lark-cli .LARK_CLI_BIN=$PWD/lark-cli GOCACHE=$PWD/.cache/go-build GOPROXY=https://goproxy.cn,direct go test ./tests/cli_e2e/docs -run 'TestDocs_DryRunDefaultsToV2OpenAPI' -count=1git diff --checkRelated Issues
Summary by CodeRabbit