Skip to content

Commit 6001470

Browse files
committed
test(plugin-calendar,plugin-gantt,types): move the last flat-bound renderer and mirror nodes to the block; read the unread flat keys with Reflect.get
An after-change census found five more test nodes written flat (a gantt expand test, the console filter-token sweep, a calendar invalidation test and two @object-ui/types mirror pins). They now write the block. Three comments that still said the renderer reads the binding flat are rewritten. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzevL8Q6rTfGz2XHXGT
1 parent 38acf25 commit 6001470

8 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎ui/apps/console/src/__tests__/filterContextTokensSweep-10666.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ const ROWS: NodeRow[] = [
209209
// this block (objectui#8348); its `data` row is the array arm.
210210
withFilter: top({ type: 'object-calendar', calendar: CALENDAR, staticData: [{ ...ROW }] }) },
211211
{ node: 'object-gantt', shape: 'tuple', path: 'dataSource', filterParam: '$filter',
212-
withFilter: top({ type: 'object-gantt', objectName: OBJECT, titleField: 'name', startDateField: 'start', endDateField: 'end' }) },
212+
withFilter: top({ type: 'object-gantt', objectName: OBJECT, gantt: { titleField: 'name', startDateField: 'start', endDateField: 'end' } }) },
213213
{ node: 'object-kanban', shape: 'tuple', path: 'dataSource', filterParam: '$filter',
214214
withFilter: top({ type: 'object-kanban', objectName: OBJECT, groupBy: 'status', columns: [{ id: 'open', title: 'Open' }] }) },
215215
{ node: 'object-map (object)', shape: 'tuple', path: 'dataSource', filterParam: '$filter',

‎ui/packages/plugin-calendar/src/ObjectCalendar.invalidationRefetch-10572.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const renderBlock = (schema: Record<string, unknown>, ds: ReturnType<typeof make
5757
</SchemaRendererProvider>,
5858
);
5959

60-
const BLOCK = { type: 'object-calendar', objectName: 'event', dateField: 'due', titleField: 'name' };
60+
const BLOCK = { type: 'object-calendar', objectName: 'event', calendar: { startDateField: 'due', titleField: 'name' } };
6161

6262
describe('object-calendar re-reads on the data-invalidation bus (objectui#10572)', () => {
6363
it('an unscoped change (objectName "*") re-runs its query once', async () => {

‎ui/packages/plugin-gantt/src/ObjectGantt.expandFls-7230.test.tsx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ const TASK_FIELDS: Record<string, any> = {
104104
const GANTT_SCHEMA = {
105105
type: 'gantt',
106106
objectName: 'task',
107-
startDateField: 'start',
108-
endDateField: 'end',
109-
titleField: 'name',
107+
gantt: { startDateField: 'start', endDateField: 'end', titleField: 'name' },
110108
} as any;
111109

112110
function makeDataSource() {

‎ui/packages/plugin-gantt/src/ObjectGantt.tsx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,9 @@ const warnedFlatGanttKeys = new Set<string>();
578578
function warnOnFlatGanttKeys(schema: ObjectGanttHandoff): void {
579579
if (!isDev()) return;
580580

581-
// The keys are read through a record view: none of them is declared on the
582-
// node any more, which is the point of the warning.
583-
const node = schema as Record<string, unknown>;
584-
const flat = FLAT_GANTT_CONFIG_KEYS.filter((key) => node[key] !== undefined);
581+
// The keys are read by name with `Reflect.get`: none of them is declared on
582+
// the node any more, which is the point of the warning.
583+
const flat = FLAT_GANTT_CONFIG_KEYS.filter((key) => Reflect.get(schema, key) !== undefined);
585584
if (flat.length === 0) return;
586585

587586
const memo = `${schema.type ?? 'gantt'}::${schema.objectName ?? ''}::${flat.join(',')}`;

‎ui/packages/types/src/__tests__/gantt-declared-keys.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ import type { ObjectGanttSchema as ObjectGanttSchemaTS } from '../objectql.js';
5656
const MINIMAL = {
5757
type: 'object-gantt',
5858
objectName: 'task',
59-
startDateField: 'start',
60-
endDateField: 'end',
59+
gantt: { startDateField: 'start', endDateField: 'end', titleField: 'name' },
6160
} as const;
6261

6362
/** The ten keys this card declared, each with a value its declared type refuses. */

‎ui/packages/types/src/__tests__/object-kanban-calendar-navigation-8652.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const ARMS: Arm[] = [
9191
{
9292
type: 'object-calendar',
9393
mirror: CalendarMirror as unknown as Parser,
94-
base: { type: 'object-calendar', objectName: 'event', startDateField: 'starts_at' },
94+
base: { type: 'object-calendar', objectName: 'event', calendar: { startDateField: 'starts_at' } },
9595
},
9696
];
9797

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3839,8 +3839,10 @@ export interface ObjectTreeSchema extends BaseSchema {
38393839
* (`ObjectView` and `ListView` lowering a stored gantt view into the node's
38403840
* `gantt` block, a host mounting `<ObjectGantt schema={…}>`). Since
38413841
* objectstack#25923 it carries no flat `GanttConfig` key and no `search` pair:
3842-
* the spec refuses those on the node, and what the renderer still reads flat
3843-
* is `plugin-gantt`'s package-local hand-off type.
3842+
* the spec refuses those on the node, and the renderer reads none of them flat.
3843+
* The one pair it does read flat, the toolbar's `search` / `searchableFields`
3844+
* that `ListView` writes at runtime, is `plugin-gantt`'s package-local
3845+
* hand-off type.
38443846
*
38453847
* It is NOT the shape of an AUTHORED `object-gantt` document. An authored node
38463848
* takes its props in the spec's `properties` bag, whose members are
@@ -4174,8 +4176,8 @@ export interface ObjectCalendarSchema extends BaseSchema {
41744176
* concept, the spec's Prime Directive #12). This interface declares none of
41754177
* the five flat, so a fresh literal carrying one is a compile error; both
41764178
* producers (`ListView`, and `ObjectView`'s `generateViewSchema`) emit this
4177-
* block. The flat fallback `getCalendarConfig` still reads is typed on
4178-
* `plugin-calendar`'s package-local hand-off type (Commandment #0.1).
4179+
* block, and it is the one spelling `getCalendarConfig` reads: its flat
4180+
* fallback retired in objectstack#25923.
41794181
*
41804182
* `@objectstack/spec` declares the KEY and, since 17.7.0, its SHAPE:
41814183
* `ComponentPropsMap['object-calendar'].calendar` is a strict copy of the list

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2972,8 +2972,10 @@ export const ObjectGanttSchema = BaseSchema.extend({
29722972
// members of this mirror. `ComponentPropsMap['object-gantt']` refuses every
29732973
// one of them on the node; the `gantt` block below is their one spelling, and
29742974
// both producers (`ListView`, `ObjectView`'s `generateViewSchema`) emit it.
2975-
// What the renderer still reads flat lives on `plugin-gantt`'s package-local
2976-
// hand-off type (Commandment #0.1), off this published face.
2975+
// The one pair the renderer reads flat, the toolbar's `search` /
2976+
// `searchableFields` that `ListView` writes at runtime, lives on
2977+
// `plugin-gantt`'s package-local hand-off type (Commandment #0.1), off this
2978+
// published face.
29772979
//
29782980
// objectui#5903 — ten keys `ObjectGantt` reads and this mirror did not
29792981
// declare. They were reachable only through `(schema as any).K`, so nothing

0 commit comments

Comments
 (0)