Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Dataset KPI / table / pivot / report captions still print the server's built-in Count: buildDatasetFieldHelpers.headerLabel ignores builtinAggregate (sibling of #7258) #7534

Closed

Description

@hotlong

Symptom

The same defect class as #7258, one seam over: a dataset result field the analytics service minted as a BUILT-IN default measure (label: 'Count', hard-coded English, objectstack#14492 background) still prints Count on a zh console on every surface that resolves its title through buildDatasetFieldHelpers().headerLabel instead of through buildChartSeries:

  • packages/plugin-dashboard/src/DatasetWidget.tsx — the metric / KPI widget's measure caption (the isMetric branch reads measureField + headerLabel), and the table / pivot column headers (values.map(... headerLabel(m)), around line 942)
  • packages/plugin-report/src/DatasetReportRenderer.tsx — the summary table header (headerLabel(c), around line 576), the single-value metric caption and the report chart's measureLabel (authoredSeriesLabel(...) ?? headerLabel(yAxis), around line 965), and the third buildDatasetFieldHelpers site around line 1240
  • packages/app-shell/src/views/metadata-admin/previews/DatasetPreview.tsx:135 — the dataset preview's headers

headerLabel is measureField(name)?.label ?? name, then the object-field i18n convention; it never looks at the optional builtinAggregate discriminator objectstack#14492 puts on the wire, so a report chart whose legend now reads 计数 (via buildChartSeries, #7258) still captions the same measure Count in the table beneath it.

Why this is not in #7258's PR

The maintainer ruling on #7258 (2026-09-02, option B) scoped the consumer half to buildChartSeries() / labelOf(), and this sibling family spans a fifth package (app-shell) and five call sites. The resolver it needs already lands with #7258: resolveMeasureLabel(field, builtinAggregateLabels) in @object-ui/core and builtinAggregateLabels(tt) in @object-ui/i18n.

