Skip to content

fix(base): resolve Base URL block types accurately - #2099

Merged
zhouyue-bytedance merged 6 commits into
larksuite:mainfrom
zhouyue-bytedance:fix/base-url-resolve-block-selection
Jul 30, 2026
Merged

fix(base): resolve Base URL block types accurately#2099
zhouyue-bytedance merged 6 commits into
larksuite:mainfrom
zhouyue-bytedance:fix/base-url-resolve-block-selection

Conversation

@zhouyue-bytedance

@zhouyue-bytedance zhouyue-bytedance commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix base +url-resolve so the Base UI's table= 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

  • Resolve selected block metadata through the Base block-list API and return the type-specific table_id, dashboard_id, or workflow_id.
  • Preserve neutral block_id output and actionable hints when the block type cannot be confirmed, while retaining a field-list fallback for compatible table resolution.
  • Resolve Wiki nodes before classifying their selected Base block, and expose the two-step request in dry-run output.
  • Keep view_id and record_id only when the selected block is confirmed to be a table.
  • Update Base skill guidance and add unit, dry-run E2E, and workflow coverage.

Test Plan

  • Unit tests pass (make unit-test)
  • Manual local verification confirms the lark-cli base +url-resolve flow works as expected for direct Base and Wiki URLs
  • make build
  • go vet ./...
  • go test ./tests/cli_e2e/base -count=1
  • golangci-lint v2.1.6 run --new-from-rev=origin/main

Related Issues

  • None

Summary by CodeRabbit

  • New Features
    • Enhanced base +url-resolve to treat table= as a selected top-level Base/Wiki block id and return correct block_id/block_type, plus table/view/record identifiers only after confirmation.
    • Updated selection-aware hinting for base_url and wiki_url across multiple block types.
  • Documentation
    • Clarified URL parsing guidance: table= isn’t a table_id; follow the confirmation/next-step rules based on block_type and neutral selections.
  • Tests
    • Expanded Base/Wiki URL resolution assertions and added e2e dry-run coverage for selected-block behavior.
  • Chores
    • Improved HTTP mocking verification to ignore optional stubs.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

base +url-resolve now resolves selected Base blocks from Base and Wiki URLs, returns block-specific identifiers, enriches hints by block type, expands dry-run API tracing, and adds unit, integration, end-to-end, mock, and documentation coverage.

Changes

Base URL block selection

Layer / File(s) Summary
Selection contract and resolution
shortcuts/base/base_resolve.go
Adds the block-read scope, treats table as a block ID, resolves selected blocks for Base and Wiki URLs, and emits block-based coordinates.
Block-specific output and hints
shortcuts/base/base_resolve.go
Applies URL selections and generates type-specific hints while withholding table-only identifiers until the block type is confirmed.
Resolution validation and usage guidance
shortcuts/base/base_resolve_test.go, tests/cli_e2e/base/*, skills/lark-base/*, internal/httpmock/registry.go
Validates block types, coordinates, dry-run requests, end-to-end resolution, optional HTTP stubs, and updated URL semantics.

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
Loading

Possibly related PRs

  • larksuite/cli#401: Extends the Base workflow end-to-end coverage introduced by this change.
  • larksuite/cli#1338: Modifies the related base +url-resolve coordinate and enrichment behavior.
  • larksuite/cli#2078: Changes the related base +url-resolve validation and resolution flow.

Suggested labels: domain/base, size/L

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: Base URL block type resolution.
Description check ✅ Passed The description matches the template with Summary, Changes, Test Plan, and Related Issues filled in.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added domain/base PR touches the base domain size/M Single-domain feat or fix with limited business impact labels Jul 29, 2026
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@67b1aa188a89d0c4cc2c97246e4ac1aac0f57b03

🧩 Skill update

npx skills add zhouyue-bytedance/cli#fix/base-url-resolve-block-selection -y -g

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between c7adff7 and b3e5e0d.

📒 Files selected for processing (5)
  • shortcuts/base/base_resolve.go
  • shortcuts/base/base_resolve_test.go
  • skills/lark-base/SKILL.md
  • tests/cli_e2e/base/base_basic_workflow_test.go
  • tests/cli_e2e/base/base_url_resolve_dryrun_test.go

Comment thread shortcuts/base/base_resolve.go
@zhouyue-bytedance
zhouyue-bytedance force-pushed the fix/base-url-resolve-block-selection branch from b3e5e0d to 6e32c9d Compare July 29, 2026 12:16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6e32c9d and 4e15a9f.

📒 Files selected for processing (3)
  • shortcuts/base/base_resolve.go
  • shortcuts/base/base_resolve_test.go
  • skills/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

Comment thread skills/lark-base/references/lark-base-data-query.md Outdated
Comment thread shortcuts/base/base_resolve.go
Comment thread shortcuts/base/base_resolve.go Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4e15a9f and 0fec54b.

📒 Files selected for processing (3)
  • internal/httpmock/registry.go
  • shortcuts/base/base_resolve.go
  • shortcuts/base/base_resolve_test.go
💤 Files with no reviewable changes (1)
  • shortcuts/base/base_resolve.go

Comment thread shortcuts/base/base_resolve_test.go
@zhouyue-bytedance
zhouyue-bytedance merged commit 4a16139 into larksuite:main Jul 30, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/base PR touches the base domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants