fix(wiki): surface real node url for +node-create / +node-copy#960
Conversation
The create-node and copy-node OpenAPI responses carry a real `url` field (present in practice though absent from the documented schema). Both shortcuts ignored it: +node-create synthesized a link via BuildResourceURL, and +node-copy emitted no URL at all. Parse `url` into the shared wikiNodeRecord and add a wikiNodeURL helper that prefers the response url, falling back to BuildResourceURL only when it is blank. Wire +node-create and +node-copy to the helper so both surface the canonical link when available. Change-Id: I0ca5f91b02c24e81d083793e6a8e4f8c966aeec3
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR surfaces server-provided wiki node URLs in create and copy outputs by adding a ChangesWiki Node URL Propagation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #960 +/- ##
==========================================
+ Coverage 66.93% 67.03% +0.09%
==========================================
Files 568 570 +2
Lines 52970 53519 +549
==========================================
+ Hits 35458 35875 +417
- Misses 14581 14649 +68
- Partials 2931 2995 +64 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@13ca095f8a4e9c24b97ed84e587582ae57f6183c🧩 Skill updatenpx skills add larksuite/cli#fix/wiki-node-url -y -g |
fangshuyu-768
left a comment
There was a problem hiding this comment.
Review Summary
This is a clean, well-scoped fix. The wikiNodeURL helper correctly prioritizes the real API response URL over the synthesized fallback, and the test coverage is solid.
A few suggestions below — none are blocking.
Verdict: LGTM (after confirming the type compatibility question on wiki_node_copy.go).
The helper is consumed by both +node-create and +node-copy, so its placement should reflect the broader usage rather than living in the create command's file. Pure move; no behavior change. Change-Id: I9990c12da042f631fe2519911c6a9d663fd5c22b
…uite#960) * fix(wiki): surface real node url for +node-create / +node-copy The create-node and copy-node OpenAPI responses carry a real `url` field (present in practice though absent from the documented schema). Both shortcuts ignored it: +node-create synthesized a link via BuildResourceURL, and +node-copy emitted no URL at all. Parse `url` into the shared wikiNodeRecord and add a wikiNodeURL helper that prefers the response url, falling back to BuildResourceURL only when it is blank. Wire +node-create and +node-copy to the helper so both surface the canonical link when available. Change-Id: I0ca5f91b02c24e81d083793e6a8e4f8c966aeec3 * refactor(wiki): move wikiNodeURL to shared wiki_helpers.go The helper is consumed by both +node-create and +node-copy, so its placement should reflect the broader usage rather than living in the create command's file. Pure move; no behavior change. Change-Id: I9990c12da042f631fe2519911c6a9d663fd5c22b
Summary
The create-node and copy-node OpenAPI responses carry a real
urlfield (present in practice, even though it is not in Feishu's documented node schema). Both shortcuts ignored it:+node-createsynthesized a link viaBuildResourceURL(host +/wiki/+ token).+node-copyemitted no URL at all.This change makes both shortcuts prefer the canonical URL returned by the API:
urlinto the sharedwikiNodeRecord.wikiNodeURL(brand, node)helper that returns the responseurlwhen present and falls back toBuildResourceURLsynthesis only when it is blank/absent.augmentWikiNodeCreateOutput(+node-create) and+node-copyoutput/pretty rendering to the helper.+node-get/+space-createare intentionally untouched — they build their own output maps and deliberately omit URL, so the new struct field does not leak into them.Test plan
go test ./shortcuts/wiki/...passesgofmtclean,go vet ./shortcuts/...clean./build.shsucceeds+node-createe2e test: mock returns a realurl; asserts it wins over synthesized fallback+node-copye2e test: mock returns a realurl; asserts copy surfaces itTestWikiNodeURLcovering prefer-response / fallback / blank / nil / no-tokengolangci-lintnot run locally (not installed); relying on CISummary by CodeRabbit
New Features
Tests