feat: configure initial base table schema#1377
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)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds ChangesCustom initial table schema for base creation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 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 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❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1377 +/- ##
==========================================
+ Coverage 71.47% 71.95% +0.47%
==========================================
Files 688 699 +11
Lines 65483 66285 +802
==========================================
+ Hits 46807 47695 +888
+ Misses 15031 14883 -148
- Partials 3645 3707 +62 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
One required fix before merge: When
When only
Because Verified locally:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@e54411ea96dcb9ffde82e92d154891b3bfe11ed4🧩 Skill updatenpx skills add zgz2048/cli#codex/base-create-initial-table-schema -y -g |
|
@kongenpei fixed in
I also added Validated with:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/base/base_create.go`:
- Around line 24-25: The command now performs table API calls when
--fields/--table-name are provided but the declared UserScopes and BotScopes
(symbols: UserScopes, BotScopes) only include base create permissions; update
those scope lists to also include "base:table:read", "base:table:create",
"base:table:update", and "base:table:delete" so preflight validates the actual
permissions needed, or alternatively implement a path-aware preflight check in
the base-create flow that inspects whether --fields/--table-name were passed and
validates those additional table scopes before calling CreateBase.
In `@shortcuts/base/base_ops.go`:
- Around line 37-68: The dryRunBaseCreate flow can trigger table APIs but the
shortcut's declared UserScopes/BotScopes (see base_create.go shortcut
definition) only include base:app:create; add the missing table scopes to avoid
post-create failures by expanding the shortcut's UserScopes and BotScopes to
include base:table:read, base:table:create, base:table:delete, and
base:table:update (alternatively implement path-specific scope addition when
runtime flags indicate --fields or --table-name), ensuring the shortcut
declaration (in the same place as the existing base:app:create entries
referenced by base_create.go) is updated accordingly.
🪄 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: 7a58c863-2d0b-44bd-9d52-4ff2310dbd93
📒 Files selected for processing (9)
shortcuts/base/base_create.goshortcuts/base/base_dryrun_ops_test.goshortcuts/base/base_execute_test.goshortcuts/base/base_ops.goshortcuts/base/base_shortcuts_test.goshortcuts/base/table_create.goshortcuts/base/table_ops.goskills/lark-base/SKILL.mdtests/cli_e2e/base/base_create_dryrun_test.go
Summary
+base-create --fieldssupport for configuring the initial table schema during Base creation.--table-namesupport for the initial table name, including compatibility behavior for table-name-only rename and fields-only default table nameTable 1.+table-create --fieldsto send fields directly in the create-table request body, matching OpenAPI support.--fields.Validation
make unit-testgo test ./tests/cli_e2e/base -run 'TestBaseCreateDryRun'\n-gofmt -l .\n-go vet ./...\n-go mod tidy && git diff --exit-code -- go.mod go.sum\n- Manual dry-run regression for four+base-createparameter combinations:\n - no--table-name, no--fields: onlyPOST /bases\n ---table-nameonly:POST /bases,GET /tables,PATCH /tables/:default_table_id\n ---fieldsonly:POST /bases,GET /tables,POST /tableswithname: Table 1,DELETE default table\n - both--table-nameand--fields:POST /bases,GET /tables,POST /tableswith passed table name and fields,DELETE default table\n\n## Known Check Failure\n\n-go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6 run --new-from-rev=origin/maincurrently fails on existing unrelated depguard/forbidigo findings in files not touched by this PR, includingcmd/auth/qrcode.go,cmd/config/*,shortcuts/event/pipeline.go,shortcuts/mail/*, andshortcuts/minutes/minutes_download.go.\nSummary by CodeRabbit
New Features
Documentation
Tests