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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .changeset/38140-form-subforms-retired.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
'@objectstack/spec': minor
'@objectstack/skills': patch
---

feat(spec)!: a form no longer declares `subforms`; no form surface draws a form's own child tables, which the object's field groups place

Clause-②: yes (narrowing)

Metadata-protocol: narrowed

<!-- adr-0087: registered form-view-subforms-removed, ui-form-view-subforms-retired -->

**BREAKING** accept-set narrowing on the form surface (`@objectstack/spec`), ADR-0049 enforce-or-remove.

The readers of a form's `subforms` were the console's New and Edit record surfaces, which copied it from the object's internal form view. Through 18.6.0 those surfaces drew the child tables a form listed. From 19.0.0 they load no form view (the `internal-record-forms-not-loaded` entry): a record's child tables come from the object alone, as its field groups place them. The page a form opened by name or by a public link gets never drew a child table, and the public submit route writes one record. So on 19 a form saved with `subforms` is accepted, served and drawn exactly as one without it.

- **FROM → TO.** `subforms: [{ childObject, … }]` on a form (a `form` item; a stored view's `form` and `formViews.<key>`; a form view item's `config`) → nothing on the form. A child table that should be entered with the record is placed on the parent object: a field group whose `relatedList` names the child, for example `{ key: 'lines', label: 'Lines', relatedList: 'order_line' }` in `fieldGroups`, or `'order_line.order'` when the child points at the parent more than once. Every New and Edit form of the object then draws the table at that group and saves the record and its rows together.
- **What an entry set beside `childObject`.** On the child's relationship field: `title` is `inlineTitle`, `columns` is `inlineColumns`, `amountField` is `inlineAmountField`. `totalField` has no twin there: a parent total is a `summary` field on the parent. `addLabel`, `minRows` and `maxRows` have none.
- **The one-line fix.** Delete `subforms` from the form. `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-subforms-removed` conversion), so a form saved with the key keeps loading, and deleting it changes nothing a reader sees on 19.
- **Coming from 18.x.** A New or Edit form whose form view listed `subforms` drew those child tables through 18.6.0. On 19 it draws the child tables the object's field groups place. A child the form listed and no field group places is entered from the parent record's related list, not inside the parent's form, until a field group names it. The conversion cannot add that group: it would change every New and Edit form of the object, which is a decision about the object.
- **What the parse says.** "`form.subforms` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no renderer reads it: …", naming the field group's `relatedList`, at every form door (a `form` item, a stored view's `form` and `formViews.*`, a form view item record, a flattened form overlay) and at `defineStack` as `STACK_SCHEMA_INVALID` / 422. TypeScript rejects the key at the authoring site.
- **Unchanged.** The React `ObjectForm` block still takes `subforms`: the react-tier contract now declares it on the block itself, with the entry's shape written out. The `object-master-detail-form` page block keeps its `details`. A field's `inlineColumns` and the related-list keys are not touched.

