fix(wiki): guide recovery from node layer limits - #2290
Conversation
📝 WalkthroughWalkthroughWiki node creation now handles layer-limit error ChangesWiki layer-limit recovery
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
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/wiki/wiki_node_create_test.go`:
- Around line 1026-1064: Extend the regression tests for the recovery paths that
append hints: in shortcuts/wiki/wiki_node_create_test.go lines 1026-1064, seed
limitErr with an upstream Problem.Hint and assert the resulting hint is
"<upstream hint>\n"+wikiNodeCreateLayerLimitHint; in
shortcuts/doc/docs_create_test.go lines 403-421, seed err similarly and assert
"<upstream hint>\n"+docsCreateWikiLayerLimitHint. Update both affected test
sites; no production-code change is requested.
🪄 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: baa77278-badf-446c-ae9f-219d31ef2e0f
📒 Files selected for processing (6)
shortcuts/doc/docs_create_test.goshortcuts/doc/docs_create_v2.goshortcuts/wiki/wiki_node_create.goshortcuts/wiki/wiki_node_create_test.goskills/lark-doc/references/lark-doc-create.mdskills/lark-wiki/references/lark-wiki-node-create.md
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@e1ba45832651857c58a0c228e27310f4aa9f3731🧩 Skill updatenpx skills add larksuite/cli#fix/wiki-node-layer-limit-guidance -y -g |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2290 +/- ##
=======================================
Coverage 76.46% 76.47%
=======================================
Files 1013 1013
Lines 112034 112089 +55
=======================================
+ Hits 85665 85715 +50
- Misses 19857 19860 +3
- Partials 6512 6514 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e9a2092 to
e686230
Compare
e686230 to
d285563
Compare
d285563 to
e1ba458
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
shortcuts/wiki/wiki_node_create_test.go (2)
1055-1064: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert that the classified
Subtypeis populated.The test checks
Category,Code,Retryable,Hint, and the cause. It does not checkproblem.Subtype. A regression that drops subtype metadata would still pass. Assert thatproblem.Subtypeis non-empty without requiring a domain-specific subtype constant.Based on learnings, shortcut error-path tests should verify a populated
Subtypewhile assertingCategory == errs.CategoryAPIinstead of depending on a layer-specific subtype constant. As per coding guidelines, error tests must assert typed metadata and cause preservation rather than message text alone.Proposed assertion
if !ok { t.Fatalf("error = %T, want typed problem", err) } + if problem.Subtype == "" { + t.Fatalf("problem subtype is empty") + } if problem.Category != errs.CategoryAPI || problem.Code != wikiNodeCreateStructuralLimitCode || problem.Retryable {🤖 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/wiki/wiki_node_create_test.go` around lines 1055 - 1064, Extend the assertions in the wiki node creation error test after errs.ProblemOf to require that problem.Subtype is non-empty, while keeping the existing CategoryAPI, code, retryability, hint, and cause checks unchanged; do not require a domain-specific subtype constant.Sources: Coding guidelines, Learnings
1028-1031: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winPin the upstream code independently from the production constant.
wikiNodeCreateStructuralLimitCodesupplies both the simulated upstream code and the expected code. If the production constant changes from131003, this test changes with it and still passes. Define a test-localconst upstreamCode = 131003and use it for both values.The PR objective defines
131003as the fixed upstream code.Proposed test hardening
const upstreamHint = "upstream recovery hint" + const upstreamCode = 131003 limitErr := errs.NewAPIError(errs.SubtypeUnknown, "opaque upstream message"). - WithCode(wikiNodeCreateStructuralLimitCode). + WithCode(upstreamCode). ... - if problem.Category != errs.CategoryAPI || problem.Code != wikiNodeCreateStructuralLimitCode || problem.Retryable { + if problem.Category != errs.CategoryAPI || problem.Code != upstreamCode || problem.Retryable {Also applies to: 1059-1060
🤖 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/wiki/wiki_node_create_test.go` around lines 1028 - 1031, Define a test-local constant such as upstreamCode with the fixed value 131003, and use it both when constructing the simulated API error and when asserting the expected upstream code in the affected wiki node creation tests. Stop using wikiNodeCreateStructuralLimitCode for either test value so changes to the production constant cannot make these tests pass incorrectly.
🤖 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/wiki/wiki_node_create_test.go`:
- Around line 1055-1064: Extend the assertions in the wiki node creation error
test after errs.ProblemOf to require that problem.Subtype is non-empty, while
keeping the existing CategoryAPI, code, retryability, hint, and cause checks
unchanged; do not require a domain-specific subtype constant.
- Around line 1028-1031: Define a test-local constant such as upstreamCode with
the fixed value 131003, and use it both when constructing the simulated API
error and when asserting the expected upstream code in the affected wiki node
creation tests. Stop using wikiNodeCreateStructuralLimitCode for either test
value so changes to the production constant cannot make these tests pass
incorrectly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 467c436a-5d5f-4f3b-aa56-75396b1daa73
📒 Files selected for processing (3)
shortcuts/wiki/wiki_node_create.goshortcuts/wiki/wiki_node_create_test.goskills/lark-wiki/references/lark-wiki-node-create.md
🚧 Files skipped from review as they are similar to previous changes (2)
- shortcuts/wiki/wiki_node_create.go
- skills/lark-wiki/references/lark-wiki-node-create.md
Summary
131003as a non-retryable, command-specific node layer limit forwiki +node-createwiki +node-createreference and cover metadata, cause preservation, no-retry behavior, and upstream hint preservationTesting
go test ./shortcuts/wiki/...node scripts/skill-format-check/index.jsgit diff --checkSummary by CodeRabbit
Bug Fixes
Documentation