Skip to content

fix(base): improve dashboard shortcut guidance#1787

Merged
zhouyue-bytedance merged 12 commits into
larksuite:mainfrom
zhouyue-bytedance:dashboard-review-fixes-pr
Jul 16, 2026
Merged

fix(base): improve dashboard shortcut guidance#1787
zhouyue-bytedance merged 12 commits into
larksuite:mainfrom
zhouyue-bytedance:dashboard-review-fixes-pr

Conversation

@zhouyue-bytedance

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

Copy link
Copy Markdown
Collaborator

Summary

Bring the GitHub PR in line with the current branch diff against local main while excluding harness/ and downloads/. This improves Base dashboard shortcut affordances, dry-run coverage, and agent guidance for dashboard/funnel workflows.

Changes

  • Add hidden compatibility/alias support for Base record listing and dashboard block get-data flows.
  • Improve dashboard shortcut examples, reference-map links, and data-config guidance.
  • Clarify cumulative funnel guidance and one-shot sort configuration for helper-table charts.
  • Keep tests scoped to current source behavior; removed stale/extra tests that no longer had matching source changes.

Test Plan

  • Unit tests pass (full make unit-test not run)
  • go test ./shortcuts/base -count=1
  • go build -buildvcs=false -trimpath -o lark-cli .
  • go test ./tests/cli_e2e/base -run 'TestBaseDashboardBlockGetDataDryRun' -count=1

Related Issues

  • None

Summary by CodeRabbit

  • 新功能
    • 记录列表新增隐藏别名 --field-names(与 --field-id 互斥);并支持别名场景下字段回显更一致。
    • +dashboard-block-get-data 接受但忽略 --dashboard-id(兼容)。
  • 改进
    • 仪表盘创建指引更清晰:优先用 data_config--dry-run 用于校验/排错;arrange 仅在需要时使用。
    • 漏斗/分阶段图首次创建可直接设置 group_by.sort 保序;并强化 sortsort.order 的约束与校验(含默认与非法值处理)。
  • 文档
    • 漏斗模板口径升级为“双口径(当前 vs 累计)”,累计无现成字段时会先汇总再绘图。
  • 测试
    • 补充/扩展 dry-run、别名互斥、帮助提示与排序校验的用例。

@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 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 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

本次更新规范化仪表盘排序配置,补充漏斗图与仪表盘创建指导,为 get-data 增加兼容参数,并为记录列表加入 --field-names 别名及对应校验和测试。

Changes

仪表盘排序与创建指导

Layer / File(s) Summary
数据配置排序规范化
shortcuts/base/helpers.go, shortcuts/base/base_dashboard_execute_test.go, skills/lark-base/references/dashboard-block-data-config.md, skills/lark-base/references/lark-base-dashboard.md
group/view 排序缺少方向时补全 ascvalue 排序要求显式方向,非法值产生带 --data-config 参数的校验错误;文档补充双口径漏斗模板、首次创建排序规则及仪表盘创建校验流程。
仪表盘命令指导与兼容参数
shortcuts/base/dashboard_block_create.go, shortcuts/base/record_batch_create.go, shortcuts/base/dashboard_block_get_data.go, tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go, shortcuts/base/base_shortcuts_test.go
仪表盘创建和批量写入提示得到补充;get-data 接受被忽略的隐藏 --dashboard-id 参数,并增加 dry-run 覆盖。

记录列表参数别名

Layer / File(s) Summary
记录列表字段别名与验证
shortcuts/base/record_list.go, shortcuts/base/record_ops.go, shortcuts/base/base_shortcuts_test.go, shortcuts/base/base_execute_test.go, shortcuts/base/base_dryrun_ops_test.go
BaseRecordList 支持隐藏的 --field-names,将字段名称映射为请求字段,并拒绝与 --field-id 同时使用;测试覆盖字段选择、输出、dry-run 查询参数及冲突校验。

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: kongenpei

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% 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 dashboard shortcut guidance changes.
Description check ✅ Passed The description includes the required Summary, Changes, Test Plan, and Related Issues sections and is mostly complete.
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.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
skills/lark-base/references/dashboard-block-data-config.md (1)

285-295: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fix the current-stage funnel template to use count_all.

The “当前阶段分布” example still shows a series aggregation, but the surrounding text says this path should use count_all:true. That contradicts the documented series/count_all contract and sends users to the wrong payload shape.

🔧 Proposed fix
 {
   "table_name": "表名",
-  "series": [{ "field_name": "数值字段", "rollup": "SUM" }],
+  "count_all": true,
   "group_by": [{ "field_name": "状态字段", "mode": "integrated" }]
 }
