Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .changeset/20152-chart-drilldown-mode-guidance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
'@objectstack/spec': patch
---

`ChartDrillDownSchema`'s refusal text for `drillDown.mode` names the one objectui block that reads it, not all three it used to

An author (or an AI) who writes `drillDown.mode` on a chart gets this guidance
sentence back from `objectui validate` / `safeValidateSchema`. It used to read:

> `mode` (`'filter'` | `'record'`) is a TABLE / PIVOT / METRIC drill key, not a
> chart one: …

`object-metric` has refused `drillDown.mode` at its TypeScript door since
objectui#9002 (PR objectui#10681, merged, on the maintainer ruling recorded
there, comment `5643445104`), and `object-pivot` has refused it since
objectui#10685 (PR objectui#10710, merged). Measured on objectui `origin/main`:
neither block's renderer ever read `mode`; only `object-data-table` does. So
the old sentence sent an author who followed it straight into a second
refusal on two of the three blocks it named — right on `object-pivot` and
`object-metric` (both now refuse the key by name), and a stored JSON config
that carries it there is silently ignored with no diagnostic.

The sentence now names the one block that actually reads `mode`:

> `mode` (`'filter'` | `'record'`) is objectui's `object-data-table` drill
> key, not a chart one: …

The reasoning clause and "Delete the key" are unchanged. The neighbouring
`report` guidance entry (a METRIC / PIVOT widget capability) is untouched —
its blocks were not remeasured on this card.

⛔ No accept/reject behaviour changes. `mode` remains refused on
`ChartDrillDownSchema` exactly as before; only the refusal text changes.

**This is shipped, which is why it carries a changeset rather than
`skip-changeset`.** `@objectstack/spec`'s published `files[]` ships both
`dist` and `src/**/*.zod.ts`, and `chart.zod.ts` is one of the latter — so the
sentence ships as source verbatim, and also as a runtime string built into
`dist/ui/index.js` / `dist/ui/index.mjs` (measured: present at 1 occurrence
each after a rebuild, with the old "TABLE / PIVOT / METRIC" spelling absent
from both).
2 changes: 1 addition & 1 deletion packages/lint/src/validate-react-page-props.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ describe('validateReactPageProps — <ObjectChart drillDown> (#5022)', () => {
it('rejects a key that belongs to another widget, with the reason rather than a rename', () => {
const f = validateReactPageProps(drill(`{ mode: 'record' }`));
const hit = f.find((x) => x.rule === REACT_CHART_DRILLDOWN_INVALID);
expect(hit!.message).toContain('TABLE / PIVOT / METRIC');
expect(hit!.message).toContain('object-data-table');
});

it('rejects the report near-key spelling and names the type difference', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/spec/src/ui/chart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ describe('#5022 — ChartDrillDownSchema', () => {
});

it.each([
['mode', 'TABLE / PIVOT / METRIC'],
['mode', 'object-data-table'],
['report', 'METRIC / PIVOT'],
['view', 'read by no renderer at all'],
['sort', 'read by no renderer'],
Expand Down
2 changes: 1 addition & 1 deletion packages/spec/src/ui/chart.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ export const ChartDrillDownSchema = lazySchema(() => strictObject(
// Keys of objectui's wider renderer-side drill config. Each is real —
// on another widget — so a rename suggestion would be actively wrong.
mode:
'`mode` (`\'filter\'` | `\'record\'`) is a TABLE / PIVOT / METRIC drill key, not a chart one: it chooses whether a click drills through an aggregate to a filtered list or straight to one record. A chart segment is always an aggregate, so a chart drill is always the filtered-list kind and there is nothing to discriminate. Delete the key.',
'`mode` (`\'filter\'` | `\'record\'`) is objectui\'s `object-data-table` drill key, not a chart one: it chooses whether a click drills through an aggregate to a filtered list or straight to one record. A chart segment is always an aggregate, so a chart drill is always the filtered-list kind and there is nothing to discriminate. Delete the key.',
report:
'`report` (drill into an analytical report instead of the record list) is a METRIC / PIVOT widget capability in the objectui renderer; `<ObjectChart>` does not read it and renders the record list regardless. Delete the key, or drill from a metric widget instead.',
view:
Expand Down
Loading