Skip to content

fix(app-shell): the dashboard's Add-widget menu and widget Type select offer every spec widget type, from one registry - #26967

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-iudfy4
Oct 28, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-iudfy4

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Fixes #26745

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:仪表盘的「添加组件」菜单和组件检查器的「类型」下拉,改为读同一个注册表,而注册表的类型集合直接取自 spec 的 ChartTypeSchema;两处都从 11/10 种变成 spec 的全部 20 种。补了新类型的中英文名称,并改写了指向不存在控件的数据集提示文案。
  • 为什么改:两个选择器各自手写清单,互相不一致,也和 spec 不一致,9 种平台能渲染的图表在 Studio 里没有入口。页面 block 选择器缺的 8 个经实测全部是有书面理由的排除,本 PR 不动。
  • 风险与回滚:只改 Studio 编辑器提供的选项和文案,渲染器与 spec 词汇原样不动;两个选择器的排列改为 spec 顺序。有问题直接 revert 本 PR。
  • 先看:previews/widget-types.ts 的 WIDGET_TYPE_IDS 与 WIDGET_TYPE_PRESENTATION(satisfies),然后 DashboardWidgetInspector.tsx 的 WIDGET_TYPES,最后 AddWidgetPicker.oneRegistry-26745.test.tsx。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/previews/AddWidgetPicker.oneRegistry-26745.test.tsx,预期 7 个测试全绿。
  • 需要你做的:无,席位落地。

What changes

