fix(base): resolve Base URL block types accurately - #2099
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
ChangesBase URL block selection
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant BaseURLResolve
participant WikiNodeAPI
participant BaseBlocksAPI
CLI->>BaseURLResolve: resolve Base or Wiki URL
BaseURLResolve->>WikiNodeAPI: resolve Wiki node
WikiNodeAPI-->>BaseURLResolve: return base token
BaseURLResolve->>BaseBlocksAPI: list and match selected block
BaseBlocksAPI-->>BaseURLResolve: return block type and identifiers
BaseURLResolve-->>CLI: return enriched resolution output
Possibly related PRs
Suggested labels: 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 |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@67b1aa188a89d0c4cc2c97246e4ac1aac0f57b03🧩 Skill updatenpx skills add zhouyue-bytedance/cli#fix/base-url-resolve-block-selection -y -g |
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/base/base_resolve.go`:
- Around line 425-501: Update resolveSelectedBaseBlock to paginate the
blocks/list response through all available pages before returning found=false,
using the existing pagination helper or an empty page_token loop. Preserve
matching by selectedBlockID across every page, and let enrichBaseResolveHint
reach listAllFields only after block pagination is exhausted.
🪄 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 Plus
Run ID: d2314aac-f2a7-4779-adc2-b2bd5eff32cf
📒 Files selected for processing (5)
shortcuts/base/base_resolve.goshortcuts/base/base_resolve_test.goskills/lark-base/SKILL.mdtests/cli_e2e/base/base_basic_workflow_test.gotests/cli_e2e/base/base_url_resolve_dryrun_test.go
b3e5e0d to
6e32c9d
Compare
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 `@skills/lark-base/references/lark-base-data-query.md`:
- Around line 86-88: Specify the `text` language on the fenced code block
containing the Lark Base URL example, preserving the URL content unchanged.
🪄 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 Plus
Run ID: c021f4b5-b4d4-425f-9a16-eec2ec6f766b
📒 Files selected for processing (3)
shortcuts/base/base_resolve.goshortcuts/base/base_resolve_test.goskills/lark-base/references/lark-base-data-query.md
🚧 Files skipped from review as they are similar to previous changes (2)
- shortcuts/base/base_resolve_test.go
- shortcuts/base/base_resolve.go
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/base/base_resolve_test.go`:
- Around line 99-106: Update the “field endpoint does not confirm untyped block”
test to register a successful blocks-list stub whose response omits tbl123,
while retaining the existing field endpoint guard. Assert the result remains
unconfirmed, covering the successful-but-nonmatching lookup path rather than
only an unavailable lookup.
🪄 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 Plus
Run ID: abf448ef-19e3-4441-ace9-0dd7beffb821
📒 Files selected for processing (3)
internal/httpmock/registry.goshortcuts/base/base_resolve.goshortcuts/base/base_resolve_test.go
💤 Files with no reviewable changes (1)
- shortcuts/base/base_resolve.go
Summary
Fix
base +url-resolveso the Base UI'stable=query parameter is treated as a selected top-level block rather than assumed to be a data table. The resolver now identifies table, dashboard, and workflow blocks for both direct Base URLs and Wiki-wrapped Base URLs.Changes
table_id,dashboard_id, orworkflow_id.block_idoutput and actionable hints when the block type cannot be confirmed, while retaining a field-list fallback for compatible table resolution.view_idandrecord_idonly when the selected block is confirmed to be a table.Test Plan
make unit-test)lark-cli base +url-resolveflow works as expected for direct Base and Wiki URLsmake buildgo vet ./...go test ./tests/cli_e2e/base -count=1golangci-lint v2.1.6 run --new-from-rev=origin/mainRelated Issues
Summary by CodeRabbit
base +url-resolveto treattable=as a selected top-level Base/Wiki block id and return correctblock_id/block_type, plus table/view/record identifiers only after confirmation.base_urlandwiki_urlacross multiple block types.table=isn’t atable_id; follow the confirmation/next-step rules based onblock_typeand neutral selections.