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
25 changes: 25 additions & 0 deletions .changeset/36403-view-column-state-retired.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
'@objectstack/spec': minor
---

fix(spec)!: retire `columnState` from the stored `view` row — column widths live in each reader's browser and a column order is saved into the view itself

Clause-②: no (narrowing) — `columnState` stops being an accepted key on a view item record and on a flattened view overlay; no published export is removed
Metadata-protocol: narrowed

<!-- adr-0087: registered view-column-state-retired -->

**BREAKING** for a stored `view` row, a package view or a source that still carries `columnState`. The key held the console grid's per-user column order and widths on a shared view row (admitted as a runtime-only overlay key in 17.1.0). Since #35955 nothing writes it: a column drag goes to the list's draft and is saved into the view's own `columns` / `fieldOrder`, and column widths are kept in the reader's browser, per view. Until this release a stored layout was still applied: a reader with no column order or widths of their own in the browser saw the order and widths the row held. It is not carried forward (the maintainer's ruling on #35955, restated on #36403 in comment 7079029398: a stored layout is not migrated): from this release that reader sees the view's own columns, column order and widths. No stored order is moved into `fieldOrder`; to keep a layout for everyone, reorder the columns and Save to the view, or set `width` on the columns.

What moves (each line FROM → TO):

- `columnState` on a view item record (`ViewItemWireSchema`, member 1 of the `view` union the `PUT /api/v1/meta/view/:name` save validates) and on a flattened view overlay (`VIEW_METADATA_MEMBERS.listOverlay` / `formOverlay`): FROM `{ order?: string[]; widths?: Record<string, number> }` accepted and stored TO a `retiredKey()` tombstone — the save answers 422 `INVALID_METADATA` with the prescription at the key, and `tsc` types the key `never`.
- `VIEW_CONSOLE_ROUND_TRIP_KEYS` (`@objectstack/spec/ui`): FROM six keys TO five; `columnState` is gone, so the console derivations read off it (`@object-ui/data-objectstack`'s `listViews()` row keys, `@object-ui/app-shell`'s view-config save) stop carrying it without an edit.
- `columnState` on an authored view item or a list view body: still refused by name, now with the retirement text instead of the runtime-only note.
- a stored `view` row (every read replays the conversions before the row is served or badged), a package export or environment artifact (`viewItems`), and a source run through `os migrate meta --from 17`: the D2 conversion `view-column-state-removed` deletes the key from a view item record and from a flattened overlay; containers are untouched.

The fix: delete the key. To ship a default column order, list `columns` in that order (or set `fieldOrder`); to ship a default width, set `width` on the column. Run `os migrate meta --from 17` to list the mechanical edits for existing sources, and `os migrate meta --stored --apply` to rewrite stored rows.

One stored class is not brought back into the accept set: an overlay row that held nothing but its identity (`name` / `object` / `viewKind` / `label`) and `columnState` — what a column drag on a system view wrote before the overlay writer retired — is left identity-only, which the `view` door refuses ("only identity fields"). It is served badged invalid and `--apply` reports it `failed`. Delete such a row; it held only a column layout that is not carried forward. D3 entry: `view-column-state-retired`.

The retirement kit: `retiredKey()` tombstones in `ui/view.zod.ts`, D2 `view-column-state-removed` (step 18), `RETIRED_KEYS_BY_MAJOR[18]` rows `ui/ViewItemWire:columnState` and `ui/ViewMetadata:columnState`, D3 `view-column-state-retired`, the regenerated `view.mdx` reference, and the pin `ui/view-column-state-retirement.test.ts`.
18 changes: 2 additions & 16 deletions content/docs/references/ui/view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2338,7 +2338,7 @@ This schema accepts one of the following structures:
| **isPinned** | `boolean` | optional | Console round-trip: the view is pinned in the object's view switcher. Written by the console's pin toggle through the `view` metadata API and read back to draw the pinned group. Stored on the view's row, which has no per-user scope. Not authored. |
| **sortOrder** | `integer` | optional | Console round-trip: the view's position among the object's saved views in the switcher, 0-based and counted over saved views only (a code-defined view carries none). Written by the console's drag-reorder and read back to order the tabs. Not authored: `order` is the authored default position. |
| **visibility** | `Enum<'private' \| 'team' \| 'organization' \| 'public'>` | optional | Console round-trip: the group the switcher files this view's tab under (private, team, organization or public). Display grouping only, NOT access control: nothing restricts who can list or open the view by this value. No console control sets it; the console carries a stored value forward when it re-saves the row. Not authored. |
| **columnState** | `{ order?: string[]; widths?: Record<string, number> }` | optional | Studio round-trip: column order/widths (runtime-only state, written by the console grid and stored on the view's row, which has no per-user scope — not authored) |
| **columnState** | `never` | optional | [REMOVED] `view.columnState` was removed in @objectstack/spec 18.7.0 (ADR-0049 enforce-or-remove) — it held one column order and set of widths on a shared view row; nothing writes it any more, and a stored layout is no longer applied, so every reader sees the view's own column order and widths. The console keeps column widths in each reader's browser and saves a column order into the view itself. Delete the key. To ship a column order, list `columns` in that order (or set `fieldOrder`); to ship a width, set `width` on the column. 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. |
| **options** | `never` | optional | Refused: a view item record carries no top-level `options` bag. Its per-kind blocks live under `config` (`config.kanban`, `config.timeline`, …); the legacy `options.KIND` bag belongs to the flattened list overlay only. |

### Nested Shape: `ViewItemWire[viewKind='list'].config`
Expand Down Expand Up @@ -2408,13 +2408,6 @@ This schema accepts one of the following structures:
| **package** | `string` | ✅ | The base package id whose same-named item this item replaces whole (e.g. "com.acme.crm"). Only an item of the base's paired "`<base>`.custom" package declares an override. |
| **basedOn** | `string` | ✅ | Recorded, never a gate: the base package's `manifest.version` this override was taken from (e.g. "3.2.0"), not a history version of the item. Nothing is refused, merged or rebased on it; it tells a person re-basing the override where it started. One reader, as advice: a base's upgrade plan lists an override whose `basedOn` is not the installed base version as stale, beside each override whose base item the upgrade changes (ADR-0146 D2, as amended). |

### Nested Shape: `ViewItemWire[viewKind='list'].columnState`

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **order** | `string[]` | optional | Column order as field names, leftmost first (runtime-only state — written by the console grid, never authored). |
| **widths** | `Record<string, number>` | optional | Column widths in pixels, keyed by field name (runtime-only state — written by the console grid, never authored). |

---

#### Option 2
Expand Down Expand Up @@ -2445,7 +2438,7 @@ This schema accepts one of the following structures:
| **isPinned** | `boolean` | optional | Console round-trip: the view is pinned in the object's view switcher. Written by the console's pin toggle through the `view` metadata API and read back to draw the pinned group. Stored on the view's row, which has no per-user scope. Not authored. |
| **sortOrder** | `integer` | optional | Console round-trip: the view's position among the object's saved views in the switcher, 0-based and counted over saved views only (a code-defined view carries none). Written by the console's drag-reorder and read back to order the tabs. Not authored: `order` is the authored default position. |
| **visibility** | `Enum<'private' \| 'team' \| 'organization' \| 'public'>` | optional | Console round-trip: the group the switcher files this view's tab under (private, team, organization or public). Display grouping only, NOT access control: nothing restricts who can list or open the view by this value. No console control sets it; the console carries a stored value forward when it re-saves the row. Not authored. |
| **columnState** | `{ order?: string[]; widths?: Record<string, number> }` | optional | Studio round-trip: column order/widths (runtime-only state, written by the console grid and stored on the view's row, which has no per-user scope — not authored) |
| **columnState** | `never` | optional | [REMOVED] `view.columnState` was removed in @objectstack/spec 18.7.0 (ADR-0049 enforce-or-remove) — it held one column order and set of widths on a shared view row; nothing writes it any more, and a stored layout is no longer applied, so every reader sees the view's own column order and widths. The console keeps column widths in each reader's browser and saves a column order into the view itself. Delete the key. To ship a column order, list `columns` in that order (or set `fieldOrder`); to ship a width, set `width` on the column. 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. |
| **options** | `never` | optional | Refused: a view item record carries no top-level `options` bag. Its per-kind blocks live under `config` (`config.kanban`, `config.timeline`, …); the legacy `options.KIND` bag belongs to the flattened list overlay only. |

### Nested Shape: `ViewItemWire[viewKind='form'].config`
Expand Down Expand Up @@ -2491,13 +2484,6 @@ This schema accepts one of the following structures:
| **package** | `string` | ✅ | The base package id whose same-named item this item replaces whole (e.g. "com.acme.crm"). Only an item of the base's paired "`<base>`.custom" package declares an override. |
| **basedOn** | `string` | ✅ | Recorded, never a gate: the base package's `manifest.version` this override was taken from (e.g. "3.2.0"), not a history version of the item. Nothing is refused, merged or rebased on it; it tells a person re-basing the override where it started. One reader, as advice: a base's upgrade plan lists an override whose `basedOn` is not the installed base version as stale, beside each override whose base item the upgrade changes (ADR-0146 D2, as amended). |

### Nested Shape: `ViewItemWire[viewKind='form'].columnState`

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **order** | `string[]` | optional | Column order as field names, leftmost first (runtime-only state — written by the console grid, never authored). |
| **widths** | `Record<string, number>` | optional | Column widths in pixels, keyed by field name (runtime-only state — written by the console grid, never authored). |

---


Expand Down
14 changes: 7 additions & 7 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/` | 225 | 214 | 6 | 0 | 5 |
| `ui/` | 224 | 214 | 6 | 0 | 4 |

## `ui/` — sites

Expand All @@ -44,31 +44,31 @@ 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` | 60 |
| `view.zod.ts` | 59 |
| `widget.zod.ts` | 1 |
| **total** | **225** |
| **total** | **224** |

## `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.

**5 strip of 225**, in 4 file(s).
**4 strip of 224**, in 4 file(s).

| File | Strip | Sites |
|---|---|---|
| `action-params.zod.ts` | 1 | 1 |
| `app.zod.ts` | 1 | 20 |
| `view.zod.ts` | 2 | 60 |
| `view.zod.ts` | 1 | 59 |
| `widget.zod.ts` | 1 | 1 |
| **total** | **5** | **225** |
| **total** | **4** | **224** |

| Bucket | Sites |
|---|---|
| authorable — the ruling's forced scope | 1 |
| unresolved — needs a per-schema verdict | 0 |
| wire / open — out of forced scope | 2 |
| wire / open — out of forced scope | 1 |
| no door — no carrier, ADR-0049 territory | 1 |
| no gate — carrier live, no parse | 0 |
| covered — no carrier, no parse, guarded at every consumer | 1 |
2 changes: 1 addition & 1 deletion docs/audits/2026-07-unknown-key-strictness-ledger.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
* double for the reason the #20051 door-half block below gives.
*/
import { describe, expect, it, vi } from 'vitest';
// `./protocol.js` reaches `import('@objectstack/lint')` (the diagnostics and
// build probes); pay its first load at collection, never inside a clocked case.
import '@objectstack/lint';
import { ViewMetadataSchema, VIEW_CONSOLE_ROUND_TRIP_KEYS } from '@objectstack/spec/ui';
import { getMetadataTypeSchema, registerMetadataTypeSchema } from '@objectstack/spec/kernel';
import { z } from 'zod';
Expand Down Expand Up @@ -269,7 +272,8 @@ describe('#7134 what the save path must NOT change', () => {
isDefault: false,
sortOrder: 3,
visibility: 'team',
columnState: { order: ['name'], widths: { name: 180 } },
// [objectstack#36403] `columnState` is retired from the record, so
// this GUARD no longer carries it; the retirement pins it refused.
_isOverride: true,
};
expect(Object.keys(VIEW_CONSOLE_ROUND_TRIP_KEYS).filter(
Expand Down Expand Up @@ -558,7 +562,8 @@ describe('[#20051] stage (iv): a saved view stores the parsed value of every key
['W1 sort', { sort: [{ id: SORT_ROW_ID, field: 'name', order: 'desc' }] }],
['W2 density', { rowHeight: 'compact' }],
['W3 hidden fields', { hiddenFields: ['status'] }],
['W4 column state', { columnState: { order: ['status', 'name'], widths: { name: 180 } } }],
// W4 (column state) is gone: `columnState` retired (objectstack#36403),
// and the console no longer writes it.
['W5 inline edit', { inlineEdit: false }],
];

Expand Down
6 changes: 5 additions & 1 deletion packages/spec/scripts/strictness-ledger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ describe('posture reading, with a red control for each', () => {
// of the `view` write door (the save stores the parsed body, so a strip
// there lost a key silently). The two sites left are `ViewColumnStateSchema`
// (above) and the form field's `base` shape, both unchanged by #26711.
expect(countStripSites(at('ui/view.zod.ts'))).toBe(2);
//
// 2 → 1 at #36403: `columnState` retired from both wire doors (a
// `retiredKey()` tombstone now), and `ViewColumnStateSchema` went with it.
// The one site left is the form field's `base` shape.
expect(countStripSites(at('ui/view.zod.ts'))).toBe(1);
});

it('lets a chained posture override the idiom in either direction (#5072)', () => {
Expand Down
Loading
Loading