🤖 Prompt for 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.

In `@skills/lark-base/references/dashboard-block-data-config.md` around lines 285
- 295, The “当前阶段分布” example in the dashboard block data config is using the
wrong payload shape: it shows a series aggregation even though this path is
supposed to use count_all:true. Update the funnel template in the current-stage
section to match the documented contract by removing the series-based example
and showing the count_all form, keeping group_by with the状态字段 so users copy the
correct low-cost stage-count payload.
🧹 Nitpick comments (1)
tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go (1)

62-142: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

File name no longer matches contents.

This file is named base_dashboard_block_get_data_dryrun_test.go, but now also holds TestBaseDashboardBlockWriteDryRun covering create/update/delete. Consider moving the write test to a separate file (e.g., base_dashboard_block_write_dryrun_test.go) for clearer file-to-test-suite mapping.

🤖 Prompt for 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.

In `@tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go` around lines
62 - 142, The file name no longer matches the test content: this file now
contains TestBaseDashboardBlockWriteDryRun for create/update/delete rather than
only get-data dry-run coverage. Move the write dry-run test group out of the
current file into a more appropriate test file such as a dashboard-block-write
dry-run test, and keep the existing get-data dry-run tests in the file that
matches their behavior so the suite-to-file mapping stays clear.
🤖 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 `@tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go`:
- Around line 86-91: The create subtest for base dashboard block dry-run is
missing assertions for the request-body fields passed via --name and
--data-config, so update that test to verify the generated payload includes both
the Unicode name and the data-config content. Use the existing dry-run output
checks in base_dashboard_block_get_data_dryrun_test.go, and add assertions
alongside the current method, dashboard_id, and type checks so the create path
in the CLI confirms both fields are serialized correctly.

---

Outside diff comments:
In `@skills/lark-base/references/dashboard-block-data-config.md`:
- Around line 285-295: The “当前阶段分布” example in the dashboard block data config
is using the wrong payload shape: it shows a series aggregation even though this
path is supposed to use count_all:true. Update the funnel template in the
current-stage section to match the documented contract by removing the
series-based example and showing the count_all form, keeping group_by with
the状态字段 so users copy the correct low-cost stage-count payload.

---

Nitpick comments:
In `@tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go`:
- Around line 62-142: The file name no longer matches the test content: this
file now contains TestBaseDashboardBlockWriteDryRun for create/update/delete
rather than only get-data dry-run coverage. Move the write dry-run test group
out of the current file into a more appropriate test file such as a
dashboard-block-write dry-run test, and keep the existing get-data dry-run tests
in the file that matches their behavior so the suite-to-file mapping stays
clear.
🪄 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: 8eaf0ffe-e208-418f-adcd-172e7d31fefa

📥 Commits

Reviewing files that changed from the base of the PR and between f495cbb and b56f2c2.

📒 Files selected for processing (3)
  • skills/lark-base/references/dashboard-block-data-config.md
  • skills/lark-base/references/lark-base-dashboard.md
  • tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go

Comment thread tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go Outdated
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@3092ea7d3dc7fcae8db365ecc2a15e608cc5cd54

🧩 Skill update

npx skills add zhouyue-bytedance/cli#dashboard-review-fixes-pr -y -g

@zhouyue-bytedance
zhouyue-bytedance force-pushed the dashboard-review-fixes-pr branch from b56f2c2 to 5657b5f Compare July 8, 2026 02:48
@zhouyue-bytedance zhouyue-bytedance changed the title docs(base): clarify dashboard funnel guidance fix(base): improve dashboard shortcut guidance Jul 8, 2026

@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: 2

♻️ Duplicate comments (1)
tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go (1)

92-117: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Create subtest still missing name and data-config assertions.

This was flagged in a prior review and remains unresolved. The update subtest correctly asserts "text": "库存说明" (line 142), but the create subtest supplies --name "订单趋势" and --data-config '{"table_name":"订单表","count_all":true}' without asserting either in the output, leaving request-body construction unverified.

✅ Suggested additional assertions
 		assert.Contains(t, output, `"type": "column"`)
+		assert.Contains(t, output, `"name": "订单趋势"`)
+		assert.Contains(t, output, `"table_name": "订单表"`)
 	})
🤖 Prompt for 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.

In `@tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go` around lines
92 - 117, The create subtest in base_dashboard_block_get_data_dryrun_test.go
still does not verify the request body fields for --name and --data-config.
Update the create case in TestBaseDashboardBlockGetDataDryRun to assert the
dry-run output contains the expected name value ("订单趋势") and the serialized
data-config content from the request, alongside the existing checks on the POST
endpoint and dashboard/type fields, so the request construction is fully
covered.
🧹 Nitpick comments (2)
shortcuts/base/helpers.go (1)

