diff --git a/.changeset/36544-form-view-modal-size-retired.md b/.changeset/36544-form-view-modal-size-retired.md new file mode 100644 index 00000000000..ccfad430902 --- /dev/null +++ b/.changeset/36544-form-view-modal-size-retired.md @@ -0,0 +1,28 @@ +--- +'@objectstack/spec': minor +'@objectstack/skills': patch +--- + +feat(spec)!: a form view no longer declares `modalSize`; no form view opens in a dialog, so nothing read the key there + +Clause-②: yes (narrowing) + +Metadata-protocol: narrowed + + + +**BREAKING** accept-set narrowing on the form view surface (`@objectstack/spec`), ADR-0049 enforce-or-remove. + +The one reader of a form view's `modalSize` was the console's New / Edit record dialog, which copied it from the object's internal form view. Through 18.6.0 that dialog opened at the authored size. From 19.0.0 it loads no form view (the `internal-record-forms-not-loaded` entry): it lays a record out by the object's `fieldGroups` and chooses its own size. A form opened by name, or by a public link, gets a page of its own. So on 19 a form view saved with `modalSize: 'lg'` is accepted, served and drawn exactly as one without it. + +- **FROM → TO.** `form: { …, modalSize }` (and `formViews.`, a form view item's `config`, a `form` item) → `form: { … }`. Nothing on the form replaces it. The record dialog picks its size from the number of fields it draws, and the person filling it in can maximize it; a React page that opens a form in a modal writes the prop on the block, `ObjectForm` with `formType='modal'`. +- **The one-line fix.** Delete `modalSize` from the form view. `os migrate meta --from 18` lists the edits for existing sources, and `--write` applies them. A stored `sys_metadata` row is converted when it is read (the `form-view-modal-size-removed` conversion), so a form view saved with the key keeps loading, and deleting it changes nothing a reader sees on 19. +- **Coming from 18.x.** A New or Edit dialog whose form set `modalSize` opened at that size through 18.6.0. On 19 it opens at the size the dialog chooses from the number of fields it draws. No key restores the authored size. +- **What the parse says.** "`view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a dialog, so nothing reads it from a form view. …", at every form view door (a view's `form` and `formViews.*`, a form view item record, a flattened form overlay, a `form` item) and at `defineStack` as `STACK_SCHEMA_INVALID` / 422. TypeScript rejects the key at the authoring site. +- **Unchanged.** The React `ObjectForm` block still takes `modalSize` for the modal it opens with `formType='modal'`: the react-tier contract now declares it on the block itself, with the same type. The `object-form` page block keeps it in its own props. A form view's `subforms` is not touched by this change. + +The retirement kit: the `retiredKey()` tombstone on `FormViewSchema` (the `form` item takes it by reference); the D2 conversion `form-view-modal-size-removed` (protocol 19, retired from the load path, reaching `form`, `formViews.*`, form view items, flattened form overlays and `forms[]`); `RETIRED_KEYS_BY_MAJOR[19]` rows `ui/FormView:modalSize` and `ui/Form:modalSize`; the D3 entry `ui-form-view-modal-size-retired`; the liveness rows `view.json` `form.modalSize` and `form.json` `modalSize`, now `dead`. + +Also corrected: the protocol-18 D3 entry `ui-form-view-type-layout-only` said the console's New and Edit dialogs were "sized by `modalSize`". They choose their own size, and the entry now says so. + +`@objectstack/skills`: `skills/objectstack-ui/references/react-blocks.md` is regenerated. ``'s `modalSize` is listed as a binding prop from the block's overlay, no longer as a data prop from the form view schema. diff --git a/content/docs/references/api/protocol.mdx b/content/docs/references/api/protocol.mdx index 49fae8703c1..12f60fbdef0 100644 --- a/content/docs/references/api/protocol.mdx +++ b/content/docs/references/api/protocol.mdx @@ -2065,7 +2065,7 @@ The published metadata item body, opaque by ruling (1C). Shape is the item's own | **splitResizable** | `never` | optional | [REMOVED] `view.form.splitResizable` was removed in @objectstack/spec 18.3.0 (ADR-0050) — it made the panes of a `type: 'split'` form resizable, and `split` left the form view `type` in the same release, so no form view draws panes. Delete the key. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerSide** | `never` | optional | [REMOVED] `view.form.drawerSide` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it. Delete the key: an object's list opens a record in its drawer from the hover icon, and the React `ObjectForm` block keeps its own `drawerSide` prop for the drawer it opens with `formType='drawer'`. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerWidth** | `never` | optional | [REMOVED] `view.form.drawerWidth` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it, and a pixel width cannot be chosen without knowing the client viewport. Delete the key: a list's record drawer takes its starting width from the `navigation.size` bucket, and the React `ObjectForm` block keeps its own `drawerWidth` prop for the drawer it opens. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | -| **modalSize** | `Enum<'sm' \| 'default' \| 'lg' \| 'xl' \| 'full'>` | optional | Size bucket of the dialog a caller opens this form in: the console's New / Edit dialog, or the modal container of the React `ObjectForm` block (formType 'modal') | +| **modalSize** | `never` | optional | [REMOVED] `view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a dialog, so nothing reads it from a form view. Delete the key: the console's New and Edit dialogs lay a record out by the object's `fieldGroups` and choose their own size, a form opened by name gets a page of its own, and the React `ObjectForm` block keeps its own `modalSize` prop for the modal it opens with `formType='modal'`. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **data** | `{ provider: 'object'; object: string } \| { provider: 'value'; items: any[] } \| { provider: 'schema'; schemaId: string; schema?: Record }` | optional | Data source configuration (defaults to "object" provider) | | **sections** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | | | **groups** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | [LEGACY ALIAS → `sections`] Accepted for back-compat and folded onto `sections` at parse; `sections` wins when both are present. Prefer `sections`. | @@ -2145,7 +2145,7 @@ The published metadata item body, opaque by ruling (1C). Shape is the item's own | **splitResizable** | `never` | optional | [REMOVED] `view.form.splitResizable` was removed in @objectstack/spec 18.3.0 (ADR-0050) — it made the panes of a `type: 'split'` form resizable, and `split` left the form view `type` in the same release, so no form view draws panes. Delete the key. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerSide** | `never` | optional | [REMOVED] `view.form.drawerSide` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it. Delete the key: an object's list opens a record in its drawer from the hover icon, and the React `ObjectForm` block keeps its own `drawerSide` prop for the drawer it opens with `formType='drawer'`. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerWidth** | `never` | optional | [REMOVED] `view.form.drawerWidth` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it, and a pixel width cannot be chosen without knowing the client viewport. Delete the key: a list's record drawer takes its starting width from the `navigation.size` bucket, and the React `ObjectForm` block keeps its own `drawerWidth` prop for the drawer it opens. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | -| **modalSize** | `Enum<'sm' \| 'default' \| 'lg' \| 'xl' \| 'full'>` | optional | Size bucket of the dialog a caller opens this form in: the console's New / Edit dialog, or the modal container of the React `ObjectForm` block (formType 'modal') | +| **modalSize** | `never` | optional | [REMOVED] `view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a dialog, so nothing reads it from a form view. Delete the key: the console's New and Edit dialogs lay a record out by the object's `fieldGroups` and choose their own size, a form opened by name gets a page of its own, and the React `ObjectForm` block keeps its own `modalSize` prop for the modal it opens with `formType='modal'`. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **data** | `{ provider: 'object'; object: string } \| { provider: 'value'; items: any[] } \| { provider: 'schema'; schemaId: string; schema?: Record }` | optional | Data source configuration (defaults to "object" provider) | | **sections** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | | | **groups** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | [LEGACY ALIAS → `sections`] Accepted for back-compat and folded onto `sections` at parse; `sections` wins when both are present. Prefer `sections`. | diff --git a/content/docs/references/ui/view.mdx b/content/docs/references/ui/view.mdx index 0a7a0317890..72322992ec4 100644 --- a/content/docs/references/ui/view.mdx +++ b/content/docs/references/ui/view.mdx @@ -209,7 +209,7 @@ Column footer summary configuration | **splitResizable** | `never` | optional | [REMOVED] `view.form.splitResizable` was removed in @objectstack/spec 18.3.0 (ADR-0050) — it made the panes of a `type: 'split'` form resizable, and `split` left the form view `type` in the same release, so no form view draws panes. Delete the key. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerSide** | `never` | optional | [REMOVED] `view.form.drawerSide` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it. Delete the key: an object's list opens a record in its drawer from the hover icon, and the React `ObjectForm` block keeps its own `drawerSide` prop for the drawer it opens with `formType='drawer'`. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerWidth** | `never` | optional | [REMOVED] `view.form.drawerWidth` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it, and a pixel width cannot be chosen without knowing the client viewport. Delete the key: a list's record drawer takes its starting width from the `navigation.size` bucket, and the React `ObjectForm` block keeps its own `drawerWidth` prop for the drawer it opens. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | -| **modalSize** | `Enum<'sm' \| 'default' \| 'lg' \| 'xl' \| 'full'>` | optional | Size bucket of the dialog a caller opens this form in: the console's New / Edit dialog, or the modal container of the React `ObjectForm` block (formType 'modal') | +| **modalSize** | `never` | optional | [REMOVED] `view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a dialog, so nothing reads it from a form view. Delete the key: the console's New and Edit dialogs lay a record out by the object's `fieldGroups` and choose their own size, a form opened by name gets a page of its own, and the React `ObjectForm` block keeps its own `modalSize` prop for the modal it opens with `formType='modal'`. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **sections** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | | | **groups** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | [LEGACY ALIAS → `sections`] Accepted for back-compat and folded onto `sections` at parse; `sections` wins when both are present. Prefer `sections`. | | **subforms** | `{ childObject: string; relationshipField?: string; columns?: object[]; amountField?: string; … }[]` | optional | Inline master-detail child collections | @@ -544,7 +544,7 @@ Form-view select option — the object-field option shape minus the per-option ` | **splitResizable** | `never` | optional | [REMOVED] `view.form.splitResizable` was removed in @objectstack/spec 18.3.0 (ADR-0050) — it made the panes of a `type: 'split'` form resizable, and `split` left the form view `type` in the same release, so no form view draws panes. Delete the key. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerSide** | `never` | optional | [REMOVED] `view.form.drawerSide` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it. Delete the key: an object's list opens a record in its drawer from the hover icon, and the React `ObjectForm` block keeps its own `drawerSide` prop for the drawer it opens with `formType='drawer'`. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerWidth** | `never` | optional | [REMOVED] `view.form.drawerWidth` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it, and a pixel width cannot be chosen without knowing the client viewport. Delete the key: a list's record drawer takes its starting width from the `navigation.size` bucket, and the React `ObjectForm` block keeps its own `drawerWidth` prop for the drawer it opens. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | -| **modalSize** | `Enum<'sm' \| 'default' \| 'lg' \| 'xl' \| 'full'>` | optional | Size bucket of the dialog a caller opens this form in: the console's New / Edit dialog, or the modal container of the React `ObjectForm` block (formType 'modal') | +| **modalSize** | `never` | optional | [REMOVED] `view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a dialog, so nothing reads it from a form view. Delete the key: the console's New and Edit dialogs lay a record out by the object's `fieldGroups` and choose their own size, a form opened by name gets a page of its own, and the React `ObjectForm` block keeps its own `modalSize` prop for the modal it opens with `formType='modal'`. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **data** | `{ provider: 'object'; object: string } \| { provider: 'value'; items: any[] } \| { provider: 'schema'; schemaId: string; schema?: Record }` | optional | Data source configuration (defaults to "object" provider) | | **sections** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | | | **groups** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | [LEGACY ALIAS → `sections`] Accepted for back-compat and folded onto `sections` at parse; `sections` wins when both are present. Prefer `sections`. | @@ -2196,7 +2196,7 @@ Tab configuration for multi-tab view interface | **splitResizable** | `never` | optional | [REMOVED] `view.form.splitResizable` was removed in @objectstack/spec 18.3.0 (ADR-0050) — it made the panes of a `type: 'split'` form resizable, and `split` left the form view `type` in the same release, so no form view draws panes. Delete the key. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerSide** | `never` | optional | [REMOVED] `view.form.drawerSide` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it. Delete the key: an object's list opens a record in its drawer from the hover icon, and the React `ObjectForm` block keeps its own `drawerSide` prop for the drawer it opens with `formType='drawer'`. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerWidth** | `never` | optional | [REMOVED] `view.form.drawerWidth` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it, and a pixel width cannot be chosen without knowing the client viewport. Delete the key: a list's record drawer takes its starting width from the `navigation.size` bucket, and the React `ObjectForm` block keeps its own `drawerWidth` prop for the drawer it opens. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | -| **modalSize** | `Enum<'sm' \| 'default' \| 'lg' \| 'xl' \| 'full'>` | optional | Size bucket of the dialog a caller opens this form in: the console's New / Edit dialog, or the modal container of the React `ObjectForm` block (formType 'modal') | +| **modalSize** | `never` | optional | [REMOVED] `view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a dialog, so nothing reads it from a form view. Delete the key: the console's New and Edit dialogs lay a record out by the object's `fieldGroups` and choose their own size, a form opened by name gets a page of its own, and the React `ObjectForm` block keeps its own `modalSize` prop for the modal it opens with `formType='modal'`. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **data** | `{ provider: 'object'; object: string } \| { provider: 'value'; items: any[] } \| { provider: 'schema'; schemaId: string; schema?: Record }` | optional | Data source configuration (defaults to "object" provider) | | **sections** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | | | **groups** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | [LEGACY ALIAS → `sections`] Accepted for back-compat and folded onto `sections` at parse; `sections` wins when both are present. Prefer `sections`. | @@ -2276,7 +2276,7 @@ Tab configuration for multi-tab view interface | **splitResizable** | `never` | optional | [REMOVED] `view.form.splitResizable` was removed in @objectstack/spec 18.3.0 (ADR-0050) — it made the panes of a `type: 'split'` form resizable, and `split` left the form view `type` in the same release, so no form view draws panes. Delete the key. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerSide** | `never` | optional | [REMOVED] `view.form.drawerSide` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it. Delete the key: an object's list opens a record in its drawer from the hover icon, and the React `ObjectForm` block keeps its own `drawerSide` prop for the drawer it opens with `formType='drawer'`. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerWidth** | `never` | optional | [REMOVED] `view.form.drawerWidth` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it, and a pixel width cannot be chosen without knowing the client viewport. Delete the key: a list's record drawer takes its starting width from the `navigation.size` bucket, and the React `ObjectForm` block keeps its own `drawerWidth` prop for the drawer it opens. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | -| **modalSize** | `Enum<'sm' \| 'default' \| 'lg' \| 'xl' \| 'full'>` | optional | Size bucket of the dialog a caller opens this form in: the console's New / Edit dialog, or the modal container of the React `ObjectForm` block (formType 'modal') | +| **modalSize** | `never` | optional | [REMOVED] `view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a dialog, so nothing reads it from a form view. Delete the key: the console's New and Edit dialogs lay a record out by the object's `fieldGroups` and choose their own size, a form opened by name gets a page of its own, and the React `ObjectForm` block keeps its own `modalSize` prop for the modal it opens with `formType='modal'`. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **data** | `{ provider: 'object'; object: string } \| { provider: 'value'; items: any[] } \| { provider: 'schema'; schemaId: string; schema?: Record }` | optional | Data source configuration (defaults to "object" provider) | | **sections** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | | | **groups** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | [LEGACY ALIAS → `sections`] Accepted for back-compat and folded onto `sections` at parse; `sections` wins when both are present. Prefer `sections`. | @@ -2616,7 +2616,7 @@ This schema accepts one of the following structures: | **splitResizable** | `never` | optional | [REMOVED] `view.form.splitResizable` was removed in @objectstack/spec 18.3.0 (ADR-0050) — it made the panes of a `type: 'split'` form resizable, and `split` left the form view `type` in the same release, so no form view draws panes. Delete the key. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerSide** | `never` | optional | [REMOVED] `view.form.drawerSide` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it. Delete the key: an object's list opens a record in its drawer from the hover icon, and the React `ObjectForm` block keeps its own `drawerSide` prop for the drawer it opens with `formType='drawer'`. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerWidth** | `never` | optional | [REMOVED] `view.form.drawerWidth` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it, and a pixel width cannot be chosen without knowing the client viewport. Delete the key: a list's record drawer takes its starting width from the `navigation.size` bucket, and the React `ObjectForm` block keeps its own `drawerWidth` prop for the drawer it opens. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | -| **modalSize** | `Enum<'sm' \| 'default' \| 'lg' \| 'xl' \| 'full'>` | optional | Size bucket of the dialog a caller opens this form in: the console's New / Edit dialog, or the modal container of the React `ObjectForm` block (formType 'modal') | +| **modalSize** | `never` | optional | [REMOVED] `view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a dialog, so nothing reads it from a form view. Delete the key: the console's New and Edit dialogs lay a record out by the object's `fieldGroups` and choose their own size, a form opened by name gets a page of its own, and the React `ObjectForm` block keeps its own `modalSize` prop for the modal it opens with `formType='modal'`. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **data** | `{ provider: 'object'; object: string } \| { provider: 'value'; items: any[] } \| { provider: 'schema'; schemaId: string; schema?: Record }` | optional | Data source configuration (defaults to "object" provider) | | **sections** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | | | **groups** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | [LEGACY ALIAS → `sections`] Accepted for back-compat and folded onto `sections` at parse; `sections` wins when both are present. Prefer `sections`. | @@ -2810,7 +2810,7 @@ This schema accepts one of the following structures: | **splitResizable** | `never` | optional | [REMOVED] `view.form.splitResizable` was removed in @objectstack/spec 18.3.0 (ADR-0050) — it made the panes of a `type: 'split'` form resizable, and `split` left the form view `type` in the same release, so no form view draws panes. Delete the key. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerSide** | `never` | optional | [REMOVED] `view.form.drawerSide` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it. Delete the key: an object's list opens a record in its drawer from the hover icon, and the React `ObjectForm` block keeps its own `drawerSide` prop for the drawer it opens with `formType='drawer'`. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **drawerWidth** | `never` | optional | [REMOVED] `view.form.drawerWidth` was removed in @objectstack/spec 18.3.0 (ADR-0049) — no form view opens in a drawer, so no form view ever read it, and a pixel width cannot be chosen without knowing the client viewport. Delete the key: a list's record drawer takes its starting width from the `navigation.size` bucket, and the React `ObjectForm` block keeps its own `drawerWidth` prop for the drawer it opens. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | -| **modalSize** | `Enum<'sm' \| 'default' \| 'lg' \| 'xl' \| 'full'>` | optional | Size bucket of the dialog a caller opens this form in: the console's New / Edit dialog, or the modal container of the React `ObjectForm` block (formType 'modal') | +| **modalSize** | `never` | optional | [REMOVED] `view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a dialog, so nothing reads it from a form view. Delete the key: the console's New and Edit dialogs lay a record out by the object's `fieldGroups` and choose their own size, a form opened by name gets a page of its own, and the React `ObjectForm` block keeps its own `modalSize` prop for the modal it opens with `formType='modal'`. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. | | **data** | `{ provider: 'object'; object: string } \| { provider: 'value'; items: any[] } \| { provider: 'schema'; schemaId: string; schema?: Record }` | optional | Data source configuration (defaults to "object" provider) | | **sections** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | | | **groups** | `{ name?: string; label?: string \| Record; description?: string; collapsible?: boolean; … }[]` | optional | [LEGACY ALIAS → `sections`] Accepted for back-compat and folded onto `sections` at parse; `sections` wins when both are present. Prefer `sections`. | diff --git a/packages/spec/authorable-surface/ui.json b/packages/spec/authorable-surface/ui.json index e8e047df488..67231e2f37e 100644 --- a/packages/spec/authorable-surface/ui.json +++ b/packages/spec/authorable-surface/ui.json @@ -558,7 +558,7 @@ "ui/Form:groups", "ui/Form:label", "ui/Form:layout", - "ui/Form:modalSize", + "ui/Form:modalSize [RETIRED]", "ui/Form:name", "ui/Form:object", "ui/Form:overrides", @@ -632,7 +632,7 @@ "ui/FormView:drawerWidth [RETIRED]", "ui/FormView:groups", "ui/FormView:layout", - "ui/FormView:modalSize", + "ui/FormView:modalSize [RETIRED]", "ui/FormView:sections", "ui/FormView:sharing", "ui/FormView:showStepIndicator", diff --git a/packages/spec/liveness/form.json b/packages/spec/liveness/form.json index d2de6de7188..883519689ec 100644 --- a/packages/spec/liveness/form.json +++ b/packages/spec/liveness/form.json @@ -89,10 +89,10 @@ "note": "Inherited verdict (2026-11-26, ADR-0159 card ②): a `form` item's body keys ARE `FormViewSchema`'s shape, taken by reference (packages/spec/src/ui/view.zod.ts#FormSchema), and the anonymous doors serve the item's body to the same public form renderer an old-shape form reaches (packages/rest/src/form-routes.ts#resolveFormBySlug), so this row carries view.json `form.`'s verdict. Until card ③ (#37087) the console opens no `form` item from an action; re-verify this row with that card. REMOVED 2026-11-02 (#29012, ADR-0049 enforce-or-remove, triage ruling 6571544001: retire) — tombstoned at the schema (retiredKey carries the prescription; authoring it is a tsc error and a parse error at every form-view door built from the shape) and stripped from stored rows and sources by the protocol-18 form-view-drawer-keys-removed conversion. The entry stays because retiredKey keeps the key in the walked shape (the rls.priority precedent). It was already DEPRECATED (#2578 → size buckets) with no size-bucket conversion of its own, and inert on a form view since `type: 'drawer'` left the enum on #27155: the only reader, DrawerForm.tsx, is reached only through the `object-form` block's `formType='drawer'` (ObjectFormContainer.tsx). The React `ObjectForm` block keeps the prop in its own overlay (packages/spec/src/ui/react-blocks.ts); nothing to write on a form view instead — a list's record drawer takes its starting width from `navigation.size`." }, "modalSize": { - "status": "live", - "verifiedAt": "2026-10-28", + "status": "dead", + "verifiedAt": "2026-11-28", "evidenceScope": "in-repo", - "note": "Inherited verdict (2026-11-26, ADR-0159 card ②): a `form` item's body keys ARE `FormViewSchema`'s shape, taken by reference (packages/spec/src/ui/view.zod.ts#FormSchema), and the anonymous doors serve the item's body to the same public form renderer an old-shape form reaches (packages/rest/src/form-routes.ts#resolveFormBySlug), so this row carries view.json `form.`'s verdict. Until card ③ (#37087) the console opens no `form` item from an action; re-verify this row with that card. objectui: ModalForm.tsx reads `modalSize`. Until #36425 the console's New / Edit record dialog copied it from the object's internal form view whatever the form's `type` (#27155); #36425 retired that read (the dialog takes no layout from a form view), and a named or public form opens on a full page (FormPage), not a dialog. RE-AUDIT OWED: no form-view reader of this key is named here after #36425; the verdict is left to the ledger's owner (reported on #36425), not flipped by that change." + "note": "Inherited verdict (2026-11-26, ADR-0159 card ②): a `form` item's body keys ARE `FormViewSchema`'s shape, taken by reference (packages/spec/src/ui/view.zod.ts#FormSchema), and the anonymous doors serve the item's body to the same public form renderer an old-shape form reaches (packages/rest/src/form-routes.ts#resolveFormBySlug), so this row carries view.json `form.`'s verdict. Until card ③ (#37087) the console opens no `form` item from an action; re-verify this row with that card. REMOVED 2026-11-28 (#36544, ADR-0049 enforce-or-remove, seat ruling on the card: retire) — tombstoned at the schema (retiredKey carries the prescription; authoring it is a tsc error and a parse error at every form-view door built from the shape: FormViewSchema, the container's form / formViews, both ViewItem form arms, the flattened form overlay and the `form` item) and stripped from stored rows and sources by the protocol-19 form-view-modal-size-removed conversion. The entry stays because retiredKey keeps the key in the walked shape (the rls.priority precedent). Its one form-view reader was the console's New / Edit record dialog, which copied it from the object's internal form view until #36425 retired that read. Measured at origin/main 0e361201, no form-view surface reads it: ui/apps/console/src/components/FormPage.tsx, the page a named or public form opens on, names every other form key it draws and never this one; ui/packages/app-shell/src/utils/recordFormNavigation.ts#resolveRecordFormModalLayout writes `modalSize: 'full'` only from the surface the host derived; ui/packages/app-shell/src/hooks/useActionModal.tsx takes it from the action's own descriptor; and packages/rest, packages/runtime, packages/objectql and packages/metadata* never name it. ui/packages/plugin-form/src/ModalForm.tsx still reads a `modalSize`, the `object-form` block's own prop (ObjectFormContainer.tsx hands it over for `formType='modal'`), which a form view cannot reach. The React `ObjectForm` block keeps the prop in its own overlay (packages/spec/src/ui/react-blocks.ts), and the `object-form` page block declares it in ObjectFormPropsSchema; nothing to write on a form view instead — the record dialog chooses its own size from the fields it draws." }, "sections": { "status": "live", diff --git a/packages/spec/liveness/state-counts/form.md b/packages/spec/liveness/state-counts/form.md index b5ef615f19b..a265ca071ea 100644 --- a/packages/spec/liveness/state-counts/form.md +++ b/packages/spec/liveness/state-counts/form.md @@ -12,4 +12,4 @@ committed anywhere: `check:liveness` sums the shards when it reads them. | Type | live | exp | elsewhere | dead | planned | classified | |---|---|---|---|---|---|---| -| `form` | 28 | 0 | 0 | 5 | 2 | 35 | +| `form` | 27 | 0 | 0 | 6 | 2 | 35 | diff --git a/packages/spec/liveness/state-counts/view.md b/packages/spec/liveness/state-counts/view.md index d0f2b87b3cc..993277b0a68 100644 --- a/packages/spec/liveness/state-counts/view.md +++ b/packages/spec/liveness/state-counts/view.md @@ -12,4 +12,4 @@ committed anywhere: `check:liveness` sums the shards when it reads them. | Type | live | exp | elsewhere | dead | planned | classified | |---|---|---|---|---|---|---| -| `view` | 76 | 0 | 0 | 10 | 0 | 86 | +| `view` | 75 | 0 | 0 | 11 | 0 | 86 | diff --git a/packages/spec/liveness/view.json b/packages/spec/liveness/view.json index 2a53ae8709c..5614356052e 100644 --- a/packages/spec/liveness/view.json +++ b/packages/spec/liveness/view.json @@ -355,10 +355,10 @@ "note": "REMOVED 2026-11-02 (#29012, ADR-0049 enforce-or-remove, triage ruling 6571544001: retire) — tombstoned at the schema (retiredKey carries the prescription; authoring it is a tsc error and a parse error at every form-view door built from the shape) and stripped from stored rows and sources by the protocol-18 form-view-drawer-keys-removed conversion. The entry stays because retiredKey keeps the key in the walked shape (the rls.priority precedent). It was already DEPRECATED (#2578 → size buckets) with no size-bucket conversion of its own, and inert on a form view since `type: 'drawer'` left the enum on #27155: the only reader, DrawerForm.tsx, is reached only through the `object-form` block's `formType='drawer'` (ObjectFormContainer.tsx). The React `ObjectForm` block keeps the prop in its own overlay (packages/spec/src/ui/react-blocks.ts); nothing to write on a form view instead — a list's record drawer takes its starting width from `navigation.size`." }, "modalSize": { - "status": "live", - "verifiedAt": "2026-10-28", + "status": "dead", + "verifiedAt": "2026-11-28", "evidenceScope": "in-repo", - "note": "objectui: ModalForm.tsx reads `modalSize`. Until #36425 the console's New / Edit record dialog copied it from the object's internal form view whatever the form's `type` (#27155); #36425 retired that read (the dialog takes no layout from a form view), and a named or public form opens on a full page (FormPage), not a dialog. RE-AUDIT OWED: no form-view reader of this key is named here after #36425; the verdict is left to the ledger's owner (reported on #36425), not flipped by that change." + "note": "REMOVED 2026-11-28 (#36544, ADR-0049 enforce-or-remove, seat ruling on the card: retire) — tombstoned at the schema (retiredKey carries the prescription; authoring it is a tsc error and a parse error at every form-view door built from the shape: FormViewSchema, the container's form / formViews, both ViewItem form arms, the flattened form overlay and the `form` item) and stripped from stored rows and sources by the protocol-19 form-view-modal-size-removed conversion. The entry stays because retiredKey keeps the key in the walked shape (the rls.priority precedent). Its one form-view reader was the console's New / Edit record dialog, which copied it from the object's internal form view until #36425 retired that read. Measured at origin/main 0e361201, no form-view surface reads it: ui/apps/console/src/components/FormPage.tsx, the page a named or public form opens on, names every other form key it draws and never this one; ui/packages/app-shell/src/utils/recordFormNavigation.ts#resolveRecordFormModalLayout writes `modalSize: 'full'` only from the surface the host derived; ui/packages/app-shell/src/hooks/useActionModal.tsx takes it from the action's own descriptor; and packages/rest, packages/runtime, packages/objectql and packages/metadata* never name it. ui/packages/plugin-form/src/ModalForm.tsx still reads a `modalSize`, the `object-form` block's own prop (ObjectFormContainer.tsx hands it over for `formType='modal'`), which a form view cannot reach. The React `ObjectForm` block keeps the prop in its own overlay (packages/spec/src/ui/react-blocks.ts), and the `object-form` page block declares it in ObjectFormPropsSchema; nothing to write on a form view instead — the record dialog chooses its own size from the fields it draws." }, "sections": { "status": "live", diff --git a/packages/spec/src/conversions/entries/18/form-view-drawer-keys-removed.ts b/packages/spec/src/conversions/entries/18/form-view-drawer-keys-removed.ts index cb22b38d458..cc5b8495901 100644 --- a/packages/spec/src/conversions/entries/18/form-view-drawer-keys-removed.ts +++ b/packages/spec/src/conversions/entries/18/form-view-drawer-keys-removed.ts @@ -90,8 +90,9 @@ const formViewDrawerKeysRemoved: MetadataConversion = { // Both keys go; the rest of the form rides through. form: { columns: 2, drawerSide: 'left', drawerWidth: '480px', sections: [{ label: 'Main', fields: ['title'] }] }, formViews: { - // `modalSize` is live (the console's record dialog reads it) and stays. - quick: { modalSize: 'lg', drawerWidth: '50%' }, + // A live key beside it stays. ([#36544] Not `modalSize`, which + // `form-view-modal-size-removed` strips at 19.) + quick: { tabPosition: 'left', drawerWidth: '50%' }, // A form without the keys rides through by reference. plain: { columns: 1 }, }, @@ -125,7 +126,7 @@ const formViewDrawerKeysRemoved: MetadataConversion = { object: 'fvd_task', form: { columns: 2, sections: [{ label: 'Main', fields: ['title'] }] }, formViews: { - quick: { modalSize: 'lg' }, + quick: { tabPosition: 'left' }, plain: { columns: 1 }, }, }, diff --git a/packages/spec/src/conversions/entries/18/form-view-presentation-types-removed.ts b/packages/spec/src/conversions/entries/18/form-view-presentation-types-removed.ts index dc8a17e3077..4c4d1571f2a 100644 --- a/packages/spec/src/conversions/entries/18/form-view-presentation-types-removed.ts +++ b/packages/spec/src/conversions/entries/18/form-view-presentation-types-removed.ts @@ -27,8 +27,10 @@ import { type Dict, isDict, stripKeys } from '../shared.js'; * tombstone. Deleting is the whole edit: a form whose `type` was retired lands * on the `simple` default, the conversion invents no layout. The keys go on * every form, whatever its `type`: each is refused on every form now, and a - * `pane` on a non-split form was already a parse error. `modalSize` stays, - * because the console's record dialog reads it on every layout. `drawerSide` + * `pane` on a non-split form was already a parse error. `modalSize` stayed + * here, because the console's record dialog read it on every layout; it left + * the form view at 19, once that dialog stopped loading a form view + * ([#36544] `form-view-modal-size-removed`). `drawerSide` * and `drawerWidth` stayed here and left the form view later in the same * release ([#29012] {@link formViewDrawerKeysRemoved}). * @@ -210,7 +212,9 @@ const formViewPresentationTypesRemoved: MetadataConversion = { // `drawerSide`, which `form-view-drawer-keys-removed` now strips.) quick: { type: 'drawer', title: 'Quick', sections: [{ label: 'Quick', fields: ['status'] }] }, // A modal form whose sections ride the legacy `groups` alias. - dialog: { type: 'modal', modalSize: 'lg', groups: [{ label: 'Edit', fields: ['title'] }] }, + // ([#36544] Its bystander key is not `modalSize`, which + // `form-view-modal-size-removed` strips at 19.) + dialog: { type: 'modal', columns: 2, groups: [{ label: 'Edit', fields: ['title'] }] }, }, }, // A form view item record: the payload is `config`. @@ -264,7 +268,7 @@ const formViewPresentationTypesRemoved: MetadataConversion = { ], }, quick: { title: 'Quick', sections: [{ label: 'Quick', fields: ['status'] }] }, - dialog: { modalSize: 'lg', groups: [{ label: 'Edit', fields: ['title'] }] }, + dialog: { columns: 2, groups: [{ label: 'Edit', fields: ['title'] }] }, }, }, { name: 'fv_task.peek', object: 'fv_task', viewKind: 'form', config: {} }, diff --git a/packages/spec/src/conversions/entries/19/form-view-modal-size-removed.ts b/packages/spec/src/conversions/entries/19/form-view-modal-size-removed.ts new file mode 100644 index 00000000000..0c8b2fb6d9a --- /dev/null +++ b/packages/spec/src/conversions/entries/19/form-view-modal-size-removed.ts @@ -0,0 +1,150 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { MetadataConversion } from '../../types.js'; +import { mapCollection, mapViewPayloads } from '../../walk.js'; +import { ASSEMBLED_VIEW_ITEMS_KEY } from '../../../ui/assembled-views.zod.js'; +import { type Dict, isDict, stripKeys } from '../shared.js'; + +/** + * `modalSize` leaves the form view (protocol 19, #36544 — ADR-0049 + * enforce-or-remove, seat ruling on the card: retire). Its one form-view + * reader was the console's New / Edit record dialog. Through 18.6.0 that + * dialog opened at the authored size; at 19.0.0 it stopped loading a form view + * (#36425): it lays the record out by the object's field groups and chooses + * its own size. A form opened by name, or shared by a public link, gets a page + * of its own, never a dialog. So from 19.0.0 a stored `modalSize: 'lg'` saves, + * is served and changes nothing, and an app that comes from 18.x finds that + * dialog at the size the dialog chooses (the D3 entry says so). + * + * Authoring refuses the key by its `retiredKey()` tombstone (`ui/view.zod.ts`). + * Deleting is the whole edit, and it changes nothing a reader sees on 19. The + * React `ObjectForm` block keeps its own `modalSize` prop (`react-blocks.ts` + * overlay) and the `object-form` PAGE BLOCK keeps it in + * `ObjectFormPropsSchema`: its `formType: 'modal'` container reads it, so this + * entry never walks page components. + * + * **Reach: every FORM payload**, as `form-view-drawer-keys-removed`: + * {@link mapViewPayloads} (`form`, `formViews.*`, a form view item's `config`, + * a flattened form overlay) and the assembled-manifest `viewItems` channel + * ({@link ASSEMBLED_VIEW_ITEMS_KEY}); and a `forms[]` item (ADR-0159), whose + * body keys are the form view's by reference, so the tombstone stands at that + * door too. A list payload is never judged. + * + * The schema accepted the key through 18.6.0 and `PUT /meta/view` persists + * form views, so a stored `view` row CAN carry it. **Retired from the load + * path from day one**: a live author meets the parse's prescription, and this + * entry serves stored-row rehydration, assembled artifacts and + * `os migrate meta --from 18`. Idempotent by construction (`stripKeys`). + * + * Its D3 entry is `ui-form-view-modal-size-retired`. + */ +const formViewModalSizeRemoved: MetadataConversion = { + id: 'form-view-modal-size-removed', + toMajor: 19, + retiredFromLoadPath: true, + retiredAfter: '18.6.0', + surface: 'view.form.modalSize / view.formViews..modalSize / form.modalSize', + summary: + 'form view `modalSize` removed (no form view opens in a dialog: the console\'s New and Edit dialogs lay a ' + + 'record out by the object\'s field groups and choose their own size, and a form opened by name gets a ' + + 'page of its own, so nothing read the key from a form view). The key is deleted, which changes nothing ' + + 'a reader sees; the React `ObjectForm` block and the `object-form` page block keep their own ' + + '`modalSize` for the modal they open', + apply(stack, emit) { + const convertForm = (form: Dict, path: string): Dict => stripKeys(form, ['modalSize'], emit, path); + const withViews = mapViewPayloads(stack, (payload, kind, path) => + kind === 'form' ? convertForm(payload, path) : payload); + const withViewItems = mapCollection(withViews, ASSEMBLED_VIEW_ITEMS_KEY, (item, path) => { + if (item.viewKind !== 'form') return item; + if (isDict(item.config)) { + const config = convertForm(item.config, `${path}.config`); + return config === item.config ? item : { ...item, config }; + } + // A flattened form overlay — the body IS the payload. A present but + // malformed `config` is neither shape and is left for the parse. + return item.config === undefined ? convertForm(item, path) : item; + }); + // A `form` item's body sits at its top level (ADR-0159: no `config` wrapper). + return mapCollection(withViewItems, 'forms', convertForm); + }, + fixture: { + before: { + pages: [ + { + name: 'fms_task_desk', + regions: [ + { + name: 'main', + components: [ + // The `object-form` page block keeps the key: its modal reads it. + { type: 'object-form', properties: { objectName: 'fms_task', formType: 'modal', modalSize: 'lg' } }, + ], + }, + ], + }, + ], + views: [ + { + object: 'fms_task', + // The key goes; the rest of the form rides through. + form: { columns: 2, modalSize: 'full', sections: [{ label: 'Main', fields: ['title'] }] }, + formViews: { + quick: { title: 'Quick', modalSize: 'lg' }, + // A form without the key rides through by reference. + plain: { columns: 1 }, + }, + }, + // A form view item record: the payload is `config`. + { name: 'fms_task.peek', object: 'fms_task', viewKind: 'form', config: { modalSize: 'sm' } }, + // A list payload is never judged. + { name: 'fms_task.all', object: 'fms_task', viewKind: 'list', config: { type: 'grid', columns: ['title'] } }, + ], + viewItems: [ + // An assembled flattened form overlay — the body IS the payload. + { name: 'fms_task.side', object: 'fms_task', viewKind: 'form', modalSize: 'xl' }, + ], + forms: [ + // A `form` item: the body is at the top level. + { name: 'fms_task.intake', object: 'fms_task', modalSize: 'default', sections: [{ label: 'Intake', fields: ['title'] }] }, + ], + }, + after: { + pages: [ + { + name: 'fms_task_desk', + regions: [ + { + name: 'main', + components: [ + { type: 'object-form', properties: { objectName: 'fms_task', formType: 'modal', modalSize: 'lg' } }, + ], + }, + ], + }, + ], + views: [ + { + object: 'fms_task', + form: { columns: 2, sections: [{ label: 'Main', fields: ['title'] }] }, + formViews: { + quick: { title: 'Quick' }, + plain: { columns: 1 }, + }, + }, + { name: 'fms_task.peek', object: 'fms_task', viewKind: 'form', config: {} }, + { name: 'fms_task.all', object: 'fms_task', viewKind: 'list', config: { type: 'grid', columns: ['title'] } }, + ], + viewItems: [ + { name: 'fms_task.side', object: 'fms_task', viewKind: 'form' }, + ], + forms: [ + { name: 'fms_task.intake', object: 'fms_task', sections: [{ label: 'Intake', fields: ['title'] }] }, + ], + }, + // `form`, `quick`, the item record, the assembled overlay and the `form` + // item: one each. The page block, `plain` and the list emit none. + expectedNotices: 5, + }, +}; + +export { formViewModalSizeRemoved }; diff --git a/packages/spec/src/conversions/registry.ts b/packages/spec/src/conversions/registry.ts index 3b1cdec2786..7da1e19098e 100644 --- a/packages/spec/src/conversions/registry.ts +++ b/packages/spec/src/conversions/registry.ts @@ -141,6 +141,7 @@ import { flowDecisionModeInclusiveExplicit } from './entries/18/flow-decision-mo import { actionLocationsActedOn } from './entries/19/action-locations-acted-on.js'; import { actionTypeAskAiRemoved } from './entries/19/action-type-ask-ai-removed.js'; import { agentModelProviderRemoved } from './entries/19/agent-model-provider-removed.js'; +import { formViewModalSizeRemoved } from './entries/19/form-view-modal-size-removed.js'; import { knowledgeSourceContentFieldsToContent } from './entries/19/knowledge-source-content-fields-to-content.js'; import { knowledgeSourceIdToName } from './entries/19/knowledge-source-id-to-name.js'; import { knowledgeSourceInertKeysRemoved } from './entries/19/knowledge-source-inert-keys-removed.js'; @@ -332,6 +333,13 @@ const MAJOR_18_CONVERSIONS: readonly OrderedConversion[] = [ * left and converts to `record_page`. In the other order the locations entry * leaves the group at `record_header` as a TODO, the removal deletes the * member, and the group is stranded at a word protocol 19 draws nowhere. + * + * The form view's `modalSize` delete writes form payloads only, which no + * other entry of this major writes, and applies last (`order: 4`). One entry + * READS them: over sources `action-type-ask-ai-removed` takes every string of + * the stack as a possible name of a declared `ask_ai` action, a `modalSize` + * value included. It applies before this delete, so such a value still counts + * there, and that is its conservative side: the action is kept for the author. */ const MAJOR_19_CONVERSIONS: readonly OrderedConversion[] = [ { conversion: actionLocationsActedOn, order: 3 }, @@ -340,6 +348,7 @@ const MAJOR_19_CONVERSIONS: readonly OrderedConversion[] = [ // first, so it cannot hold a `record_header` group back as a TODO there. { conversion: actionTypeAskAiRemoved, order: 2.5 }, { conversion: agentModelProviderRemoved, order: 2 }, + { conversion: formViewModalSizeRemoved, order: 4 }, { conversion: knowledgeSourceContentFieldsToContent, order: 2 }, { conversion: knowledgeSourceIdToName, order: 1 }, { conversion: knowledgeSourceInertKeysRemoved, order: 3 }, diff --git a/packages/spec/src/migrations/entries/retired-keys/19.ui__FormView__modalSize.ts b/packages/spec/src/migrations/entries/retired-keys/19.ui__FormView__modalSize.ts new file mode 100644 index 00000000000..17efc3e64aa --- /dev/null +++ b/packages/spec/src/migrations/entries/retired-keys/19.ui__FormView__modalSize.ts @@ -0,0 +1,11 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +// #36544 — ADR-0049 enforce-or-remove on the form view's `modalSize` (seat +// ruling on the card: retire). Its one form-view reader, the console's New / +// Edit record dialog, stopped loading a form view in #36425, and a form opened +// by name gets a page of its own, so no form-view surface read the key. +// Tombstoned with `retiredKey()`; the React `ObjectForm` block keeps its own +// `modalSize` overlay prop. D2: `form-view-modal-size-removed`; D3: +// `ui-form-view-modal-size-retired`. Registered under 19, the spec package's +// own major. +export const entry = 'ui/FormView:modalSize'; diff --git a/packages/spec/src/migrations/entries/retired-keys/19.ui__Form__modalSize.ts b/packages/spec/src/migrations/entries/retired-keys/19.ui__Form__modalSize.ts new file mode 100644 index 00000000000..48f50f5094a --- /dev/null +++ b/packages/spec/src/migrations/entries/retired-keys/19.ui__Form__modalSize.ts @@ -0,0 +1,9 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +// #36544 — the `form` item's row of the `modalSize` retirement. A `form` +// item's body keys are `FormViewSchema`'s shape by reference (ADR-0159 D2), so +// the tombstone `ui/FormView:modalSize` stands at this door too: a form opened +// by name or by a public link gets a page of its own, never a dialog. D2: +// `form-view-modal-size-removed` (it walks `forms[]`); D3: +// `ui-form-view-modal-size-retired`. +export const entry = 'ui/Form:modalSize'; diff --git a/packages/spec/src/migrations/entries/semantic/18.ui-form-view-type-layout-only.ts b/packages/spec/src/migrations/entries/semantic/18.ui-form-view-type-layout-only.ts index d660fb67515..ee04e28a539 100644 --- a/packages/spec/src/migrations/entries/semantic/18.ui-form-view-type-layout-only.ts +++ b/packages/spec/src/migrations/entries/semantic/18.ui-form-view-type-layout-only.ts @@ -27,7 +27,7 @@ export const entry: SemanticMigration = { 'the form\'s layout: delete the retired value for the `simple` default, or write `tabbed` (one tab ' + 'per section) or `wizard`. Where the form opens is the caller\'s: a list opens a clicked record in ' + 'the drawer by default (`navigation.mode`), the console\'s New and Edit dialogs open the record form ' - + 'themselves (sized by `modalSize`), and an action `type: \'modal\'` opens the page it targets. A ' + + 'themselves and choose their own size, and an action `type: \'modal\'` opens the page it targets. A ' + 'record beside its list is a reader\'s own preference in the list\'s Display menu; child records ' + 'edited beside the parent are `subforms`, and on a page that is an `object-master-detail-form` ' + 'block. An `object-form` block that opened in a drawer or dialog keeps its `drawer` or `modal` ' diff --git a/packages/spec/src/migrations/entries/semantic/19.ui-form-view-modal-size-retired.ts b/packages/spec/src/migrations/entries/semantic/19.ui-form-view-modal-size-retired.ts new file mode 100644 index 00000000000..c861cffa391 --- /dev/null +++ b/packages/spec/src/migrations/entries/semantic/19.ui-form-view-modal-size-retired.ts @@ -0,0 +1,37 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { SemanticMigration } from '../../types.js'; + +// #36544 (ADR-0049 enforce-or-remove, seat ruling on the card: retire) — the D3 +// entry of the `form-view-modal-size-removed` family. The key is registered in +// RETIRED_KEYS_BY_MAJOR as `ui/FormView:modalSize` and `ui/Form:modalSize`. +export const entry: SemanticMigration = { + id: 'ui-form-view-modal-size-retired', + surface: + 'view.form.modalSize, view.formViews..modalSize and form.modalSize — removed from the form view ' + + 'and the `form` item (the React `ObjectForm` block and the `object-form` page block keep their own)', + replacement: + 'nothing on the form: no form view opens in a dialog. Delete the key. The console\'s New and Edit ' + + 'dialogs lay a record out by the object\'s `fieldGroups` and choose their own size from the number of ' + + 'fields they draw; a form opened by name, or by a public link, gets a page of its own. A React page that opens a form in a modal writes the prop on the block: `ObjectForm` with ' + + '`formType=\'modal\'` and its own `modalSize`', + reason: + 'ADR-0049: the one form-view reader of `modalSize` was the console\'s New / Edit record dialog, which ' + + 'copied it from the object\'s internal form view. Through 18.6.0 that dialog opened at the authored ' + + 'size. At 19.0.0 it stopped loading a form view (the protocol-18 semantic entry ' + + '`internal-record-forms-not-loaded` records that change), and neither the form page a name or a ' + + 'public link opens nor any server surface reads the key, so from 19.0.0 a stored value saves, is ' + + 'served and changes nothing. The D2 conversion `form-view-modal-size-removed` makes each stored or ' + + 'existing source parse by deleting the key, which changes nothing a reader sees on 19. What it ' + + 'cannot restore is the size: a form that carried `modalSize` on 18.x opens its record\'s create or ' + + 'edit dialog at the size the dialog chooses after the upgrade, and no key an author writes sets ' + + 'that dialog\'s size now. It follows the number of fields the dialog draws, and the person filling ' + + 'it in can maximize it', + acceptanceCriteria: + 'No form view and no `form` item declares `modalSize`; it is refused at parse with its prescription, ' + + 'and TypeScript rejects it at a `FormView` or `Form` position. The React `ObjectForm` block still ' + + 'publishes the prop, and the `object-form` page block still accepts it with `formType: \'modal\'`. ' + + 'On an app that comes from 18.x, New and Edit on each object whose form carried the key open at a size ' + + 'you accept.', + conversionIds: ['form-view-modal-size-removed'], +}; diff --git a/packages/spec/src/migrations/registry.ts.template b/packages/spec/src/migrations/registry.ts.template index 8b7425d0fc8..f0a97a6d8e1 100644 --- a/packages/spec/src/migrations/registry.ts.template +++ b/packages/spec/src/migrations/registry.ts.template @@ -3742,7 +3742,10 @@ const step19: MigrationStep = { + '`source.content`, a list of field names in which `\'*\'` is refused, because each listed field ' + 'is sent to the embedding provider; `embedding`, `vectorStore`, `adapterConfig` and ' + '`refresh.cron`, which nothing read, are removed; and the `file` and `http` source kinds leave ' - + 'with their four keys, so a source indexes the records of one object.', + + 'with their four keys, so a source indexes the records of one object. ' + + 'A form view\'s `modalSize` leaves the shape, on a `form` item too: no form view opens in a dialog ' + + 'since the console\'s New and Edit dialogs stopped loading one, so the key is deleted, which changes ' + + 'nothing a reader sees; the React `ObjectForm` block and the `object-form` page block keep their own.', // Derived, not listed, as step 18's are: every major-19 conversion graduates // into this step in the order `CONVERSIONS_BY_MAJOR[19]` applies them. Add a // conversion there, never here. diff --git a/packages/spec/src/shared/retired-key-removal-version.pin.test.ts b/packages/spec/src/shared/retired-key-removal-version.pin.test.ts index 8b262e975c2..7ba9374cfd8 100644 --- a/packages/spec/src/shared/retired-key-removal-version.pin.test.ts +++ b/packages/spec/src/shared/retired-key-removal-version.pin.test.ts @@ -544,6 +544,8 @@ const JOIN: Readonly> = { refusal("view.scope 'personal'", () => ViewScopeSchema.safeParse('personal')), tombstone(ViewSharingSchema, 'view.list.sharing', 'type'), ], + // #36544: `modalSize`, tombstoned on the form view at 19. + 'form-view-modal-size-removed': [tombstone(FormViewSchema, 'view.form', 'modalSize')], // #27155: the form view `type` narrowed to the form's layout — each retired // member refused by the enum's own error map, plus the three split-only keys // tombstoned beside it. diff --git a/packages/spec/src/ui/form-view-drawer-keys-retirement.test.ts b/packages/spec/src/ui/form-view-drawer-keys-retirement.test.ts index 95a8fb9b4b6..1712ec96c17 100644 --- a/packages/spec/src/ui/form-view-drawer-keys-retirement.test.ts +++ b/packages/spec/src/ui/form-view-drawer-keys-retirement.test.ts @@ -21,6 +21,23 @@ * 4. Tree-scoped absence: no form view inside the declared radius still * authors either key. * + * ## `FormView.modalSize` (#36544), retired at 19 — the same kit, in this file + * + * `modalSize` was the key this retirement's controls kept: the console's New / + * Edit record dialog read it. That dialog loads no form view since #36425, and + * a form opened by name gets a page of its own, so no form-view surface reads + * it (ADR-0049 enforce-or-remove, seat ruling on the card: retire). It shares + * the doors, the block that keeps the prop and the tree walk below, so its + * pins are the `modalSize` describes of this file and not a file of their own: + * 5. A `retiredKey()` tombstone refused with its prescription at every + * form-view door, the `form` item (ADR-0159) included, and `defineStack`. + * 6. The modal that reads it keeps it: the React `ObjectForm` block's + * overlay and the `object-form` page block. + * 7. One D2 conversion at 19, retired from the load path: + * `form-view-modal-size-removed`; its D3 entry is + * `ui-form-view-modal-size-retired`. + * 8. Tree-scoped absence, on the same walk. + * * On the assertion set: a schema refusal raises a `ZodError` whose issues carry * `code` and `path` but no ADR-0112 `status` (that envelope belongs to the * doors), so each schema refusal is pinned by the `path` and the @@ -44,7 +61,7 @@ import { MIGRATIONS_BY_MAJOR, RETIRED_KEYS_BY_MAJOR } from '../migrations/regist import { defineStack } from '../stack.zod'; import { ObjectFormPropsSchema } from './component.zod'; import { REACT_BLOCKS, REACT_OVERLAY_SHADOWS } from './react-blocks'; -import { FormViewSchema, VIEW_METADATA_MEMBERS, ViewItemSchema, ViewSchema } from './view.zod'; +import { FormSchema, FormViewSchema, VIEW_METADATA_MEMBERS, ViewItemSchema, ViewSchema } from './view.zod'; const CONVERSION_ID = 'form-view-drawer-keys-removed'; const D3_ID = 'ui-form-view-drawer-keys-retired'; @@ -104,8 +121,9 @@ describe('FormView.drawerSide / drawerWidth — tombstones at every form-view do }); } - it.each(DOORS.map((d) => [d.name, d] as const))('CONTROL: %s still accepts the same form without the keys, `modalSize` included', (_, door) => { - const r = door.parse({ type: 'simple', sections: SECTIONS, modalSize: 'lg' }); + it.each(DOORS.map((d) => [d.name, d] as const))('CONTROL: %s still accepts the same form without the keys, a live key beside them included', (_, door) => { + // [#36544] The live key was `modalSize` until it became a tombstone too. + const r = door.parse({ type: 'simple', sections: SECTIONS, columns: 2 }); expect(r.success, JSON.stringify(r.error?.issues)).toBe(true); }); @@ -129,7 +147,7 @@ describe('FormView.drawerSide / drawerWidth — tombstones at every form-view do expect(issue.message.startsWith(FIRST_SENTENCE[key]), issue.message).toBe(true); } expect(() => defineStack({ - views: [{ object: 'crm_lead', formViews: { quick: { sections: SECTIONS, modalSize: 'lg' } } }], + views: [{ object: 'crm_lead', formViews: { quick: { sections: SECTIONS, columns: 2 } } }], } as never)).not.toThrow(); }); @@ -185,7 +203,7 @@ describe(`the D2 conversion ${CONVERSION_ID}`, () => { object: 'crm_lead', form: { sections: SECTIONS, columns: 2 }, formViews: { - quick: { sections: SECTIONS, modalSize: 'lg', drawerSide: 'left', drawerWidth: '480px' }, + quick: { sections: SECTIONS, columns: 2, drawerSide: 'left', drawerWidth: '480px' }, }, }; expect(ViewSchema.safeParse(row).success).toBe(false); @@ -198,7 +216,7 @@ describe(`the D2 conversion ${CONVERSION_ID}`, () => { const parsed = ViewSchema.parse(out); expect(parsed.formViews?.quick).not.toHaveProperty('drawerSide'); expect(parsed.formViews?.quick).not.toHaveProperty('drawerWidth'); - expect(parsed.formViews?.quick?.modalSize).toBe('lg'); + expect(parsed.formViews?.quick?.columns).toBe(2); // A form without the keys is the author's and is never touched. expect(out.form).toBe(row.form); // Copy-on-write: the stored row is not mutated. @@ -261,20 +279,217 @@ describe(`the D2 conversion ${CONVERSION_ID}`, () => { }); }); +// ─── `FormView.modalSize` (#36544), retired at 19 ─────────────────────────── + +const MODAL_CONVERSION_ID = 'form-view-modal-size-removed'; +const MODAL_D3_ID = 'ui-form-view-modal-size-retired'; +const MODAL_FIRST_SENTENCE = + '`view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a ' + + 'dialog, so nothing reads it from a form view.'; +const MODAL_MIGRATE_SENTENCE = 'Run `os migrate meta --from 18` to list the mechanical edits for existing sources;'; +/** Every value the key accepted while it was declared. */ +const MODAL_VALUES = ['sm', 'default', 'lg', 'xl', 'full'] as const; + +/** The form-view doors, and the `form` item (ADR-0159), whose body keys are the form view's by reference. */ +const MODAL_DOORS: readonly Door[] = [ + ...DOORS, + { + name: '`form` item', + parse: (f) => FormSchema.safeParse({ name: 'crm_lead.intake', object: 'crm_lead', ...f }), + at: [], + }, +]; + +describe('FormView.modalSize — a tombstone at every form-view door', () => { + it.each(MODAL_DOORS.map((d) => [d.name, d] as const))('%s refuses `modalSize`, whatever it carries, with its prescription', (_, door) => { + for (const value of MODAL_VALUES) { + const r = door.parse({ type: 'simple', sections: SECTIONS, modalSize: value }); + expect(r.success, value).toBe(false); + const issues = payloadIssues(r, door); + expect(issues, JSON.stringify(issues)).toHaveLength(1); + expect(issues[0]!.path).toEqual([...door.at, 'modalSize']); + expect(issues[0]!.message.startsWith(MODAL_FIRST_SENTENCE), issues[0]!.message).toBe(true); + expect(issues[0]!.message).toContain(MODAL_MIGRATE_SENTENCE); + } + }); + + it.each(MODAL_DOORS.map((d) => [d.name, d] as const))('CONTROL: %s still accepts the same form without the key', (_, door) => { + const r = door.parse({ type: 'simple', sections: SECTIONS, columns: 2 }); + expect(r.success, JSON.stringify(r.error?.issues)).toBe(true); + }); + + it('defineStack refuses it with the ADR-0112 envelope and the prescription', () => { + let refusal: unknown; + try { + defineStack({ + views: [{ object: 'crm_lead', form: { sections: SECTIONS, modalSize: 'full' }, formViews: { quick: { sections: SECTIONS, modalSize: 'lg' } } }], + } as never); + } catch (error) { + refusal = error; + } + expect(refusal).toMatchObject({ code: 'STACK_SCHEMA_INVALID', status: 422 }); + const issues = (refusal as { issues: { path: PropertyKey[]; message: string }[] }).issues; + expect(issues.map((i) => i.path.join('.')).sort()).toEqual([ + 'views.0.form.modalSize', + 'views.0.formViews.quick.modalSize', + ]); + for (const issue of issues) { + expect(issue.message.startsWith(MODAL_FIRST_SENTENCE), issue.message).toBe(true); + } + }); + + it('is registered in RETIRED_KEYS_BY_MAJOR[19] under both exact def keys', () => { + expect(RETIRED_KEYS_BY_MAJOR[19]).toEqual(expect.arrayContaining(['ui/FormView:modalSize', 'ui/Form:modalSize'])); + }); + + it('fails tsc at the authoring site: the tombstone admits only absence', () => { + const form: z.input = { + sections: SECTIONS, + // @ts-expect-error — `modalSize` is a `retiredKey()` tombstone, typed `never`. + modalSize: 'lg', + }; + const item: z.input = { + name: 'crm_lead.intake', + object: 'crm_lead', + sections: SECTIONS, + // @ts-expect-error — the `form` item takes the same tombstone by reference. + modalSize: 'lg', + }; + expect(FormViewSchema.safeParse(form).success).toBe(false); + expect(FormSchema.safeParse(item).success).toBe(false); + }); +}); + +describe('the modal that reads `modalSize` keeps it', () => { + const objectForm = REACT_BLOCKS.find((b) => b.tag === 'ObjectForm')!; + + it(' publishes it from its overlay, no longer from the form view schema', () => { + const prop = objectForm.interactions.find((i) => i.name === 'modalSize'); + expect(prop).toBeDefined(); + expect(prop!.kind).toBe('binding'); + expect(prop!.type).toBe("'sm' | 'default' | 'lg' | 'xl' | 'full'"); + expect(prop!.description).toContain("formType 'modal'"); + expect(objectForm.dataProps).not.toContain('modalSize'); + // The collision with the tombstone's name is ledgered, not accidental. + expect(REACT_OVERLAY_SHADOWS.ObjectForm).toContain('modalSize'); + }); + + it('the `object-form` page block still accepts every value with its modal container', () => { + for (const modalSize of MODAL_VALUES) { + const r = ObjectFormPropsSchema.safeParse({ objectName: 'crm_contact', formType: 'modal', modalSize }); + expect(r.success, JSON.stringify(r.error?.issues)).toBe(true); + } + }); +}); + +describe(`the D2 conversion ${MODAL_CONVERSION_ID}`, () => { + const oursModal = (n: ConversionNotice) => n.conversionId === MODAL_CONVERSION_ID; + + it('a STORED view container replays to a body the strict door accepts', () => { + const row = { + object: 'crm_lead', + form: { sections: SECTIONS, columns: 2 }, + formViews: { + quick: { sections: SECTIONS, columns: 2, modalSize: 'lg' }, + }, + }; + expect(ViewSchema.safeParse(row).success).toBe(false); + const notices: ConversionNotice[] = []; + const out = applyConversionsToStoredItem('view', row, { onNotice: (n) => notices.push(n) }) as typeof row; + expect(notices.filter(oursModal).map(brief)).toEqual([ + { conversionId: MODAL_CONVERSION_ID, path: 'views[0].formViews.quick.modalSize', from: 'modalSize', to: '(removed)' }, + ]); + const parsed = ViewSchema.parse(out); + expect(parsed.formViews?.quick).not.toHaveProperty('modalSize'); + expect(parsed.formViews?.quick?.columns).toBe(2); + // A form without the key is the author's and is never touched. + expect(out.form).toBe(row.form); + // Copy-on-write: the stored row is not mutated. + expect(row.formViews.quick).toHaveProperty('modalSize', 'lg'); + }); + + it('a STORED form view item record converts its `config`', () => { + const row = { name: 'crm_lead.peek', object: 'crm_lead', viewKind: 'form', config: { sections: SECTIONS, modalSize: 'full' } }; + const notices: ConversionNotice[] = []; + const out = applyConversionsToStoredItem('view', row, { onNotice: (n) => notices.push(n) }) as typeof row; + expect(notices.filter(oursModal).map((n) => n.path)).toEqual(['views[0].config.modalSize']); + expect(out.config).toEqual({ sections: SECTIONS }); + expect(ViewItemSchema.safeParse(out).success).toBe(true); + }); + + it('a STORED `form` item converts its top-level body', () => { + const row = { name: 'crm_lead.intake', object: 'crm_lead', sections: SECTIONS, modalSize: 'sm' }; + expect(FormSchema.safeParse(row).success).toBe(false); + const notices: ConversionNotice[] = []; + const out = applyConversionsToStoredItem('form', row, { onNotice: (n) => notices.push(n) }) as typeof row; + expect(notices.filter(oursModal).map((n) => n.path)).toEqual(['forms[0].modalSize']); + expect(out).toEqual({ name: 'crm_lead.intake', object: 'crm_lead', sections: SECTIONS }); + expect(FormSchema.safeParse(out).success).toBe(true); + }); + + it('never touches the `object-form` page block, whose modal reads the key', () => { + const input = { + pages: [{ + name: 'desk', + regions: [{ name: 'main', components: [{ type: 'object-form', properties: { objectName: 'o', formType: 'modal', modalSize: 'lg' } }] }], + }], + }; + const { stack, notices } = collectConversionNotices(input, { includeRetired: true }); + expect(notices.filter(oursModal)).toEqual([]); + expect(stack).toEqual(input); + }); + + it('is idempotent by construction: a second replay converts nothing', () => { + const { stack } = collectConversionNotices( + { views: [{ object: 'o', form: { sections: SECTIONS, modalSize: 'xl' } }] }, + { includeRetired: true }, + ); + const replay = collectConversionNotices(stack, { includeRetired: true }); + expect(replay.notices.filter(oursModal)).toEqual([]); + expect(replay.stack).toBe(stack); + }); + + it('is retired from the load path — the authoring funnel rewrites no live source', () => { + const input = { views: [{ object: 'o', form: { sections: SECTIONS, modalSize: 'lg' } }] }; + const { stack, notices } = collectConversionNotices(input); + expect(notices.filter(oursModal)).toEqual([]); + expect(stack).toEqual(input); + }); + + it('is wired into the step-19 chain as a retired entry stamped after 18.6.0', () => { + expect(MIGRATIONS_BY_MAJOR[19]!.conversionIds).toContain(MODAL_CONVERSION_ID); + const conversion = ALL_CONVERSIONS.find((c) => c.id === MODAL_CONVERSION_ID); + expect(conversion).toBeDefined(); + expect(conversion!.toMajor).toBe(19); + expect(conversion!.retiredFromLoadPath).toBe(true); + expect(conversion!.retiredAfter).toBe('18.6.0'); + }); + + it(`carries the D3 entry ${MODAL_D3_ID}, naming its D2 conversion`, () => { + const entries = MIGRATIONS_BY_MAJOR[19]!.semantic.filter((s) => s.id === MODAL_D3_ID); + expect(entries).toHaveLength(1); + expect(entries[0]!.reason).toContain(`\`${MODAL_CONVERSION_ID}\``); + expect(entries[0]!.conversionIds).toEqual([MODAL_CONVERSION_ID]); + expect(entries[0]!.acceptanceCriteria.length).toBeGreaterThan(0); + }); +}); + // ─── Tree-scoped absence, inside the radius the package already declares ─── // // `tsc` sweeps the TYPED authoring sites; this walk covers every text file // under the five repo roots `scripts/cross-package-test-inputs.mjs` declares // for `@objectstack/spec#test` (mirrored in `turbo.json`), with the example -// apps' own `src/` trees. It judges the two places a form view is written as -// an object literal: a `form: { … }` literal whose own top-level keys include -// a drawer key, and a `formViews: { … }` literal one of whose entries does. The +// apps' own `src/` trees. It judges the places a form is written as an object +// literal: a `form: { … }` literal whose own top-level keys include a retired +// key, a `formViews: { … }` literal one of whose entries does, and +// ([#36544]) the literal handed to `defineForm({ … })`. The // bound, stated: the keys stay legal on the React `ObjectForm` block (JSX // attributes) and the `object-form` page block (`properties: { … }`), which -// neither shape matches; a form assembled by spread or a computed key, a +// no shape here matches; a form assembled by spread or a computed key, a // ViewItem form record's `config`, YAML, and the console under `ui/` (outside -// this radius) are outside what this walk sees. -describe('tree-scoped absence: no form view inside the declared radius still authors a drawer key', () => { +// this radius) are outside what this walk sees. One pass over the tree +// serves both retirements: the drawer keys and `modalSize`. +describe('tree-scoped absence: no form view inside the declared radius still authors a retired key', () => { const SPEC_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..'); const REPO_ROOT = path.resolve(SPEC_ROOT, '../..'); const THIS_FILE = path.relative(REPO_ROOT, fileURLToPath(import.meta.url)).split(path.sep).join('/'); @@ -284,7 +499,10 @@ describe('tree-scoped absence: no form view inside the declared radius still aut const EXAMPLES_EXT = new Set(['.json', '.md', '.mdx']); const EXAMPLE_APP_SRC_TS = /^examples\/[^/]+\/src\/.+\.ts$/; const SKIPPED_DIRS = new Set(['node_modules', 'dist', '.turbo', '.cache', '.objectstack', 'coverage', '.next', '.source']); - const DRAWER_KEY = /(?:^|[\s,{])["']?(?:drawerSide|drawerWidth)["']?\s*:/; + /** `name:` written as a key, quoted or bare — never as a substring of another key. */ + const keyAuthored = (...names: string[]) => new RegExp(`(?:^|[\\s,{])["']?(?:${names.join('|')})["']?\\s*:`); + const DRAWER_KEY = keyAuthored('drawerSide', 'drawerWidth'); + const MODAL_KEY = keyAuthored('modalSize'); /** The text of each `{ … }` literal at `depth` inside the literal opened at `start`. */ const topLevelText = (text: string, start: number, depth: number): string[] => { @@ -305,18 +523,21 @@ describe('tree-scoped absence: no form view inside the declared radius still aut return out; }; - /** Whether some form view literal holds a drawer key among its own top-level keys. */ - const judge = (raw: string): boolean => { + /** Whether some form literal holds one of `key`'s names among its own top-level keys. */ + const judgeFor = (key: RegExp) => (raw: string): boolean => { // Inline code spans are prose; newline-bounded, so a fenced example is still judged. const text = raw.replace(/`[^`\n]*`/g, ''); - const opener = /["']?\b(form|formViews)["']?\s*:\s*\{/g; + const opener = /["']?\b(form|formViews)["']?\s*:\s*\{|\bdefineForm\(\s*\{/g; for (let m = opener.exec(text); m; m = opener.exec(text)) { const brace = m.index + m[0].length - 1; - const depth = m[1] === 'form' ? 1 : 2; - if (topLevelText(text, brace, depth).some((t) => DRAWER_KEY.test(t))) return true; + // `formViews` holds named forms one level down; `form` and `defineForm` hold the form itself. + const depth = m[1] === 'formViews' ? 2 : 1; + if (topLevelText(text, brace, depth).some((t) => key.test(t))) return true; } return false; }; + const judge = judgeFor(DRAWER_KEY); + const judgeModal = judgeFor(MODAL_KEY); /** * Structural exclusions — the retirement kit, each with its reason. ⛔ NOT an @@ -328,7 +549,7 @@ describe('tree-scoped absence: no form view inside the declared radius still aut THIS_FILE, ]); const EXCLUDED_PREFIXES = [ - // The D2 conversion's fixture authors the pre-retirement form on purpose. + // The D2 conversions' fixtures author the pre-retirement form on purpose. 'packages/spec/src/conversions/', // Release-owned prose records the removal; never edited by a code PR. 'content/docs/releases/', @@ -346,22 +567,40 @@ describe('tree-scoped absence: no form view inside the declared radius still aut it('the matcher recognises an authoring and ignores its neighbours (anti-vacuity)', () => { expect(judge("form: { type: 'simple', drawerSide: 'left', sections: [] },")).toBe(true); - expect(judge("formViews: { quick: { modalSize: 'lg', drawerWidth: '480px' } },")).toBe(true); + expect(judge("formViews: { quick: { columns: 2, drawerWidth: '480px' } },")).toBe(true); + expect(judge("defineForm({ name: 'task.intake', object: 'task', drawerSide: 'left' })")).toBe(true); expect(judge('{ "formViews": {\n "quick": { "drawerSide": "left" }\n} }')).toBe(true); expect(judge("Prose.\n\n```ts\nform: { drawerWidth: '50%' }\n```\n")).toBe(true); // Neighbours that must NOT match: the blocks that keep the keys, and deeper nesting. expect(judge("properties: { objectName: 'task', formType: 'drawer', drawerSide: 'right' },")).toBe(false); expect(judge('')).toBe(false); - expect(judge("form: { modalSize: 'lg', sections: [{ label: 'A', fields: [] }] },")).toBe(false); - expect(judge("formViews: { quick: { modalSize: 'lg' } },")).toBe(false); + expect(judge("form: { columns: 2, sections: [{ label: 'A', fields: [] }] },")).toBe(false); + expect(judge("formViews: { quick: { columns: 2 } },")).toBe(false); expect(judge("form: { sections: [{ props: { drawerSide: 'left' } }] }")).toBe(false); expect(judge('a form once wrote `form: { drawerSide: "left" }`.')).toBe(false); }); - it('no form view authoring `drawerSide` or `drawerWidth` survives inside the declared radius', () => { - const offenders: string[] = []; - let visited = 0; - let mentioning = 0; + it('the `modalSize` matcher recognises an authoring and ignores its neighbours (anti-vacuity)', () => { + expect(judgeModal("form: { type: 'simple', modalSize: 'lg', sections: [] },")).toBe(true); + expect(judgeModal("formViews: { quick: { columns: 2, modalSize: 'full' } },")).toBe(true); + expect(judgeModal('{ "formViews": {\n "quick": { "modalSize": "lg" }\n} }')).toBe(true); + expect(judgeModal("Prose.\n\n```ts\nform: { modalSize: 'sm' }\n```\n")).toBe(true); + expect(judgeModal("defineForm({ name: 'task.intake', object: 'task', modalSize: 'lg' })")).toBe(true); + // Neighbours that must NOT match: the blocks that keep the key, and deeper nesting. + expect(judgeModal("properties: { objectName: 'task', formType: 'modal', modalSize: 'lg' },")).toBe(false); + expect(judgeModal('')).toBe(false); + expect(judgeModal("form: { columns: 2, sections: [{ label: 'A', fields: [] }] },")).toBe(false); + expect(judgeModal("form: { sections: [{ props: { modalSize: 'lg' } }] }")).toBe(false); + expect(judgeModal("formViews: { quick: { drawerWidth: '480px' } },")).toBe(false); + expect(judgeModal('a form once wrote `form: { modalSize: "lg" }`.')).toBe(false); + }); + + /** One pass over the declared radius, judged for both retirements. */ + type Walk = { visited: number; mentioning: number; drawer: string[]; modal: string[] }; + let walked: Walk | undefined; + const walkOnce = (): Walk => { + if (walked) return walked; + const walk: Walk = { visited: 0, mentioning: 0, drawer: [], modal: [] }; const skipDir = (name: string) => SKIPPED_DIRS.has(name) || name.startsWith('.'); for (const root of WALK_ROOTS) { for (const full of listRepoWalkFiles(path.join(REPO_ROOT, root), { skipDir })) { @@ -375,17 +614,31 @@ describe('tree-scoped absence: no form view inside the declared radius still aut if (name === 'CHANGELOG.md') continue; // release prose records the removal if (EXCLUDED.has(rel) || EXCLUDED_PREFIXES.some((p) => rel.startsWith(p))) continue; if (TSUP_BUNDLED_CONFIG.test(name)) continue; - visited += 1; + walk.visited += 1; const text = readIfPresent(full); if (text === undefined) continue; - if (/["']?\bformViews["']?\s*:\s*\{/.test(text)) mentioning += 1; - if (judge(text)) offenders.push(rel); + if (/["']?\bformViews["']?\s*:\s*\{/.test(text)) walk.mentioning += 1; + if (judge(text)) walk.drawer.push(rel); + if (judgeModal(text)) walk.modal.push(rel); } } + walked = walk; + return walk; + }; + + it('no form view authoring `drawerSide` or `drawerWidth` survives inside the declared radius', () => { + const walk = walkOnce(); // Anti-vacuity: the walk covered the tree, and files that DO author a // `formViews` block were really judged. - expect(visited).toBeGreaterThan(1000); - expect(mentioning).toBeGreaterThan(0); - expect(offenders, 'a form view authoring a drawer key means the retirement is being undone').toEqual([]); + expect(walk.visited).toBeGreaterThan(1000); + expect(walk.mentioning).toBeGreaterThan(0); + expect(walk.drawer, 'a form view authoring a drawer key means the retirement is being undone').toEqual([]); + }); + + it('no form view authoring `modalSize` survives inside the declared radius', () => { + const walk = walkOnce(); + expect(walk.visited).toBeGreaterThan(1000); + expect(walk.mentioning).toBeGreaterThan(0); + expect(walk.modal, 'a form view authoring `modalSize` means the retirement is being undone').toEqual([]); }); }); diff --git a/packages/spec/src/ui/form-view-type-layout-retirement.test.ts b/packages/spec/src/ui/form-view-type-layout-retirement.test.ts index 913cbf81fc2..94303af5e92 100644 --- a/packages/spec/src/ui/form-view-type-layout-retirement.test.ts +++ b/packages/spec/src/ui/form-view-type-layout-retirement.test.ts @@ -16,7 +16,10 @@ * 2. The split-only keys `sections[].pane` (and the legacy `groups[].pane`), * `splitSize`, `splitResizable` and — since the renderer half, #27159 — * `splitDirection` are `retiredKey()` tombstones, refused on every - * layout. `modalSize` stays declared — a stated boundary, pinned as one. + * layout. `modalSize` stayed declared here, a stated boundary, and was + * retired at 19 ([#36544] `form-view-modal-size-removed`): the boundary + * pin below now asserts its refusal, and its kit is pinned in + * `form-view-drawer-keys-retirement.test.ts`. * ([#29012] `drawerSide` / `drawerWidth` stayed here and were retired * later in the same release: `form-view-drawer-keys-removed`, pinned in * `form-view-drawer-keys-retirement.test.ts`.) @@ -228,16 +231,23 @@ describe('the split-only keys — `pane`, `splitSize`, `splitResizable`, `splitD ])); }); - it('STATED BOUNDARY: `modalSize` stays declared', () => { - // `modalSize` stays declared; since #36425 the console's record dialog reads no form view (its verdict: #36544). - // [#29012] `drawerSide` / `drawerWidth` left this boundary: they are - // tombstones now (`form-view-drawer-keys-retirement.test.ts`). + it('THE BOUNDARY MOVED: `modalSize` no longer stays declared, it is refused with its prescription', () => { + // [#36544] `modalSize` was this retirement's stated boundary while the + // console's record dialog read it. That dialog reads no form view since + // #36425, so the key is a tombstone now, as `drawerSide` / `drawerWidth` + // are ([#29012]); the kit of both is pinned in + // `form-view-drawer-keys-retirement.test.ts`. const r = FormViewSchema.safeParse({ type: 'simple', sections: SECTIONS, modalSize: 'lg', }); - expect(r.success).toBe(true); + expect(r.success).toBe(false); + expect(r.error!.issues, JSON.stringify(r.error!.issues)).toHaveLength(1); + expect(r.error!.issues[0]!.path).toEqual(['modalSize']); + expect(r.error!.issues[0]!.message.startsWith('`view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049)'), r.error!.issues[0]!.message).toBe(true); + // The same form without the key is the form this retirement left legal. + expect(FormViewSchema.safeParse({ type: 'simple', sections: SECTIONS }).success).toBe(true); }); it('fails tsc at the authoring site: the tombstoned keys admit only absence', () => { @@ -414,8 +424,9 @@ describe(`the D2 conversion ${CONVERSION_ID}`, () => { splitDirection: 'vertical', sections: [{ label: 'A', pane: 'primary', fields: ['name'] }, { label: 'B', pane: 'secondary', fields: ['email'] }], }, - // [#29012] The bystander is `modalSize`: `drawerSide` is stripped by its own conversion now. - quick: { type: 'drawer', modalSize: 'lg', sections: [{ label: 'Q', fields: ['status'] }] }, + // The bystander is `columns`: `drawerSide` ([#29012]) and `modalSize` + // ([#36544]) are each stripped by a conversion of their own now. + quick: { type: 'drawer', columns: 2, sections: [{ label: 'Q', fields: ['status'] }] }, }, }; const notices: ConversionNotice[] = []; @@ -432,7 +443,7 @@ describe(`the D2 conversion ${CONVERSION_ID}`, () => { expect(parsed.formViews?.beside?.type).toBe('simple'); expect(parsed.formViews?.beside).not.toHaveProperty('splitDirection'); expect(parsed.formViews?.quick?.type).toBe('simple'); - expect(parsed.formViews?.quick?.modalSize).toBe('lg'); + expect(parsed.formViews?.quick?.columns).toBe(2); // A live layout is the author's and is never touched. expect(out.form).toBe(row.form); // Copy-on-write: the stored row is not mutated. @@ -440,11 +451,11 @@ describe(`the D2 conversion ${CONVERSION_ID}`, () => { }); it('a STORED form view item record converts its `config`', () => { - const row = { name: 'crm_lead.peek', object: 'crm_lead', viewKind: 'form', config: { type: 'modal', modalSize: 'lg', sections: SECTIONS } }; + const row = { name: 'crm_lead.peek', object: 'crm_lead', viewKind: 'form', config: { type: 'modal', columns: 2, sections: SECTIONS } }; const notices: ConversionNotice[] = []; const out = applyConversionsToStoredItem('view', row, { onNotice: (n) => notices.push(n) }) as typeof row; expect(notices.filter(ours).map((n) => n.path)).toEqual(['views[0].config.type']); - expect(out.config).toEqual({ modalSize: 'lg', sections: SECTIONS }); + expect(out.config).toEqual({ columns: 2, sections: SECTIONS }); expect(ViewItemSchema.safeParse(out).success).toBe(true); }); diff --git a/packages/spec/src/ui/react-blocks.ts b/packages/spec/src/ui/react-blocks.ts index 7915dcacfe0..49ea9c59fc5 100644 --- a/packages/spec/src/ui/react-blocks.ts +++ b/packages/spec/src/ui/react-blocks.ts @@ -95,7 +95,11 @@ export const REACT_OVERLAY_SHADOWS: Readonly> // (the #9392 rule: a prop only the react/registry tier reads lives here, not // in `dataProps`). The collision is the tombstone's name, never a second // meaning. - ObjectForm: ['drawerSide', 'drawerWidth'], + // `modalSize` — [#36544] the same shape: a form VIEW never opens in a dialog + // (the console's New / Edit dialog sizes itself), so `FormViewSchema` + // tombstones the key, while this block's `formType='modal'` container still + // reads it. The overlay is the block's only declaration of it. + ObjectForm: ['drawerSide', 'drawerWidth', 'modalSize'], }; /** @@ -250,7 +254,9 @@ export const REACT_BLOCKS: ReactBlockDef[] = [ // [#27159] `splitDirection` left with the split form renderer (ADR-0050). // [#29012] `drawerSide` / `drawerWidth` left the form view (tombstones) and // moved to the overlay below: the block's drawer container still reads them. - dataProps: ['layout', 'columns', 'tabPosition', 'modalSize', 'sections', 'subforms', 'submitBehavior'], + // [#36544] `modalSize` followed them: no form view opens in a dialog, and + // the block's modal container still reads it. + dataProps: ['layout', 'columns', 'tabPosition', 'sections', 'subforms', 'submitBehavior'], interactions: [ OBJECT_NAME, { name: 'mode', type: "'create' | 'edit' | 'view'", kind: 'controlled', description: 'Create a new record, or edit/view an existing one — drive from React state.' }, @@ -280,6 +286,12 @@ export const REACT_BLOCKS: ReactBlockDef[] = [ // (objectui `ObjectFormContainer` → `DrawerForm`) reads them. { name: 'drawerSide', type: "'top' | 'bottom' | 'left' | 'right'", kind: 'binding', description: "Edge the drawer container opens from, when the React `ObjectForm` block opens this form with formType 'drawer'" }, { name: 'drawerWidth', type: 'string', kind: 'binding', description: 'Size of the drawer container the React `ObjectForm` block opens with formType \'drawer\', as a CSS length such as "480px": its width when drawerSide is left or right, its height when top or bottom. Unset, the drawer keeps its default size.' }, + // [#36544] Retired from FormViewSchema (a form view never opens in a + // dialog) and declared here: only this block's `formType='modal'` + // container (objectui `ObjectFormContainer` → `ModalForm`) reads it. The + // description is the `object-form` page block's own + // (`ObjectFormPropsSchema.modalSize`), plus what an unset value does. + { name: 'modalSize', type: "'sm' | 'default' | 'lg' | 'xl' | 'full'", kind: 'binding', description: "Size bucket of the block's modal container (formType 'modal'). Unset, the modal picks a size from the form's columns and field count." }, { name: 'modalCloseButton', type: 'boolean', kind: 'binding', description: "Show the close button of the block's modal container (formType 'modal')." }, { name: 'contentLayout', type: "'simple' | 'tabbed'", kind: 'binding', description: "How the modal presentation lays out sections; 'tabbed' needs more than one section to differ from 'simple'." }, { name: 'confirmOnDiscard', type: 'boolean', kind: 'binding', description: 'Ask before discarding unsaved edits when a drawer/modal form is dismissed. Set false to close immediately.' }, diff --git a/packages/spec/src/ui/view.zod.ts b/packages/spec/src/ui/view.zod.ts index 6bcc1c123a8..f451d8f79e2 100644 --- a/packages/spec/src/ui/view.zod.ts +++ b/packages/spec/src/ui/view.zod.ts @@ -5399,6 +5399,26 @@ const FORM_VIEW_DRAWER_WIDTH_RETIRED = + 'bucket, and the React `ObjectForm` block keeps its own `drawerWidth` prop for the drawer it opens. ' + FORM_VIEW_TYPE_RETIRED_FIX; +// [#36544] `modalSize` (ADR-0049 enforce-or-remove; seat ruling on the card: +// retire). Its one form-view reader was the console's New / Edit record +// dialog, and since #36425 that dialog loads no form view: it lays the record +// out by the object's field groups and chooses its own size. A named or public +// form opens on a page of its own (`/forms/NAME`), never in a dialog, and no +// server surface reads the key, so a stored `modalSize: 'lg'` saved, served and +// changed nothing. The one modal that reads a `modalSize` is the container the +// React `ObjectForm` block opens with `formType='modal'`, and that block keeps +// the prop as its own (`react-blocks.ts` overlay; the `object-form` page +// block's `ObjectFormPropsSchema` declares it too). The +// `form-view-modal-size-removed` conversion (ADR-0087 D2) strips it from +// stored rows and sources. Declared with `//` on purpose, as above. +const FORM_VIEW_MODAL_SIZE_RETIRED = + '`view.form.modalSize` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no form view opens in a ' + + 'dialog, so nothing reads it from a form view. Delete the key: the console\'s New and Edit dialogs lay ' + + 'a record out by the object\'s `fieldGroups` and choose their own size, a form opened by name gets a ' + + 'page of its own, and the React `ObjectForm` block keeps its own `modalSize` prop for the modal it ' + + 'opens with `formType=\'modal\'`. ' + + 'Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand.'; + // Form-view `layout` retired-value prescriptions (#20221, ADR-0049 // enforce-or-remove). Declared with `//` on purpose — the // `LIST_VIEW_EXPORT_PDF_RETIRED` placement note applies here too. An @@ -5696,11 +5716,12 @@ export const FormViewSchema = lazySchema(() => strictObject({ /** [#29012] RETIRED — {@link FORM_VIEW_DRAWER_WIDTH_RETIRED}. */ drawerWidth: retiredKey(FORM_VIEW_DRAWER_WIDTH_RETIRED), /** - * Size bucket of the dialog a caller opens this form in. [#36425] The - * console's New / Edit dialog no longer reads a form view, so it is not that - * caller: it sizes itself. Its liveness verdict is re-audited on #36544. + * [#36544] RETIRED — {@link FORM_VIEW_MODAL_SIZE_RETIRED}. Inert on a form + * view since the console's New / Edit dialog stopped loading one (#36425); + * the React `ObjectForm` block declares its own `modalSize` in its overlay + * (`react-blocks.ts`). */ - modalSize: z.enum(['sm', 'default', 'lg', 'xl', 'full']).optional().describe("Size bucket of the dialog a caller opens this form in: the console's New / Edit dialog, or the modal container of the React `ObjectForm` block (formType 'modal')"), + modalSize: retiredKey(FORM_VIEW_MODAL_SIZE_RETIRED), /** * Data Source Configuration. NOT removed in the #3896 sweep despite the diff --git a/skills/objectstack-ui/references/react-blocks.md b/skills/objectstack-ui/references/react-blocks.md index 472d8e6c7c6..2a0abbf904b 100644 --- a/skills/objectstack-ui/references/react-blocks.md +++ b/skills/objectstack-ui/references/react-blocks.md @@ -25,6 +25,7 @@ Server-connected create/edit/view form for one object. Config props come from th | `readOnly` | `boolean` | binding | | Render every field read-only, whatever `mode` says. | | `drawerSide` | `'top' \| 'bottom' \| 'left' \| 'right'` | binding | | Edge the drawer container opens from, when the React `ObjectForm` block opens this form with formType 'drawer' | | `drawerWidth` | `string` | binding | | Size of the drawer container the React `ObjectForm` block opens with formType 'drawer', as a CSS length such as "480px": its width when drawerSide is left or right, its height when top or bottom. Unset, the drawer keeps its default size. | +| `modalSize` | `'sm' \| 'default' \| 'lg' \| 'xl' \| 'full'` | binding | | Size bucket of the block's modal container (formType 'modal'). Unset, the modal picks a size from the form's columns and field count. | | `modalCloseButton` | `boolean` | binding | | Show the close button of the block's modal container (formType 'modal'). | | `contentLayout` | `'simple' \| 'tabbed'` | binding | | How the modal presentation lays out sections; 'tabbed' needs more than one section to differ from 'simple'. | | `confirmOnDiscard` | `boolean` | binding | | Ask before discarding unsaved edits when a drawer/modal form is dismissed. Set false to close immediately. | @@ -46,7 +47,6 @@ Server-connected create/edit/view form for one object. Config props come from th | `layout` | `'vertical' \| 'horizontal'` | data | | Field layout direction — 'vertical' (the renderer default) or 'horizontal'. Multi-column is not a layout value: set `columns` | | `columns` | `integer` | data | | Number of columns for the form body | | `tabPosition` | `'top' \| 'bottom' \| 'left' \| 'right'` | data | | Tab strip position (tabbed forms) | -| `modalSize` | `'sm' \| 'default' \| 'lg' \| 'xl' \| 'full'` | data | | Size bucket of the dialog a caller opens this form in: the console's New / Edit dialog, or the modal container of the React `ObjectForm` block (formType 'modal… | | `sections` | `object[]` | data | | | | `subforms` | `object[]` | data | | Inline master-detail child collections | | `submitBehavior` | `object` | data | | Post-submit behavior. On the `redirect` arm, `url` is relative-only and interpolates only declared record fields as `{{record.field_name}}`, URL-escaped. |