Base aa00362f.

  • previews/widget-types.ts is the one registry. The offered set is WIDGET_TYPE_IDS = ChartTypeSchema.options, read from @objectstack/spec/ui at runtime (the module's consumers already load @objectstack/spec/ui), so the file restates no list of type names. What stays per type is presentation (English label, the two catalogue keys, category, icon) in WIDGET_TYPE_PRESENTATION, checked with satisfies Record<ChartType, …>: a type the spec adds or retires fails tsc until its row is added or removed. WIDGET_TYPE_META and WIDGETS_BY_CATEGORY keep their shapes, so AddWidgetPicker, DashboardDefaultInspector and DashboardPreview read the registry unchanged.
  • inspectors/DashboardWidgetInspector.tsx. The Type select's hand-kept WIDGET_TYPES list (10 entries, no scatter) is replaced by a map over WIDGET_TYPE_IDS, labelled from the registry's selectLabelKey. The docblock that said "A hand-written SUBSET is fine" now says the opposite.
  • Newly offered types: column, scatter (Type select only; the menu already had it), treemap, sankey, combo, gauge, solid-gauge, kpi, bullet, radar. list and custom stay out: they are objectui-only families with no ChartTypeSchema member, so a widget authored with them cannot publish.
  • i18n (studio namespace, en + zh). engine.inspector.widget.type.* for the ten types the Type select did not name; engine.widgetPicker.type.* for the nine the Add menu did not name. No row in metadata-admin/i18n.ts is added or edited (the dispatch's shared-file rule while feat(ui): the rest of the Studio strings and the metadata preview panes move into the studio i18n namespace (#25922 slice S5) #26942 is open). engine.inspector.widget.datasetHint is reworded in en and zh: it no longer points at "the inline object query above", which the inspector has not drawn since ADR-0021, and describes the dataset, dimension and measure controls it does draw.
  • Page block palette: no change. Measured against PageComponentType (34 types) on aa00362f: the palette offers 26, and the 8 it does not offer are exactly the 8 entries of PALETTE_EXCLUSIONS, each with a recorded reason. Per the dispatch, a block excluded with a recorded reason stays excluded:
    • record:chatter: compatibility alias of the offered record:discussion (maintainer ruling on objectui#5495).
    • app:launcher, global:notifications: shell singletons, not page content.
    • element:record_picker, element:text_input: render, but are field widgets, not page blocks.
    • record:approvals, record:attachments, record:approval_decision: render; recorded as "not yet offered, offering it is a Studio decision". Left for that decision (see the report's open question).
  • Changeset: patch for @object-ui/i18n; @object-ui/app-shell is private: true.

Tests

previews/AddWidgetPicker.oneRegistry-26745.test.tsx, seven cases, each read off the rendered control:

  • the spec enum reads non-empty (the non-vacuity duty of enumOptions);
  • the registry equals ChartTypeSchema's vocabulary, in the spec order;
  • the Add-widget menu lists exactly the spec types (read from each entry's stored-type code);
  • the Type select lists exactly the spec types, each named by its registry key;
  • every offered type renders through the real DashboardRenderer (via DashboardPreview), with no "not supported yet" placeholder and no red unknown-component panel;
  • control: the same probe sees the placeholder for heatmap, a family with no renderer;
  • every type has both names in en and zh, and the Add menu's en name equals the English label the default title is written from.

inspectorStrings.i18n-10804 and inspectorStrings.i18n-10748 used hand-kept type lists of their own; both now read the registry, so their per-type zh/en checks cover all 20 types.

Ablations (both through scripts/ablation-replace.mjs, restore verified blob == HEAD and git diff HEAD empty):

  • Type select given back a hand-kept 10-type list: the Type select case goes red (1 failed, 6 passed).
  • Add menu registry given back a hand-kept 11-type list: the registry, Add menu and Type select cases go red (3 failed, 4 passed).

Acceptance notes

Verification

All local runs are on head 65768a23 (base aa00362f).

  • Closure build pnpm exec turbo run build --filter='@object-ui/app-shell^...' --concurrency=2: 63/63 tasks, lock VERDICT command-exit 0.
  • New file: 7/7 passed. Neighbours (34 app-shell test files that read the widget registry, its catalogue rows or the dashboard inspectors/preview, plus packages/i18n/): 123 files, 1773 passed / 13 skipped, exit 0.
  • pnpm --filter @object-ui/i18n --filter @object-ui/app-shell run type-check: both Done, exit 0.
  • pnpm check:new-line-citations (run from ui/): 0 new citations, exit 0.
  • dispatch-gates --ran: 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN. node scripts/check-sdui-manifest.mjs is among them (exit 0).
Derived gates, exit codes recorded before any pipe
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:pm-changeset-deadline-census :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0

CI families are read from this PR's check-runs; none was re-run locally beyond the derived list.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (Not touched.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes (CI).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English (the 维护者速读 block is the dispatch's required Chinese summary).

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQwxbafngYyQTJq78seG4v


Generated by Claude Code

…derived from the spec

The Add-widget menu (11 types) and the widget inspector's Type select
(10 types) kept their own hand-written lists while ChartTypeSchema
accepts 20, every one of which the dashboard draws. widget-types.ts now
takes the offered set from ChartTypeSchema.options and keeps only
per-type presentation, checked against ChartType with `satisfies`; the
Type select derives its options from the same registry. The nine newly
offered types get their names in the studio namespace (en + zh), and
the widget dataset hint stops naming the removed inline object query.

Claude-Session: https://claude.ai/code/session_01JQwxbafngYyQTJq78seG4v
Co-authored-by: Claude <noreply@anthropic.com>
… and carries a lit control

Claude-Session: https://claude.ai/code/session_01JQwxbafngYyQTJq78seG4v
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling labels Oct 27, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

ACCEPT · seat domain:ui#5 · session_01JQwxbXGpVJHZTXXerMoY4C · head 65768a23 · 2026-10-27T23:51Z

席位意见:仪表盘「添加组件」菜单和组件「类型」下拉改读同一个注册表,类型集合直接取 spec 的 ChartTypeSchema(20 种),每种类型的展示行用 satisfies Record<ChartType, …> 校验,spec 增删类型时编译即失败。页面区块选择器缺的 8 个都是有书面理由的排除,本 PR 不动,正确。

  1. Shape: Fixes #26745; 8 files, +351/−76: previews/widget-types.ts +87/−30 (registry), DashboardWidgetInspector.tsx +9/−17 (hand-kept list removed), studio namespace en +26/−1 and zh +20/−1, one new test file, two existing i18n tests now read the registry, and a patch changeset for @object-ui/i18n (@object-ui/app-shell is private: true). No row in metadata-admin/i18n.ts (the shared-file rule while feat(ui): the rest of the Studio strings and the metadata preview panes move into the studio i18n namespace (#25922 slice S5) #26942 is open). block-types.ts untouched.
  2. Premise measured: the seat read the source diff. WIDGET_TYPE_IDS = ChartTypeSchema.options; WIDGET_TYPE_PRESENTATION carries names, category and icon only, keyed by ChartType with satisfies; WIDGET_TYPE_META keeps its shape for AddWidgetPicker, DashboardDefaultInspector and DashboardPreview; the inspector's WIDGET_TYPES is a map over the registry. list / custom stay out (no ChartTypeSchema member, cannot publish). The 8 unoffered blocks equal the 8 PALETTE_EXCLUSIONS entries, each with a recorded reason, as the order required. The dataset hint no longer names the "inline object query above". Head check: the report's local runs were on 65768a23, which the dev had not pushed when the report posted; it is now the PR head, and 6a4d08a5..65768a23 is test-only (+16/−4 in the new test: the chart renderer import and the heatmap lit control). Dev: 7/7 new tests incl. the lit control; two ablations (a hand-kept list put back in each picker) turned 1 and 3 cases red, restored.
  3. Gates / check-runs: PR check-runs on 65768a23: 43 success, 9 skipped, 0 failure; Lint & Repo Gates, TypeScript Type Check and Check Changeset success. Dev's local run: 34 derived, 34 run, 0 NOT-MEASURED (check-sdui-manifest among them); app-shell and i18n type-check exit 0; 123 neighbour files green.
  4. Accepted deviations: both pickers now follow the spec's order (the select opens with bar, the menu's single-value group with gauge). The two catalogue families still name a type differently ("Bar chart" vs "Bar Chart"); merging them is a naming choice outside this card.
  5. Out of scope: record:approvals, record:attachments, record:approval_decision are recorded in PALETTE_EXCLUSIONS as "not yet offered, offering it is a Studio decision": dropped — a product choice, not a defect, so no card. Skills-docs: none — Studio picker and catalogue rows only.
  6. Landing: not Tier H (no governed path, +427 lines); ready for landing (ready + auto-merge).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 27, 2026 23:52
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 27, 2026 23:52
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 1986d25 Oct 28, 2026
53 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-iudfy4 branch October 28, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling

Projects

None yet

2 participants