The retirement kit: the `retiredKey()` tombstone on `FormViewSchema` (the `form` item takes it by reference); the D2 conversion `form-view-subforms-removed` (protocol 19, retired from the load path, reaching `form`, `formViews.*`, form view items, flattened form overlays and `forms[]`, ordered after the move of a view's forms to `forms[]`); `RETIRED_KEYS_BY_MAJOR[19]` rows `ui/FormView:subforms` and `ui/Form:subforms`; the D3 entry `ui-form-view-subforms-retired`; the liveness row `form.json` `subforms`, now `dead`.

Also corrected: the protocol-19 D3 entry `master-detail-related-list-tab-by-default` said a form view that declares its own subforms still inlines what it declares. No form does, and the sentence is gone. The `split` form type's parse prescription pointed at the same key for a child grid beside the parent, and now names the field group's `relatedList`. `defineStack`'s inline-column check no longer walks a form's `subforms`, which the parse refuses first.

`@objectstack/skills`: `skills/objectstack-ui/references/react-blocks.md` is regenerated. `<ObjectForm>`'s `subforms` is listed as a binding prop from the block's overlay, with its entry shape, no longer as a data prop from the form schema.
32 changes: 2 additions & 30 deletions content/docs/references/ui/view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Column footer summary configuration
| **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<string, string>; description?: string; collapsible?: boolean; … }[]` | optional | |
| **groups** | `{ name?: string; label?: string \| Record<string, string>; 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 |
| **subforms** | `never` | optional | [REMOVED] `form.subforms` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no renderer reads it: the page a form opened by name or by a public link gets never drew a child table, and a record's New and Edit forms take their child tables from the object, not from a form. Delete the key. To enter child rows with the record, place the child table on the object: a field group whose `relatedList` names the child relationship (`fieldGroups[].relatedList`, a child object name or `object.field`), which every New and Edit form of the object draws at that group. The React `ObjectForm` block keeps its own `subforms` prop. 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. |
| **sharing** | `{ enabled?: boolean; publicLink?: string; password?: string; allowedDomains?: string[]; … }` | optional | Public sharing configuration for this form |
| **submitBehavior** | `{ kind: 'thank-you'; title?: string; message?: string } \| { kind: 'redirect'; url: string; delayMs?: integer } \| { kind: 'continue' } \| { kind: 'next-record' }` | optional | Post-submit behavior. On the `redirect` arm, `url` is relative-only and interpolates only declared record fields as `{{record.field_name}}`, URL-escaped. |
| **buttons** | `{ submit?: object; cancel?: object }` | optional | Form action-button visibility & labels; folded onto the flat renderer props by ObjectUI ObjectForm. |
Expand Down Expand Up @@ -259,20 +259,6 @@ Column footer summary configuration
| **group** | `string` | optional | Field group key (snake_case) whose members and presentation this section inherits, from the bound object's `fieldGroups` (ADR-0085 §5 `deriveFieldGroupLayout`). Mutually exclusive with `fields`, and with every key the group itself declares (`name`, `label`, `description`, `collapsible`, `collapsed`, `visibleWhen`). Not valid on a wizard step. Must name a declared group — checked by reference diagnostics. |
| **fields** | `(string \| { field: string; type?: Enum<'text' \| 'textarea' \| 'email' \| 'url' \| 'phone' \| 'password' \| 'secret' \| …>; options?: object[]; reference?: string; … })[]` | optional | |

### Nested Shape: `Form.subforms[number]`

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **childObject** | `string` | ✅ | Child object whose records are entered inline |
| **relationshipField** | `string` | optional | FK on the child pointing back to the parent (auto-detected when omitted) |
| **columns** | `{ name: string; label?: string; type?: Enum<'text' \| 'number' \| 'currency' \| 'date' \| 'datetime' \| 'time' \| 'select' \| …>; width?: number; … }[]` | optional | Editable grid columns (derived from the child object when omitted). Each entry is the strict, name-keyed inline grid column a relationship field's `inlineColumns` takes (`{ name, label?, type?, … }` — objectui GridColumn); identity-only entries (`{ name }`) hydrate everything else from the child object's fields. Unknown keys and the retired `field` spelling are refused at parse. |
| **amountField** | `string` | optional | Numeric child column summed for the running total |
| **totalField** | `string` | optional | Parent field to receive the rolled-up sum |
| **title** | `string` | optional | Section title |
| **addLabel** | `string` | optional | Add-row button label |
| **minRows** | `number` | optional | |
| **maxRows** | `number` | optional | |

### Nested Shape: `Form.sharing`

| Property | Type | Required | Description |
Expand Down Expand Up @@ -548,7 +534,7 @@ Form-view select option — the object-field option shape minus the per-option `
| **data** | `{ provider: 'object'; object: string } \| { provider: 'value'; items: any[] } \| { provider: 'schema'; schemaId: string; schema?: Record<string, any> }` | optional | Data source configuration (defaults to "object" provider) |
| **sections** | `{ name?: string; label?: string \| Record<string, string>; description?: string; collapsible?: boolean; … }[]` | optional | |
| **groups** | `{ name?: string; label?: string \| Record<string, string>; 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 |
| **subforms** | `never` | optional | [REMOVED] `form.subforms` was removed in @objectstack/spec 19.0.0 (ADR-0049) — no renderer reads it: the page a form opened by name or by a public link gets never drew a child table, and a record's New and Edit forms take their child tables from the object, not from a form. Delete the key. To enter child rows with the record, place the child table on the object: a field group whose `relatedList` names the child relationship (`fieldGroups[].relatedList`, a child object name or `object.field`), which every New and Edit form of the object draws at that group. The React `ObjectForm` block keeps its own `subforms` prop. 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. |
| **sharing** | `{ enabled?: boolean; publicLink?: string; password?: string; allowedDomains?: string[]; … }` | optional | Public sharing configuration for this form |
| **submitBehavior** | `{ kind: 'thank-you'; title?: string; message?: string } \| { kind: 'redirect'; url: string; delayMs?: integer } \| { kind: 'continue' } \| { kind: 'next-record' }` | optional | Post-submit behavior. On the `redirect` arm, `url` is relative-only and interpolates only declared record fields as `{{record.field_name}}`, URL-escaped. |
| **buttons** | `{ submit?: object; cancel?: object }` | optional | Form action-button visibility & labels; folded onto the flat renderer props by ObjectUI ObjectForm. |
Expand Down Expand Up @@ -608,20 +594,6 @@ Form-view select option — the object-field option shape minus the per-option `
| **group** | `string` | optional | Field group key (snake_case) whose members and presentation this section inherits, from the bound object's `fieldGroups` (ADR-0085 §5 `deriveFieldGroupLayout`). Mutually exclusive with `fields`, and with every key the group itself declares (`name`, `label`, `description`, `collapsible`, `collapsed`, `visibleWhen`). Not valid on a wizard step. Must name a declared group — checked by reference diagnostics. |
| **fields** | `(string \| { field: string; type?: Enum<'text' \| 'textarea' \| 'email' \| 'url' \| 'phone' \| 'password' \| 'secret' \| …>; options?: object[]; reference?: string; … })[]` | optional | |

### Nested Shape: `FormView.subforms[number]`

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **childObject** | `string` | ✅ | Child object whose records are entered inline |
| **relationshipField** | `string` | optional | FK on the child pointing back to the parent (auto-detected when omitted) |
| **columns** | `{ name: string; label?: string; type?: Enum<'text' \| 'number' \| 'currency' \| 'date' \| 'datetime' \| 'time' \| 'select' \| …>; width?: number; … }[]` | optional | Editable grid columns (derived from the child object when omitted). Each entry is the strict, name-keyed inline grid column a relationship field's `inlineColumns` takes (`{ name, label?, type?, … }` — objectui GridColumn); identity-only entries (`{ name }`) hydrate everything else from the child object's fields. Unknown keys and the retired `field` spelling are refused at parse. |
| **amountField** | `string` | optional | Numeric child column summed for the running total |
| **totalField** | `string` | optional | Parent field to receive the rolled-up sum |
| **title** | `string` | optional | Section title |
| **addLabel** | `string` | optional | Add-row button label |
| **minRows** | `number` | optional | |
| **maxRows** | `number` | optional | |

### Nested Shape: `FormView.sharing`

| Property | Type | Required | Description |
Expand Down
12 changes: 6 additions & 6 deletions docs/audits/2026-07-unknown-key-strictness-ledger.counts/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The `strict` column is the one the campaign schedules against; it counts both th

| Dir | Sites | strict | passthrough | catchall | strip |
|---|---|---|---|---|---|
| `ui/` | 231 | 221 | 6 | 0 | 4 |
| `ui/` | 230 | 220 | 6 | 0 | 4 |

## `ui/` — sites

Expand All @@ -45,25 +45,25 @@ classify and is not listed (it becomes reportable the day it grows its first sit
| `report.zod.ts` | 4 |
| `responsive.zod.ts` | 1 |
| `sharing.zod.ts` | 1 |
| `view.zod.ts` | 65 |
| `view.zod.ts` | 64 |
| `widget.zod.ts` | 1 |
| **total** | **231** |
| **total** | **230** |

## `ui/` — open

Per file, how many of its sites still silently discard unknown keys. The `Class`
column that decides the bucket split is hand-written in the ledger; the arithmetic
over it is here.

**4 strip of 231**, in 4 file(s).
**4 strip of 230**, in 4 file(s).

| File | Strip | Sites |
|---|---|---|
| `action-params.zod.ts` | 1 | 1 |
| `app.zod.ts` | 1 | 20 |
| `view.zod.ts` | 1 | 65 |
| `view.zod.ts` | 1 | 64 |
| `widget.zod.ts` | 1 | 1 |
| **total** | **4** | **231** |
| **total** | **4** | **230** |

| Bucket | Sites |
|---|---|
Expand Down
Loading
Loading