1141-1143: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Validation message may be misleading after normalization.

Since normalizeDataConfig silently defaults order to "asc" for group/view types before validation runs, the error message at line 1142 ("sort 存在时必须设置 order") will only ever fire for type=value with a missing order. The message implies order is universally required, but for group/view it's auto-filled. Consider clarifying the message to reflect that this only applies when type=value, or add a note that group/view default to asc.

🤖 Prompt for 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.

In `@shortcuts/base/helpers.go` around lines 1141 - 1143, The validation text in
the group_by sort order check is misleading because normalizeDataConfig already
defaults order to asc for group/view before validation. Update the error message
in the sort validation path in helpers.go (the branch that checks o == "" and o
!= "asc"/"desc") so it clearly states the requirement only applies to
type=value, or explicitly note that group/view default to asc; keep the message
aligned with the actual behavior in normalizeDataConfig and the group_by
validation logic.
shortcuts/base/record_list.go (1)

86-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider a hidden-flag test for --field-names, mirroring TestBaseRecordListJSONAliasIsHidden.

The PR adds a dedicated test verifying --json stays hidden from help output, but there's no equivalent assertion for --field-names. Since both are meant to be hidden aliases, a regression hiding one but not the other would go undetected.

🤖 Prompt for 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.

In `@shortcuts/base/record_list.go` around lines 86 - 93, Add a hidden-flag test
for the `recordListFieldNamesAliasFlag` alias so it is covered the same way as
`TestBaseRecordListJSONAliasIsHidden`. Extend the existing shortcut flag tests
in the record list area to assert that `--field-names` remains hidden from help
output and is treated as a hidden alias for `--field-id`, using the existing
`common.Flag`/`recordListFieldNamesAliasFlag` symbol to locate the change.
🤖 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/helpers.go`:
- Around line 1041-1053: Add tests in normalizeDataConfig coverage to verify
sort.order defaults correctly for sort type group and view, and remains unset
for value. Update helpers_test.go with cases that exercise the sort handling
logic in normalizeDataConfig, asserting sub["order"] becomes asc only when
sub["type"] is group or view and no order is provided, and that the value path
does not introduce an order default.

In `@shortcuts/base/record_list.go`:
- Around line 109-123: The mutual-exclusivity check in
normalizeRecordListJSONAlias is too strict because it rejects cases where --json
was explicitly set to false alongside --format. Update the logic so the conflict
is only raised when the json alias is actually enabled, and keep the existing
alias handling for the true case while preserving the
runtime.Cmd.Flags().Set("format", "json") behavior and runtime.Format
assignment.

---

Duplicate comments:
In `@tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go`:
- Around line 92-117: The create subtest in
base_dashboard_block_get_data_dryrun_test.go still does not verify the request
body fields for --name and --data-config. Update the create case in
TestBaseDashboardBlockGetDataDryRun to assert the dry-run output contains the
expected name value ("订单趋势") and the serialized data-config content from the
request, alongside the existing checks on the POST endpoint and dashboard/type
fields, so the request construction is fully covered.

---

Nitpick comments:
In `@shortcuts/base/helpers.go`:
- Around line 1141-1143: The validation text in the group_by sort order check is
misleading because normalizeDataConfig already defaults order to asc for
group/view before validation. Update the error message in the sort validation
path in helpers.go (the branch that checks o == "" and o != "asc"/"desc") so it
clearly states the requirement only applies to type=value, or explicitly note
that group/view default to asc; keep the message aligned with the actual
behavior in normalizeDataConfig and the group_by validation logic.

In `@shortcuts/base/record_list.go`:
- Around line 86-93: Add a hidden-flag test for the
`recordListFieldNamesAliasFlag` alias so it is covered the same way as
`TestBaseRecordListJSONAliasIsHidden`. Extend the existing shortcut flag tests
in the record list area to assert that `--field-names` remains hidden from help
output and is treated as a hidden alias for `--field-id`, using the existing
`common.Flag`/`recordListFieldNamesAliasFlag` symbol to locate the change.
🪄 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: 3d9aef19-d386-42f5-be7f-b1c52afee3de

📥 Commits

Reviewing files that changed from the base of the PR and between b56f2c2 and 5657b5f.

📒 Files selected for processing (15)
  • shortcuts/base/base_data_query.go
  • shortcuts/base/base_dryrun_ops_test.go
  • shortcuts/base/base_execute_test.go
  • shortcuts/base/base_shortcuts_test.go
  • shortcuts/base/dashboard_block_create.go
  • shortcuts/base/dashboard_block_get.go
  • shortcuts/base/dashboard_block_get_data.go
  • shortcuts/base/dashboard_create.go
  • shortcuts/base/helpers.go
  • shortcuts/base/record_batch_create.go
  • shortcuts/base/record_list.go
  • shortcuts/base/record_ops.go
  • skills/lark-base/references/dashboard-block-data-config.md
  • skills/lark-base/references/lark-base-dashboard.md
  • tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go
✅ Files skipped from review due to trivial changes (5)
  • shortcuts/base/dashboard_block_get.go
  • shortcuts/base/record_batch_create.go
  • shortcuts/base/dashboard_create.go
  • shortcuts/base/base_data_query.go
  • shortcuts/base/dashboard_block_create.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • skills/lark-base/references/lark-base-dashboard.md
  • skills/lark-base/references/dashboard-block-data-config.md

Comment thread shortcuts/base/helpers.go
Comment thread shortcuts/base/record_list.go Outdated
@zhouyue-bytedance
zhouyue-bytedance force-pushed the dashboard-review-fixes-pr branch 2 times, most recently from 42c7889 to a627848 Compare July 8, 2026 06:39

@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/dashboard-block-data-config.md`:
- Around line 93-95: The wording around `sort` auto-fill is too broad and should
be limited to the create flow. Update the guidance in
`dashboard-block-data-config.md` so it only states that block creation via the
create path normalizes `sort.type:"group"` or `"view"` without an `order` to
`order:"asc"` before validation, and avoid implying the same behavior for update
or dry-run unless those paths share the same normalization logic. Keep the
explicit `sort.type:"value"` requirement and the helper-table example tied to
first-time block creation.
🪄 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: b1b339c0-68cc-4611-905a-2740236a18c4

📥 Commits

Reviewing files that changed from the base of the PR and between 42c7889 and a627848.

📒 Files selected for processing (13)
  • shortcuts/base/base_dryrun_ops_test.go
  • shortcuts/base/base_execute_test.go
  • shortcuts/base/base_shortcuts_test.go
  • shortcuts/base/dashboard_block_create.go
  • shortcuts/base/dashboard_block_get.go
  • shortcuts/base/dashboard_block_get_data.go
  • shortcuts/base/helpers.go
  • shortcuts/base/record_batch_create.go
  • shortcuts/base/record_list.go
  • shortcuts/base/record_ops.go
  • skills/lark-base/references/dashboard-block-data-config.md
  • skills/lark-base/references/lark-base-dashboard.md
  • tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go
✅ Files skipped from review due to trivial changes (4)
  • shortcuts/base/dashboard_block_get.go
  • shortcuts/base/record_batch_create.go
  • shortcuts/base/dashboard_block_create.go
  • shortcuts/base/base_dryrun_ops_test.go
🚧 Files skipped from review as they are similar to previous changes (8)
  • shortcuts/base/dashboard_block_get_data.go
  • shortcuts/base/record_list.go
  • tests/cli_e2e/base/base_dashboard_block_get_data_dryrun_test.go
  • skills/lark-base/references/lark-base-dashboard.md
  • shortcuts/base/base_execute_test.go
  • shortcuts/base/helpers.go
  • shortcuts/base/record_ops.go
  • shortcuts/base/base_shortcuts_test.go

Comment thread skills/lark-base/references/dashboard-block-data-config.md Outdated
@zhouyue-bytedance
zhouyue-bytedance force-pushed the dashboard-review-fixes-pr branch from a627848 to 4676feb Compare July 8, 2026 06:56
@zhouyue-bytedance
zhouyue-bytedance force-pushed the dashboard-review-fixes-pr branch from 4676feb to 833684e Compare July 8, 2026 07:34
Comment thread shortcuts/base/dashboard_block_get.go Outdated
Comment thread shortcuts/base/dashboard_block_get_data.go
The 'do not audit every block after creation' hint duplicates the
create-then-suppress-get guidance already in lark-base-dashboard.md,
so remove it from the +dashboard-block-get tips to keep them focused.
Commit 778da63 removed the 'do not audit every block' tip from the
+dashboard-block-get source as redundant but left the matching
assertion in TestBaseDashboardHelpGuidesAgents, breaking the unit
test. Remove the stale assertion to realign the test with the tips.
…view-fixes-pr

# Conflicts:
#	skills/lark-base/references/lark-base-dashboard-block-get-data.md
@zhouyue-bytedance
zhouyue-bytedance merged commit d5afe3f into larksuite:main Jul 16, 2026
22 checks passed
@liangshuo-1 liangshuo-1 mentioned this pull request Jul 16, 2026
3 tasks
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