feat(cli): dashboard widget reference integrity check (dataset → dimensions/measures + chartConfig fields)#1722
Merged
Conversation
…/measures + chartConfig) Closes #1721. The ADR-0021 single-form cutover makes every DashboardWidget select its dataset's dimensions/measures BY NAME, but nothing validated those references — a widget could name a dataset that doesn't exist, a measure the dataset never declares, or point chartConfig.yAxis[].field at a stale base column, and validate/lint/doctor/build all stayed green while the page rendered an empty series. Downstream this broke 36 widgets across 11 template dashboards (templates#27, templates#30) with a green build. `validateWidgetBindings()` (the #1719 semantic pass) now returns severity-carrying findings: errors — the binding cannot be satisfied; validate and build FAIL: - widget-dataset-unknown `dataset` resolves to no declared Dataset - widget-dimension-unknown a `dimensions[]` entry isn't a dataset dimension - widget-measure-unknown a `values[]` entry isn't a dataset measure - chart-field-unknown chartConfig xAxis.field doesn't resolve to a dataset dimension, or yAxis[].field / series[].name doesn't resolve to a measure selected in `values` (post-cutover rows are keyed by measure NAME, e.g. sum_amount — not the base column amount) warnings — advisory, suppressible per widget via suppressWarnings: - chart-config-missing chart-type widget with no chartConfig (renders an empty series on chartConfig-driven renderers; templates#30 verified in-browser that adding the mapping fixes it) - table-count-only unchanged from #1719 Errors are not suppressible, and messages carry the declared-name list plus a did-you-mean suggestion (containment-first, so amount → sum_amount). Surfaces: validate + compile fail on errors (human + --json), lint passes severity through, doctor gains a "Dashboard integrity" section mirroring the orphan-view pass. A chartConfig field naming an already-invalid selection entry is not double-reported — rules (b)/(c) own that error. The example apps' chart widgets now carry explicit chartConfig (the authoring shape templates#30 standardized on; objectui HEAD derives series from `values` and ignores it, so this is compatible both ways). app-todo's two count-only record-listing tables still warn — that re-modeling to ListViews (ADR-0017) is #1719 territory, left as a follow-up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1721.
What
Extends the #1719 semantic widget-binding pass (
validateWidgetBindings) into the full dashboard widget reference integrity check the issue proposes, and surfaces it in all four build-time tools:widget-dataset-unknowndatasetresolves to a declaredDatasetwidget-dimension-unknowndimensions[]entry is a real dataset dimensionwidget-measure-unknownvalues[]entry is a real dataset measurechart-field-unknownchartConfig.xAxis.fieldresolves to a dataset dimension;yAxis[].field/series[].nameresolve to a measure selected invalueschart-config-missingchartConfigat alltable-count-onlyvalidate— semantic pass aftersafeParsesucceeds; errors fail with located, corrective messages (and in--json); warnings print non-blocking (--strictmakes them fatal).build/compile— same: errors fail the build where the cutover damage actually occurred (CI).lint— findings pass their real severity through (was hardcodedwarning).doctor— new "Dashboard integrity — All widgets resolve datasets, dimensions, and measures" section mirroring the orphan-view pass.Messages list the declared names and carry a did-you-mean suggestion with containment checked before edit distance, so the cutover's canonical drift (
amount→sum_amount) is suggested:Design notes
suppressWarnings: ['<rule-id>']keeps working for the two advisory rules.chartConfigfield that names an already-invalidvalues/dimensionsentry is not double-reported — rules (b)/(c) own that error.datasetdoesn't resolve reports once and skips the name checks (nothing to resolve against).valuesgets a targeted message ("the query result will not contain it") instead of the generic one.Example apps
chart-config-missingflagged 19 chart widgets across the three example apps — all authored withoutchartConfig. They now carry the explicit mapping (xAxis.field= dimension,yAxis[].field= measure name), the authoring shape templates#30 standardized on after browser-verifying it fixes the blank charts. Note the tension: objectui HEAD'sDatasetWidget(since92449ef99) derives series fromvaluesand ignoreschartConfig, so at HEAD the warning is advisory rather than a real breakage — but published renderers consume it, and the explicit form is compatible both ways. If values-derived rendering becomes the contract everywhere,chart-config-missingcan be dropped without touching the error rules.app-todo's two count-only record-listing tables (
overdue_tasks_table,due_today) still warn undertable-count-only— re-modeling them as object-bound ListViews (ADR-0017) is #1719's failure class, left as a follow-up.Verification
sum_amount/amountchart and the 构建期告警:table/pivot dashboard widget 绑定到「count-only」数据集(很可能是应做成 ListView 的记录列表) #1719 count-only table); full CLI suite 254 passed;tscclean.validatepasses, dashboards typecheck (remaining showcase page-type errors are pre-existing drift in untouched files).yAxis.fieldmakes bothvalidateandbuildexit 1 with the message above;doctorprints the new integrity section.🤖 Generated with Claude Code