Skip to content

Commit 64e57a2

Browse files
committed
fix(types): the object-view table slot's refusal of the retired spellings names the surviving node key
`table.visibleOn` / `hiddenOn` / `disabledOn` carried the generic node-level reason, which sent the author to the object-view node where the spelling is itself retired. Each row now carries its own reason naming `visibleWhen` / `hidden` / `disabled`; pinned beside the node-face tombstone test. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E5XcbmSeZTDGm5zCYkC9XV
1 parent 9951000 commit 64e57a2

3 files changed

Lines changed: 48 additions & 6 deletions

File tree

‎.changeset/25926-retire-node-visibility-dialects.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Metadata-protocol: narrowed
1414

1515
`@objectstack/spec` declares exactly one conditional-visibility predicate at every layer, `visibleWhen`, and objectui carried three spellings of its own beside it: `visibleOn` beside `visibleWhen`, `hiddenOn` beside `hidden`, `disabledOn` beside `disabled`. Each pair was evaluated by the same code with the same polarity, so the second spelling added a dialect and nothing else. The three are retired, with no alias window.
1616

17-
- **`@object-ui/types`**: `BaseSchema.visibleOn`, `hiddenOn` and `disabledOn` are `never` on the TypeScript face and alias refusals on the Zod mirror. A document that writes one is refused at that key, and the message names the key that survives (`visibleWhen`, `hidden`, `disabled`), says the polarity is the same, and says the value is unchanged. `objectui validate` reads the same mirror, so it prints the same refusal. Boolean `visible` stays: the spec declares it on actions, navigation entries, tabs, alerts and settings, and the renderer keeps evaluating it.
17+
- **`@object-ui/types`**: `BaseSchema.visibleOn`, `hiddenOn` and `disabledOn` are `never` on the TypeScript face and alias refusals on the Zod mirror. A document that writes one is refused at that key, and the message names the key that survives (`visibleWhen`, `hidden`, `disabled`), says the polarity is the same, and says the value is unchanged. `objectui validate` reads the same mirror, so it prints the same refusal. The `object-view` table slot's refusal of the same three keys now names the surviving node key too (write `visibleWhen` / `hidden` / `disabled` on the object-view node itself) instead of sending the author to a retired spelling. Boolean `visible` stays: the spec declares it on actions, navigation entries, tabs, alerts and settings, and the renderer keeps evaluating it.
1818
- **`@object-ui/react`**: `SchemaRenderer`'s visibility chain has three legs, `visibleWhen` and `visible` (shown when truthy) and `hidden` (hidden when truthy), and the enablement gate has one, `disabled`. A stale retired key that reaches the renderer unvalidated is not consulted and is held out of the component's props, so it neither gates the node nor lands in the DOM.
1919
- **`@object-ui/sdui-parser`**: the three keys are no longer base props. `validateTree` reports each as an `unknown-prop` diagnostic that names the surviving key, so a TSX tree is told the same thing a JSON document is. `checkRetiredVisibilityDialect` and `RETIRED_VISIBILITY_DIALECTS` are exported for that reading.
2020
- **`@object-ui/app-shell`**: the command palette reads a navigation entry's `visible` only; the `visibleOn` fallback it carried read a key `NavigationItem` never declared.

‎ui/packages/types/src/__tests__/node-visibility-dialects-retired.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { z } from 'zod';
4242
import type { BaseSchema } from '../base';
4343
import { BaseSchema as Mirror } from '../zod/base.zod';
4444
import { AnyComponentSchema, StrictAnyComponentSchema } from '../zod/index.zod.js';
45+
import { ObjectViewSchema } from '../zod/objectql.zod.js';
4546

4647
type Eq<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false;
4748

@@ -150,3 +151,27 @@ describe('objectstack#25926 — the document faces refuse the retired spellings
150151
expect(StrictAnyComponentSchema.safeParse(canonical).success).toBe(true);
151152
});
152153
});
154+
155+
/* ── (c) the object-view `table` slot's refusal of the same spellings names the surviving node key ── */
156+
157+
describe('objectstack#25926 — the `object-view` table slot refuses the retired spellings with a remedy that names the surviving node key', () => {
158+
const VIEW = { type: 'object-view', objectName: 'task' };
159+
160+
it.each(RETIRED)('`table.%s` is refused at its own path, and the remedy says to write `%s` on the object-view node', (alias, canonical) => {
161+
const r = ObjectViewSchema.safeParse({ ...VIEW, table: { [alias]: 'data.ok' } });
162+
expect(r.success).toBe(false);
163+
const issues = r.success ? [] : r.error.issues.map((i) => ({ path: i.path.join('.'), message: i.message }));
164+
expect(issues.map((i) => i.path)).toEqual([`table.${alias}`]);
165+
expect(issues[0]!.message).toContain('NOT A TABLE KEY');
166+
expect(issues[0]!.message).toContain(`\`${alias}\` is also a retired spelling`);
167+
expect(issues[0]!.message).toContain(`write \`${canonical}\` on the object-view node itself; the value is unchanged.`);
168+
});
169+
170+
it('CONTROL — `table.visibleWhen` keeps the generic node-level reason, which sends the key to the object-view node', () => {
171+
const r = ObjectViewSchema.safeParse({ ...VIEW, table: { visibleWhen: 'data.ok' } });
172+
expect(r.success).toBe(false);
173+
const message = r.success ? '' : r.error.issues[0]!.message;
174+
expect(message).toContain('A node-level key belongs on the object-view node itself.');
175+
expect(message).not.toContain('retired spelling');
176+
});
177+
});

