Skip to content

finding(types/plugin-charts): the static ChartSchema node's two data keys are declared-but-unread — ChartDataSeries.data is required and never read, and categories is read as a SERIES list, not axis labels #6896

Description

@os-sam

Measured while implementing #6121 (PR #6895), filed unassigned and not fixed there — that
card's ruled scope is the report authoring face, and this is a different question about a
different node. Recorded here so it is not lost.

Measured on origin/main5d36766fb.

The two keys

@object-ui/types declares the inline-static-data chart node
(packages/types/src/data-display.ts):

ChartSchema.categories?: string[] // commented "X-axis labels/categories"
ChartSchema.series: ChartDataSeries[]
ChartDataSeries = { name: string; data: number[]; color?: string } // `data` REQUIRED

ChartDataSeries' own header states the model: "a display name plus the literal numbers to
plot, positionally aligned with the chart's categories"
.

The renderer these nodes reach is normalizeChartSchema in @object-ui/plugin-charts
(packages/plugin-charts/src/normalizeChartSchema.ts), via ChartRenderer. Read it and the
model is not implemented:

1. series[].data is read by nothing.normalizeSeries (:232-258) reads exactly
dataKey/name, label, chartType/type, variant, opacity, dashArray, stack,
yAxis, color. data is not among them, and a repo-wide grep for a read of a series' own
data array finds no non-test call site. Rows come from the chart-level data — a key
ChartSchema does not declare at all, which survives only because BaseSchema carries
[key: string]: any, so excess-property checking never engages on a ChartSchema literal.

data: number[] is required on every authored series, and dropped.

2. categories is read as an alternative SERIES list, not as axis labels (:302-306):

const rawSeries = Array.isArray(schema.series)
? schema.series
: Array.isArray(schema.categories)
? schema.categories
: undefined;

Each entry then goes through normalizeSeries, whose bare-string branch treats it as
{ dataKey }. The category axis instead comes from xAxisKey / xAxis (:290-292). So an
author following the declared comment — writing month names into categories expecting an
x-axis — gets them interpreted as series bindings when series is absent, and ignored when
it is present. The .d.ts comment and the read disagree about what the key means.

Why it matters, and why it is not #6121's to fix

This is ADR-0049's declared-but-unenforced shape on a published type, in the direction
that costs an author the most: the type demandsdata (so it cannot be omitted) and then
nothing consumes it, while categories documents one meaning and performs another. Both are
invisible to every gate — ChartSchema literals are not excess-checked (index signature),
and the zod twin ChartDataSeriesSchema mirrors the same unread requirement.

#6121 (PR #6895) touched ChartDataSeries only to add the per-series type override the
ruling named, and only because normalizeChartSchema demonstrably reads it. Removing or
relaxing data, or re-pointing categories, changes the accept set of a published type in
the narrowing direction — the manual floor — and is a separate judgement about what the
static SDUI chart node is for.

What a fix would have to decide

  1. Is the inline-static-data chart node (categories + series[].data) a live authoring
    model
    the renderer should implement, or a retired one whose keys should go under
    ADR-0049 enforce-or-remove? Nothing in packages/, apps/ or examples/ authors a
    populated series[].data outside tests.
  2. If it stays: normalizeChartSchema gains a real inline-data branch, and categories
    feeds xAxisKey as the comment promises.
  3. If it goes: data becomes optional or is retired, categories' comment is corrected to
    the series-list meaning it actually has, and the zod twin follows.

⛔ Not the same defect family as #4466 / #4497 / #4507 / #4673 / #4683 / #4695, which are all
about buildChartSeries on the dataset-bound path. This is the static SDUI node, which
never calls buildChartSeries. Deduped against those before filing.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions