Skip to content

Commit b2eea18

Browse files
committed
refactor(plugin-calendar,plugin-gantt)!: retire the flat fallback read; the calendar and gantt renderers read the block only
getCalendarConfig and getGanttConfig read the `calendar` / `gantt` block and nothing flat. The package-local ObjectCalendarFlatFields / ObjectCalendarHandoff types are gone; ObjectGanttFlatFields shrinks to ObjectGanttSearchFields (the `search` / `searchableFields` pair ListView writes at runtime). A flat node reaches the configuration-required screen, which names the block, and the gantt dev warning names every flat key it did not read. The renderer tests that authored flat nodes move to the block form. The spec's object-calendar / object-gantt refusals drop the clause that the renderer still reads the flat spelling, and three comment polishes from the item-1 review land with it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzevL8Q6rTfGz2XHXGT
1 parent 4b8f8cd commit b2eea18

38 files changed

Lines changed: 677 additions & 813 deletions
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@object-ui/plugin-calendar': minor
3+
'@object-ui/plugin-gantt': minor
4+
'@objectstack/spec': patch
5+
---
6+
7+
refactor(plugin-calendar,plugin-gantt)!: the calendar and gantt renderers read their binding from the `calendar` / `gantt` block only; the flat fallback read is retired (#25923)
8+
9+
Clause-②: no (narrowing)
10+
Metadata-protocol: none
11+
12+
<!-- adr-0087: not-required (no-migration-prescription) No `@objectstack/spec` key, accepted value, stored row or stored shape moves. The spec's `ComponentPropsMap['object-calendar']` and `['object-gantt']` rows already refuse every flat key this change stops reading, `@object-ui/types` stopped declaring them in the earlier slice of #25923, and both producers in the console (`ListView` and `ObjectView`) already write the block, so no metadata the spec accepts reaches the retired read. A stored-row census over every metadata source this repository reaches (examples, apps, the console's shipped metadata, seeds, fixtures, platform-objects) found no stored view or node that writes the binding flat, so `objectstack migrate meta` has nothing to rewrite. What narrows is the drawing outcome for a host that mounts `ObjectCalendar` or `ObjectGantt` directly with a flat node: it now reaches the refusal screen. The `@objectstack/spec` half is prose only: the two refusals no longer say the renderer still reads the flat spelling. The other categories are closed on facts: the packages publish (not unpublished); no ADR-0087 id covers this change (not registered or already-registered); the narrowed type members are package-local hand-off types that neither package's entry exports (not type-surface-only or runtime-export-retired). -->
13+
14+
`ObjectCalendar` and `ObjectGantt` kept a second, flat reading of their field binding for a host that mounts them directly with the keys written on the node. The spec refuses those keys on the node, `@object-ui/types` no longer declares them, and no producer writes them, so that read was a second dialect nothing should reach. It is retired.
15+
16+
- **`@object-ui/plugin-calendar`**: `getCalendarConfig` reads the `calendar` block only. A node that writes `startDateField`, `endDateField`, `titleField`, `colorField` or `allDayField` flat, with no block, shows the "Calendar configuration required" screen, whose hint names the `calendar` block. The package-local `ObjectCalendarFlatFields` and `ObjectCalendarHandoff` types are gone, and `ObjectCalendarProps['schema']` is the published `ObjectCalendarSchema`.
17+
- **`@object-ui/plugin-gantt`**: `getGanttConfig` reads the `gantt` block only. A node that writes its `GanttConfig` keys flat, with no block, shows the "Gantt configuration required" screen, which now names the `gantt` block, and in development a warning names every flat key the chart did not read, with or without a block beside it. The legacy singular `dependencyField` is read nowhere (the spec spells it `dependenciesField`, inside the block). The package-local `ObjectGanttFlatFields` type is gone; `ObjectGanttProps['schema']` keeps the two search keys `ListView` writes at runtime, now on `ObjectGanttSearchFields`.
18+
- **`@objectstack/spec`**: the `object-calendar` and `object-gantt` flat-key refusals no longer say the renderer still reads the flat spelling. The prescription is unchanged: write the keys in the `calendar` / `gantt` block.
19+
20+
**BREAKING** for code that mounts `<ObjectCalendar>` or `<ObjectGantt>` with a flat node.
21+
22+
- **Before.** `<ObjectGantt schema={{ type: 'object-gantt', objectName: 'task', startDateField: 's', endDateField: 'e' }} />` drew a chart, and the flat keys compiled against `ObjectGanttProps['schema']`.
23+
- **Now.** The flat keys are a compile error on the props type, and the node shows the configuration-required screen.
24+
- **Fix.** Write the binding in the block: `{ type: 'object-gantt', objectName: 'task', gantt: { startDateField: 's', endDateField: 'e', titleField: 'name' } }` (the `gantt` block requires `titleField`; the flat branch used to floor it at `'name'`), and `{ type: 'object-calendar', calendar: { startDateField: 'start' } }` for a calendar.

