This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit aa6be30
feat(plugin-charts): the
Fixes #8086
Clause-②: yes
A published TS union widens to what `ChartDataSeriesSchema` and the
renderer already accept. This executes ruling `5809905710` (align) on
objectui#8086, dispatched by the `domain:ui` seat 2 (claim comment
`5828875764`).
## What changed
- `packages/plugin-charts/src/ChartRenderer.tsx`: the `dataKey` arm of
`ChartRendererProps.schema.series` gains `type?: string`, the same
member type the `name` arm declares. No other member of either arm
changes. The docblock that PR #8080 added ("This TS union stays as
declared …") is replaced by the aligned statement. The component-body
comment said `normalizeSeries` round-trips "every key the internal arm
declares" unchanged. That comment is updated for the new member, because
`type` is translated to `chartType` and not passed through.
- `ChartRenderer.specSeries.test.tsx`: the `as any` on the `{ dataKey,
type }` case is removed. The one other `as any`, on the `categories`
case, stays, and a comment now gives the reason: it covers `categories`,
which `ChartRendererProps.schema` does not declare. Leg B below measures
this.
- `ChartRenderer.seriesTypeArm-8086.test.ts` (new, in the same folder):
compile-time pins against each arm.
- `packages/types/src/objectql.ts`: a prose-only change. The
`ObjectChartSchema.series` docblock said its element type is the
internal arm "VERBATIM". After this change that arm carries `type` and
the copy does not, so the sentence is rewritten. The type itself is
unchanged. See Deviations.
- `.changeset/8086-chart-series-type-arm.md`:
`'@object-ui/plugin-charts': minor`.
## Premise measurement: the old `as any` was not needed
`series` is a union with no literal discriminant. TypeScript's
excess-property check on an object literal therefore only asks whether
each key is known to at least one arm. On the base declaration, the
specSeries literal with `{ dataKey: 'margin', type: 'line' }` compiles
without the cast, because `type` is known to the `name` arm. Leg A shows
this: with the cast already removed, `ChartRenderer.specSeries.test.tsx`
reports zero errors. For the same reason, a `{ name, chartType }`
literal compiles against the whole union on both base and head, because
`chartType` is known to the `dataKey` arm.
The gap the card names is real, but it is in the arm, not the union. On
base, a value typed as the `dataKey` arm cannot carry `type` (TS2353),
and an entry narrowed with `'dataKey' in entry` cannot read it (TS2339).
So each new pin is written against a single arm, the `Extract` of the
union on its binding key. Pins written against the whole union would
pass on both sides of the change.
## Evidence (HEAD `ff726c28c`)
**Red on base (leg A).** This leg removes only the new member from
`ChartRenderer.tsx`, which restores the base declaration, and keeps
every test at HEAD. The edit went through `node
../objectstack/scripts/ablation-replace.mjs`: the anchor went from 1 hit
to 0, the blob changed from `e0dac80c6e03` to `ad7bb3165aac`, and after
restore the blob matched HEAD and `git diff HEAD` was empty. It then ran
`tsc -p tsconfig.test.json --listFiles` in `packages/plugin-charts`. The
file list includes `ChartRenderer.tsx`,
`ChartRenderer.seriesTypeArm-8086.test.ts` and
`ChartRenderer.specSeries.test.tsx`. Line and column numbers are removed
from the output below:
```text
ChartRenderer.seriesTypeArm-8086.test.ts TS2339 Property 'type' does not exist on type '{ dataKey: string; ... }' (the Equal pin)
ChartRenderer.seriesTypeArm-8086.test.ts TS2353 'type' does not exist in type '{ dataKey: string; ... }' (value typed as the dataKey arm)
ChartRenderer.seriesTypeArm-8086.test.ts TS2339 Property 'type' does not exist on type '{ dataKey: string; ... }' (reading it back)
ChartRenderer.seriesTypeArm-8086.test.ts TS2339 Property 'type' does not exist on type '{ dataKey: string; ... }' (read after narrowing with 'dataKey' in e)
TSC_EXIT=2
```
Leg A also reports no error in `ChartRenderer.specSeries.test.tsx`,
which is the premise measurement above. The control `@ts-expect-error`
raised no TS2578, so a `{ name, chartType }` value typed as the `name`
arm is refused on base, as it is on head.
**Green on head.** `pnpm run type-check` in `packages/plugin-charts`
(`tsc --noEmit && tsc -p tsconfig.test.json`) printed `VERDICT
command-exit 0`.
**Kept cast (leg B).** With the `as any` removed from the `categories`
case at HEAD, tsc reports `ChartRenderer.specSeries.test.tsx TS2353:
Object literal may only specify known properties, and 'categories' does
not exist in type '{ type: string; ... }'` and `TSC_EXIT=2`. After
restore, the blob matched HEAD.
**Tests** (repo-root form, through the shared verify lock):
- `pnpm exec vitest run --maxWorkers=2 packages/plugin-charts/`: `Test
Files 73 passed (73)`, `Tests 831 passed (831)`.
- `pnpm exec vitest run --reporter=verbose` on the two touched test
files: 2 files, 9 tests passed, 3 of them in the new pin file.
- `pnpm run type-check` in `packages/types`: exit 0.
- `pnpm exec vitest run --maxWorkers=2 packages/types/`: `Test Files 233
passed (233)`, `Tests 5184 passed (5184)`.
**Gates** (verdict lines as printed):
- `node scripts/check-changeset-presence.mjs`: `✅ 4 source file(s) of 2
released package(s) changed, and this change declares 1 changeset(s)`.
- `check-changeset-no-major` ✅, `check-changeset-overwrite` ✅,
`check-changeset-fixed` ✅, `check-changeset-claims`: both sections PASS.
- `pnpm check:new-line-citations`: `VERDICT
new-cross-file-line-citations: 0 new citation(s)`.
- `pnpm check:control-bytes`: `✅ check-control-bytes: OK`.
- `check:pending-changeset-literals`, `check:test-path-roots`,
`check-vi-mock-specifiers` / `-inherit` / `-override-shape`,
`check-type-check-coverage` (43/43), `check:published-tsconfig-exclude`
and `check:unreferenced-sources`: all OK.
- `node scripts/check-governed-queue-guard.mjs --test` on the five
paths: `NOT GOVERNED`.
- Lint was scoped to the four touched source files, with three pieces of
evidence that the scoping skips nothing. First, `eslint --print-config`
finds the root `eslint.config.js` for each file (117 to 118 rules), so
none is ignored. Second, `--format json` shows 4 files and 0 errors; the
only warnings are the existing `no-explicit-any` ones, and the
specSeries file has one fewer than on base. Third, `eslint.config.js`
has no `parserOptions.project` or `projectService`, so type-aware
linting is off, and no local rule under `eslint-rules/` reads the
filesystem. This diff therefore cannot change the lint result of any
file it does not touch. The full `pnpm lint` runs in CI.
- Doc and README gates: not reached. The diff touches no doc, README or
doc fence, and the charts doc already lists `type` as a per-series key
for either binding.
## Deviations
1. **File surface.** The claim listed `ChartRenderer.tsx` (only the
`dataKey` arm and the docblock), the specSeries test with a pin next to
it, and the changeset. Two edits fall outside that list. Both are prose
that this change would otherwise leave false:
- the component-body comment in `ChartRenderer.tsx` (same file, but not
the docblock);
- the `ObjectChartSchema.series` docblock in
`packages/types/src/objectql.ts` (the "VERBATIM" claim).
The dispatch order says to stop on a breach. The os-dev role file says
published text that the change makes false must be fixed, and that the
role file wins when the two conflict. So both edits are made and listed
here. The claim's file surface needs the seat to add them. If the seat
wants them out, removing those two hunks is enough, and the type change
does not depend on them.
2. **Commit trailer.** Commit `ff726c28c` ends with the harness-supplied
`Co-Authored-By` trailer, which names the model, instead of the
model-free pair. History is not rewritten, because force-push is banned
here.
## Acceptance notes
- `ChartRendererProps` is not re-exported by name from the
`@object-ui/plugin-charts` entry. Consumers reach it as the props type
of the exported `ChartRenderer`. In the published 17.6.0 dist it is
declared in `dist/ChartRenderer.d.ts` and used by the registry map type
in `dist/index.d.ts`, and its `dataKey` arm has no `type`. The runtime
half, objectui#7681, is still a pending changeset, so the declaration
and the behaviour ship in the same release.
- `ObjectChartSchema.series` in `@object-ui/types` (the TS interface and
its zod mirror) is a copy of the internal arm and does not have `type`.
Whether that published copy should follow is a separate Clause-②
decision that this PR does not take. Carrier: none.
- A comment in `widget-schema-anchors-7946.test.ts` says `series`'
element type "is" the internal arm. Its assertion only pins `dataKey:
string`, which still holds. The comment is test-only and not published,
so it is left unchanged.
- The `series` union has no literal discriminant, so object literals get
union-wide excess-property checks, and a `{ name, chartType }` literal
type-checks against the union. This PR leaves that as it is, because the
ruling allows no other arm change.
---
_Generated by [Claude
Code](https://claude.ai/code/session_014mXUNuFomfj24w7s1pZzhN)_
Co-authored-by: Claude <noreply@anthropic.com>dataKey arm of ChartRendererProps.series declares type (objectui#8086) (#10554)1 parent 4f74cd5 commit aa6be30
5 files changed
Lines changed: 117 additions & 20 deletions
File tree
- .changeset
- packages
- plugin-charts/src
- types/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| |||
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
158 | 163 | | |
159 | 164 | | |
160 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4362 | 4362 | | |
4363 | 4363 | | |
4364 | 4364 | | |
4365 | | - | |
4366 | | - | |
4367 | | - | |
4368 | | - | |
| 4365 | + | |
| 4366 | + | |
| 4367 | + | |
| 4368 | + | |
| 4369 | + | |
4369 | 4370 | | |
4370 | 4371 | | |
4371 | 4372 | | |
| |||
0 commit comments