‎ui/packages/types/src/zod/objectql.zod.ts‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,9 +1153,14 @@ const TABLE_KEY_RECORD_SOURCE =
11531153
const TABLE_KEY_ROW_CLICK =
11541154
'the view hands its grid its own row-click handler, which the grid obeys first. '
11551155
+ 'Write `navigation` / `onNavigate` on the object-view node itself.';
1156+
const TABLE_KEY_NODE_LEVEL_COMPONENT =
1157+
'the view draws its grid as a component, not as a schema node, so no renderer applies a node-level key to it.';
11561158
const TABLE_KEY_NODE_LEVEL =
1157-
'the view draws its grid as a component, not as a schema node, so no renderer applies a node-level key to it. '
1158-
+ 'A node-level key belongs on the object-view node itself.';
1159+
`${TABLE_KEY_NODE_LEVEL_COMPONENT} A node-level key belongs on the object-view node itself.`;
1160+
// `visibleOn` / `hiddenOn` / `disabledOn` carry their own reason below, not
1161+
// `TABLE_KEY_NODE_LEVEL`: that one sends the key to the object-view node, where
1162+
// the spelling is itself retired (objectstack#25926), so the remedy has to name
1163+
// the surviving node key (`visibleWhen` / `hidden` / `disabled`).
11591164

11601165
const OBJECT_VIEW_TABLE_WITHHELD = {
11611166
ariaLabel: tableKeyRefusal('ariaLabel', TABLE_KEY_NODE_LEVEL),
@@ -1168,10 +1173,18 @@ const OBJECT_VIEW_TABLE_WITHHELD = {
11681173
dataSource: tableKeyRefusal('dataSource', TABLE_KEY_RECORD_SOURCE),
11691174
description: tableKeyRefusal('description', `${TABLE_KEY_NOT_RELAYED} Write \`description\` on the object-view node itself.`),
11701175
disabled: tableKeyRefusal('disabled', TABLE_KEY_NODE_LEVEL),
1171-
disabledOn: tableKeyRefusal('disabledOn', TABLE_KEY_NODE_LEVEL),
1176+
disabledOn: tableKeyRefusal(
1177+
'disabledOn',
1178+
`${TABLE_KEY_NODE_LEVEL_COMPONENT} \`disabledOn\` is also a retired spelling (a \`?: never\` tombstone on \`BaseSchema\`): `
1179+
+ 'write `disabled` on the object-view node itself; the value is unchanged.',
1180+
),
11721181
emptyState: tableKeyRefusal('emptyState', TABLE_KEY_NOT_RELAYED),
11731182
hidden: tableKeyRefusal('hidden', TABLE_KEY_NODE_LEVEL),
1174-
hiddenOn: tableKeyRefusal('hiddenOn', TABLE_KEY_NODE_LEVEL),
1183+
hiddenOn: tableKeyRefusal(
1184+
'hiddenOn',
1185+
`${TABLE_KEY_NODE_LEVEL_COMPONENT} \`hiddenOn\` is also a retired spelling (a \`?: never\` tombstone on \`BaseSchema\`): `
1186+
+ 'write `hidden` on the object-view node itself; the value is unchanged.',
1187+
),
11751188
id: tableKeyRefusal('id', 'the view fixes its grid\'s identity, as it fixes `type` and `objectName`.'),
11761189
keyboardNavigation: tableKeyRefusal('keyboardNavigation', TABLE_KEY_NOT_RELAYED),
11771190
name: tableKeyRefusal('name', TABLE_KEY_UNREAD),
@@ -1196,7 +1209,11 @@ const OBJECT_VIEW_TABLE_WITHHELD = {
11961209
style: tableKeyRefusal('style', TABLE_KEY_NODE_LEVEL),
11971210
testId: tableKeyRefusal('testId', TABLE_KEY_NODE_LEVEL),
11981211
visible: tableKeyRefusal('visible', TABLE_KEY_NODE_LEVEL),
1199-
visibleOn: tableKeyRefusal('visibleOn', TABLE_KEY_NODE_LEVEL),
1212+
visibleOn: tableKeyRefusal(
1213+
'visibleOn',
1214+
`${TABLE_KEY_NODE_LEVEL_COMPONENT} \`visibleOn\` is also a retired spelling (a \`?: never\` tombstone on \`BaseSchema\`): `
1215+
+ 'write `visibleWhen` on the object-view node itself; the value is unchanged.',
1216+
),
12001217
visibleWhen: tableKeyRefusal('visibleWhen', TABLE_KEY_NODE_LEVEL),
12011218
};
12021219

0 commit comments

Comments
 (0)