‎packages/spec/src/ui/component.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3290,9 +3290,9 @@ describe('object-* block props schemas — declared, so the props gate has a sch
32903290
});
32913291

32923292
it("object-calendar's flat field spellings get the wrong-layer prescription, not a rename", () => {
3293-
// Read as back-compat by getCalendarConfig, emitted by ObjectView/ListView
3294-
// handoffs — but the authored spelling is the `calendar` object (one key
3295-
// per concept; the `body` → `children` precedent).
3293+
// Not read by getCalendarConfig since objectstack#25923, and not emitted by
3294+
// ObjectView/ListView — the authored spelling is the `calendar` object (one
3295+
// key per concept; the `body` → `children` precedent).
32963296
const message = refuse(ComponentPropsMap['object-calendar'], { objectName: 'task', startDateField: 'due_date' });
32973297
expect(message).toContain('`calendar`');
32983298
expect(message).toContain('startDateField');

‎packages/spec/src/ui/component.zod.ts‎

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6042,15 +6042,13 @@ export type ObjectKanbanProps = z.input<typeof ObjectKanbanPropsSchema>;
60426042
export type ObjectKanbanPropsParsed = z.infer<typeof ObjectKanbanPropsSchema>;
60436043

60446044
/**
6045-
* The flat per-field spellings `ObjectCalendar` keeps reading as a
6046-
* stored-document fallback (`getCalendarConfig`; read points recorded in
6047-
* `liveness/page.json`, row `regions`). `ObjectView`/`ListView` hand the
6048-
* binding off in the `calendar` block, not flat (objectstack#25923), and the
6049-
* flat keys live on `plugin-calendar`'s own hand-off type, not on
6050-
* `@object-ui/types`' `ObjectCalendarSchema`. Read, but
6051-
* NOT authorable — one composition key per concept (Prime Directive #12, the
6052-
* `body` → `children` precedent on {@link PageContainerProps}): the authored
6053-
* spelling is the `calendar` object.
6045+
* The flat per-field spellings of the `calendar` block, refused on the node.
6046+
* `ObjectView`/`ListView` hand the binding off in the `calendar` block, not
6047+
* flat, `@object-ui/types`' `ObjectCalendarSchema` declares none of them, and
6048+
* `ObjectCalendar`'s `getCalendarConfig` no longer reads them either: its flat
6049+
* fallback retired with objectstack#25923. NOT authorable — one composition
6050+
* key per concept (Prime Directive #12, the `body` → `children` precedent on
6051+
* {@link PageContainerProps}): the authored spelling is the `calendar` object.
60546052
*/
60556053
const OBJECT_CALENDAR_FLAT_FIELD_GUIDANCE: readonly KeySetGuidance[] = [
60566054
...COMPONENT_LEVEL_GUIDANCE,
@@ -6061,8 +6059,8 @@ const OBJECT_CALENDAR_FLAT_FIELD_GUIDANCE: readonly KeySetGuidance[] = [
60616059
prescription:
60626060
'Write this as a key of the `calendar` config object instead — `calendar: { startDateField, '
60636061
+ 'endDateField, titleField, colorField, allDayField }`. `ObjectView`/`ListView` hand the binding '
6064-
+ 'off in that block too; the flat spelling is only a stored-document fallback the renderer still '
6065-
+ 'reads, not a second authorable spelling (one key per concept, Prime Directive #12).',
6062+
+ 'off in that block too, and the renderer reads the binding there only: the flat spelling is not '
6063+
+ 'read and not a second authorable spelling (one key per concept, Prime Directive #12).',
60666064
},
60676065
];
60686066

@@ -7373,26 +7371,21 @@ export type ObjectMapProps = z.input<typeof ObjectMapPropsSchema>;
73737371
export type ObjectMapPropsParsed = z.infer<typeof ObjectMapPropsSchema>;
73747372

73757373
/**
7376-
* The flat `GanttConfig` spellings `getGanttConfig`'s branch 2 reads as a
7377-
* stored-document fallback — objectui's own `FLAT_GANTT_CONFIG_KEYS` (read
7378-
* points recorded in `liveness/page.json`, row `regions`). `ObjectView` /
7379-
* `ListView` hand the binding off in the `gantt` block, not flat
7380-
* (objectstack#25923). Read, but
7381-
* NOT authorable, for the reason the map's twin set above records: objectui#6469
7382-
* inherited the objectui#5018 ruling for this block, so the `gantt` block is the
7383-
* authoring shape, it is taken WHOLE when present, and every flat key beside it
7384-
* is named as ignored in a dev warning.
7374+
* The flat `GanttConfig` spellings, refused on the node — objectui's own
7375+
* `FLAT_GANTT_CONFIG_KEYS`. `ObjectView` / `ListView` hand the binding off in
7376+
* the `gantt` block, not flat, and `getGanttConfig` reads that block only: its
7377+
* flat fallback branch retired with objectstack#25923. NOT authorable, for the
7378+
* reason the map's twin set above records: objectui#6469 inherited the
7379+
* objectui#5018 ruling for this block, so the `gantt` block is the authoring
7380+
* shape, it is taken WHOLE, and a dev warning names every flat key as not read.
73857381
*
7386-
* The block branch is the path both view layers take — they hand the `gantt`
7387-
* block on whole — and the flat branch is only the stored-document fallback.
73887382
* The prescription still matters: an author who met the flat spelling in an
7389-
* older stored document writes it on an SDUI node next. The flat keys live on
7390-
* `plugin-gantt`'s package-local hand-off type (`ObjectGanttFlatFields`), not
7391-
* on `@object-ui/types`' `ObjectGanttSchema`, which declares only the block.
7383+
* older document writes it on an SDUI node next. `@object-ui/types`'
7384+
* `ObjectGanttSchema` declares only the block.
73927385
*
73937386
* Membership is `GanttConfigSchema`'s own shape plus the legacy singular
7394-
* `dependencyField` alias the flat branch still reads beside `dependenciesField`
7395-
* — the same two halves objectui derives its list from. Spelled out rather than
7387+
* `dependencyField` alias of `dependenciesField` — the same two halves objectui
7388+
* derives its list from. Spelled out rather than
73967389
* read off `GanttConfigSchema.shape` here because that schema is a
73977390
* {@link lazySchema} proxy and forcing it at module load would build `view.zod`
73987391
* mid-initialisation (the import-cycle footgun `ruleArrayFilterError` defers
@@ -7413,10 +7406,9 @@ const OBJECT_GANTT_FLAT_CONFIG_GUIDANCE: readonly KeySetGuidance[] = [
74137406
examples: ['startDateField', 'endDateField', 'viewMode'],
74147407
prescription:
74157408
'Write this as a key of the `gantt` config object instead — `gantt: { startDateField, endDateField, '
7416-
+ 'titleField, ... }`. `ObjectView`/`ListView` hand the binding off in that block too; the flat '
7417-
+ 'top-level spelling is only a stored-document fallback the renderer still reads, not a second '
7418-
+ 'authoring spelling: whenever a `gantt` block is present the renderer takes it WHOLE and names '
7419-
+ 'every flat key beside it as ignored. The '
7409+
+ 'titleField, ... }`. `ObjectView`/`ListView` hand the binding off in that block too, and the '
7410+
+ 'renderer reads the binding there only: the flat top-level spelling is not read and not a second '
7411+
+ 'authoring spelling. The '
74207412
+ 'legacy singular `dependencyField` is `dependenciesField` inside that block.',
74217413
},
74227414
];
@@ -7483,8 +7475,8 @@ function objectGanttMarker() {
74837475
* `showBaselines`, `readOnly` (the chart and the record overlay's lock) and
74847476
* `mobileReadOnly`.
74857477
*
7486-
* Measured and deliberately NOT declared: the flat `GanttConfig` spellings (the
7487-
* stored-document fallback — {@link OBJECT_GANTT_FLAT_CONFIG_GUIDANCE}); `title`, which
7478+
* Measured and deliberately NOT declared: the flat `GanttConfig` spellings (not
7479+
* read since objectstack#25923 — {@link OBJECT_GANTT_FLAT_CONFIG_GUIDANCE}); `title`, which
74887480
* this renderer never reads (the export-name chain is `gantt.exportFileName` →
74897481
* `label` → the OBJECT's label → `objectName`); a row cap — the reload's `$top`
74907482
* is the platform ceiling, spread in as core's `nonGridRowCeilingQuery()` (one
@@ -7494,8 +7486,8 @@ function objectGanttMarker() {
74947486
* props. ⚠️ Recorded, not ruled: objectui#10250 gave the renderer two more
74957487
* reads, `search` and `searchableFields` (sent as `$search` / `$searchFields`),
74967488
* which `ListView` writes onto the node it generates from its toolbar Search
7497-
* box (its `case 'gantt'` arm) — a host-generated key pair in the same position
7498-
* as the flat fallback spellings, and not declared here.
7489+
* box (its `case 'gantt'` arm) — a host-generated key pair, and not declared
7490+
* here.
74997491
*
75007492
* VALUE posture: `gantt` is the one config block in this family whose value
75017493
* contract is already the SPEC's — the renderer validates it against

‎ui/packages/plugin-calendar/README.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,9 @@ this. `@objectstack/spec` refuses them at authoring with `unrecognized_keys` and
325325
names the `calendar` block in the same diagnostic (one key per concept, its
326326
Prime Directive #12), and since objectstack#25923 `ObjectCalendarSchema` does
327327
not declare them flat either: `ObjectView` and `ListView` emit the `calendar`
328-
block on the node they build. `getCalendarConfig` still falls back to the flat
329-
spelling when a node has no `calendar` block, for a host that mounts the
330-
renderer directly; that read is typed on this package's own hand-off type,
331-
`ObjectCalendarHandoff`, not on the published schema.
328+
block on the node they build. The renderer does not read the flat spelling
329+
either: a node that carries the five flat keys and no `calendar` block reaches
330+
the "Calendar configuration required" screen, which names the block.
332331

333332
```typescript
334333
import type { ObjectCalendarSchema } from '@object-ui/types';

‎ui/packages/plugin-calendar/src/CalendarView.popoverLocale-10747.test.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ describe('object-calendar — an AUTHORED `locale` reaches the header popover (o
144144
type: 'plugin-calendar:object-calendar',
145145
id: 'n',
146146
objectName: 'accounts',
147-
startDateField: 'start_at',
148-
titleField: 'name',
147+
calendar: {
148+
startDateField: 'start_at',
149+
titleField: 'name',
150+
},
149151
data: [{ id: 'r1', name: 'Standup', start_at: new Date(2020, 2, 10, 10).toISOString() }],
150152
...extra,
151153
} as never

‎ui/packages/plugin-calendar/src/ObjectCalendar.quickCreateHandoff-12291.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ describe('objectui#12291 — an object quick-create cannot satisfy hands the day
202202
render(
203203
<SchemaRendererProvider dataSource={ds}>
204204
<SchemaRenderer
205-
schema={{ type: 'object-calendar', id: 'n', objectName: 'showcase_task', startDateField: 'due_date', titleField: 'title' } as never}
205+
schema={{ type: 'object-calendar', id: 'n', objectName: 'showcase_task', calendar: { startDateField: 'due_date', titleField: 'title' } } as never}
206206
data={[]}
207207
onEdit={onEdit}
208208
/>

‎ui/packages/plugin-calendar/src/ObjectCalendar.refusalRemedy-8170.test.tsx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ describe('ObjectCalendar refusal screen — the remedy it states (objectui#8170)
145145
{
146146
type: 'object-calendar',
147147
objectName: 'crm_leave_request',
148-
startDateField: 'start_date',
149-
titleField: 'name',
148+
calendar: {
149+
startDateField: 'start_date',
150+
titleField: 'name',
151+
},
150152
} as any
151153
}
152154
dataSource={makeDataSource()}
@@ -168,7 +170,9 @@ describe('ObjectCalendar refusal screen — the remedy it states (objectui#8170)
168170
{
169171
type: 'object-calendar',
170172
objectName: 'crm_leave_request',
171-
startDateField: 'start_date',
173+
calendar: {
174+
startDateField: 'start_date',
175+
},
172176
} as any
173177
}
174178
dataSource={makeDataSource()}

0 commit comments

Comments
 (0)