fix(apps): read app object from data.app for +create and +update#1087
Conversation
|
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)
📝 WalkthroughWalkthroughCreate/update commands, tests, and documentation were updated so application objects are returned under ChangesApps API Response Structure Update
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
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 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 #1087 +/- ##
==========================================
+ Coverage 67.85% 67.87% +0.02%
==========================================
Files 592 592
Lines 55373 55368 -5
==========================================
+ Hits 37574 37582 +8
+ Misses 14685 14674 -11
+ Partials 3114 3112 -2 ☔ 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@ec98eee38158d3f723bdff449083431a436d4bdd🧩 Skill updatenpx skills add larksuite/cli#fix/apps-response-app-wrapper -y -g |
a3858b3 to
55f5858
Compare
The Miaoda OpenAPI returns the application object nested under
data.app for both POST /apps and PATCH /apps/{appId}. The CLI text
helper was reading common.GetString(data, "app_id"), which yields an
empty string against the wire format -- so `lark-cli apps +create
--format pretty` printed `created: ` with no ID.
Navigate the new nested path via GetString(data, "app", "app_id") for
both create and update. Update unit-test mocks to wrap the response
under `app`. Refresh the lark-apps skill references (example response
shape + jq paths) so agents reading them follow the right path.
Wire format is passed through to the user's JSON envelope untouched
-- no unwrapping in CLI. Consumers reading the response should use
.data.app.app_id.
The GET /apps list endpoint is unchanged: per the design doc its
items[] are flat objects, no wrapper.
55f5858 to
d743870
Compare
The "用户没有 app_id" snippet in lark-apps-html-publish.md was missing
the required --app-type flag, so copy-pasting it triggered Validate
("--app-type is required") and left $APP empty -- the following
+html-publish then failed with --app-id "". Bring the snippet in line
with every other apps +create example in the skill.
Every apps shortcut declares Scopes, so the precheck path in shortcuts/common/runner.go:825 is always the one that fires on scope violations and the envelope's error.type is the stable discriminator. Drop the keyword-sniffing of error.hint, the chain explanation, and the bot caveat — they all reduce to one boolean: error.type == "missing_scope" → run `lark-cli auth login --domain apps`. Also collapse the corresponding bullet in 快速决策 to point at this rule.
Summary
The Miaoda OpenAPI returns the application object nested under
data.appfor bothPOST /apps(create) andPATCH /apps/{appId}(update), per the design doc. The CLI text helper was readingcommon.GetString(data, "app_id"), which yields an empty string against the wire format — solark-cli apps +create --format prettyprintedcreated:with no ID. Same defect on update.Changes
shortcuts/apps/apps_create.go,shortcuts/apps/apps_update.go: navigate the new nested path viacommon.GetString(data, "app", "app_id").shortcuts/apps/apps_create_test.go,shortcuts/apps/apps_update_test.go: wrap the mock response underappto match the wire shape.skills/lark-apps/references/lark-apps-create.md,.../lark-apps-update.md: update the example response with theappwrapper, plus a note about the new field path so agents readdata.app.app_id.skills/lark-apps/references/lark-apps-html-publish.md: update the jq path in scenario 2 from.data.app_idto.data.app.app_id.Wire format is passed through to the user's JSON envelope untouched — no unwrapping in CLI. Consumers reading the response should use
.data.app.app_id.The
GET /appslist endpoint (apps_list.go) is unchanged: per the design doc itsitems[]are flat objects, no wrapper.Test Plan
go test ./shortcuts/apps/ ./tests/cli_e2e/apps/passesgo vet ./...cleangofmt -l shortcuts/apps/cleanapps +create --help/apps +update --helpregister without flag changesTestAppsCreate_Success,TestAppsCreate_WithIconURL,TestAppsUpdate_Success,TestAppsUpdate_TrimsAppIDInPath) updated to the new mock shape and passRelated Issues
Summary by CodeRabbit
Bug Fixes
Documentation
Tests