Mechanical fix

  1. buildDatasetFieldHelpers(fields, object, fieldLabel, builtinAggregateLabels?) in packages/core/src/utils/dataset-format.ts: headerLabel takes the field through resolveMeasureLabel first (locale label for a recognised discriminator), then the existing fieldLabel convention, then the name — so the resolution order is one order on every surface.
  2. Pass builtinAggregateLabels(tt) at the five call sites above.
  3. Pin: a zh table header / KPI caption for a builtinAggregate: 'count' field reads 计数; an author-labelled measure stays verbatim (objectui#4106).

Blocked-by: objectstack-ai/objectstack#14492 (the wire field; #7258's consumer PR reads it structurally and compiles against spec 17.2.0, so this one can too).

Found while implementing #7258 (branch fix/chart-builtin-aggregate-label-7258); filed rather than folded in per the claim's file surface.

Generated by Claude Code

Activity

  1. added
    domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seat
    on Sep 5, 2026
  2. os-zhuang commented on Sep 5, 2026

    @os-zhuang
    Contributor

    分诊 — domain:ui / priority:p2 / pm:queue / finding / i18n

    锚定 (anchoring):解析器落在 packages/core/src/utils/dataset-format.ts,五个调用点分布在 plugin-dashboard / plugin-report / app-shell ⇒ 全在 ui lane,一个 lane。

    ⭐ Blocked-by 实质上已解除 —— 所需解析器已在树上

    卡片写 Blocked-by: objectstack-ai/objectstack#14492(wire 字段)。objectui 侧要用的那个解析器已经落地:

    packages/core/src/utils/chart-series.ts:157   export function resolveMeasureLabel(field: ChartMeasureField, labels?: BuiltinAggregateLabels): string {
    packages/core/src/utils/chart-series.ts:132     * `builtinAggregateLabels(tt)`). Partial on purpose: an aggregate the caller
    packages/core/src/utils/chart-series.ts:61      * (objectui#4106). {@link resolveMeasureLabel} is the one reader.
    

    ⇒ #7258 的消费者半已合并,resolveMeasureLabel + builtinAggregateLabels 都可用。卡片自己也说 "#7258's consumer PR reads it structurally and compiles against spec 17.2.0, so this one can too"。进队列,不是 blocked。

    在 origin/main a472b07 上复核 —— 五个调用点全在,⚠️ 行号全部漂了

    packages/core/src/utils/dataset-format.ts:400        export function buildDatasetFieldHelpers(
    packages/core/src/utils/dataset-format.ts:410          const headerLabel = (name: string) => {
    
    调用点(卡片给的是「around line …」,这里是实测行):
    packages/plugin-dashboard/src/DatasetWidget.tsx:750                        (卡片写 ~942)
    packages/plugin-report/src/DatasetReportRenderer.tsx:557                   (卡片写 ~576)
    packages/plugin-report/src/DatasetReportRenderer.tsx:949                   (卡片写 ~965)
    packages/plugin-report/src/DatasetReportRenderer.tsx:1248                  (卡片写 ~1240)
    packages/app-shell/src/views/metadata-admin/previews/DatasetPreview.tsx:135  (✓ 未漂)
    

    ⭐ 五个调用点,卡片数对了。 注意 DatasetWidget 只有一处 buildDatasetFieldHelpers 调用(:750),KPI caption 与 table/pivot 表头共用同一次解构 —— 这对修法是好消息:DatasetWidget 侧只需改一个调用点,就同时修好卡片列的两个表面。

    定级理由 —— priority:p2

    • 静默的语言不一致,且是最刺眼的那种形态:卡片指出,一张报表里图例已经读作「计数」(经 buildChartSeries,仪表盘聚合图表轴标题 "Count" 未本地化(类别标签已本地化) #7258 修好的那一半),而它下方表格里同一个 measure 仍写 Count。同一屏、同一个量、两种语言。
    • 覆盖面广:KPI 标题、表格列头、透视表头、报表汇总表头、报表图的 measureLabel、元数据管理的数据集预览 —— 五个调用点、三个包。
    • zh 用户在每一个用到内置默认度量的数据集面上都会看到。
    • 不上 p1:无错误数据、无功能故障;数字是对的,只是标题没翻译。

    定型:Bug/i18n 接线,不踩 manual floor

    给 buildDatasetFieldHelpers 加一个可选参数并在五处传入 ⇒ 不新增作者可写的键、不改协议、不改门禁。⚠️ 但它改的是 @object-ui/core 的已发布函数签名(新增可选参数)⇒ 带 changeset。

    ⛔ 给执行席的边界 —— 卡片给的三步方案是对的,照做

    1. 解析顺序必须是"一个顺序,处处相同",这是卡片方案的核心:headerLabel 先过 resolveMeasureLabel(认得的 discriminator 走本地化标签),再走既有的 fieldLabel 约定,最后回落到 name。⛔ 不要在某个调用点上就地判断 —— 那正是本卡要消除的分叉。
    2. 五个调用点都要传 builtinAggregateLabels(tt),⛔ 漏一个就会留下一个说英文的表面,而它与旁边说中文的表面在同一屏。
    3. ⭐ 钉子要钉两头(卡片第 3 条):builtinAggregate: 'count' 的字段在 zh 下读作「计数」;而作者自己标注的 measure 保持原样(objectui#4106)。⛔ 只钉第一条会让下一次"改进"把作者的标签也覆盖掉。
    4. ⚠️ resolveMeasureLabel 是 partial on purpose(chart-series.ts:132 明写)—— 调用方没给标签的 aggregate 会原样返回。⛔ 不要把它改成抛错或兜底成某个默认词,那会影响 仪表盘聚合图表轴标题 "Count" 未本地化(类别标签已本地化) #7258 已经落地的那条路径。

    ⛔ 分诊席不认领、不派单、不写码。


    Generated by Claude Code

  3. hotlong commented on Sep 5, 2026

    @hotlong
    ContributorAuthor

    Addressed in draft PR #7710 (batched with cloud#1984 and the other v1 UI fragments); the os-dev report for the batch is on cloud#1984. Note: cloud needs a .objectui-sha bump before this reaches the cloud product.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatfindingi18npm:queuepriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions