Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 3eb3ec1

Browse files
objectstack-fleet[bot]claudeos-zhuang
authored
refactor(app-shell,types,data-objectstack)!: retire the toolbar-to-view write family and DataSource.updateViewConfig (objectui#12504) (#12586)
Fixes #12504 Clause-②: no (narrowing). A published `@object-ui/types` method and the `@object-ui/data-objectstack` method behind it leave the contract, as ruled (ruling `6203730732`, letter A). Nothing widens: no type, prop, export or spec declaration is added. The maintainer's ruling on objectui#12504 retires the console's toolbar-to-view write family at once, with no window. Since objectui#12418 and objectui#12474 the list toolbar's sort, column layout, density and Hide Fields are each user's own list state (`ui.list.OBJECT`), so the write had no caller. The explicit save (`handleViewConfigSave` then `persistRuntimeMetadata`) is now the one write path to the shared view, and it is unchanged. ## What changed - **`@object-ui/app-shell`, `ObjectView.tsx`.** Removed `persistViewPatch` with its debounce timers, pending-patch map and write chain, `toolbarWriteInputs`, `buildPersistedViewBody`, the `CONSOLE_MADE_TAB` mark and its guard, the `savedViewsRef` mirror that only the writer read, the refusal toast, and the `setSystemCapabilities` push effect. That effect existed only to feed the adapter gate on `updateViewConfig`, and its own comment said so. The overlay READ path is unchanged (`loadViewOverrides`, `sanitizeViewOverride`, `narrowPersonalizationOverlay`), because rows earlier consoles wrote are still at rest. Docblocks that described the writer as live now describe it as retired. The same applies to the `viewIdentity.ts` docblock. - **`@object-ui/types`.** `DataSource.updateViewConfig?` is removed. The `listViewOverrides` docblock now names `createView` / `updateView` as the writes that share its key space. The `onDensityChange` docblock in `objectql.ts` no longer suggests the method. - **`@object-ui/data-objectstack`.** `ObjectStackAdapter.updateViewConfig` is removed, together with the gate that only it read (see the next section). Docblocks that described its caller are corrected: the overlay marker, `isPersonalizationOverlayRow`, `VIEW_OVERLAY_OWNED_KEYS`, `listViewOverrides`, `listViews`, the save-advisory seam and the factory. The marker, its readers and the owned-key list stay, for the rows at rest. - **`@object-ui/i18n`.** `console.objectView.viewConfigPermissionDenied` leaves all ten packs. Its only producer was the retired toast. - **Docblocks elsewhere, code unchanged.** These comments named the retired path as live and now name the user's own list state: `ObjectGrid.tsx` (three places), `ListView.tsx`, `useDensityMode.ts` (its `@example`), `data-table.tsx` and `ConcurrentUpdateDialog.tsx`. The `@example` ledger row in `scripts/check-doc-example-types.mjs` now names the identifiers the example references. This is a data string only; the row's codes are unchanged. - **Docs.** `content/docs/utilities/data-objectstack.mdx` drops the retired `systemCapabilities` factory option. Its member count, which the change would have made false, is replaced by a pointer to the `Exclude` expression that lists the members. - **Published skill (governed).** `skills/objectui/guides/data-integration.md` listed `updateViewConfig?(...)` among the `DataSource` view members and told agents to write a view through it. It now names it beside `saveView` as a spelling that does not exist. This is its own commit (`6b510d14b0`), so the seat can split it into a separate pull request. Readings: whole file 514 lines before, 514 after. Whole package (the sum of every `SKILL.md`, one file) 142 before, 142 after. The line count does not grow. - **Changeset.** `.changeset/12504-retire-view-write-family.md`: `minor` for `@object-ui/types` and `@object-ui/data-objectstack`, with a BREAKING paragraph naming `DataSource.updateViewConfig` and `ObjectStackAdapter.updateViewConfig`. `patch` for app-shell, i18n, plugin-grid, plugin-list, react, components, plugin-detail and console. ## Beyond the ruling's letter: the gate's public names (a judgement, please review) The ruling names `DataSource.updateViewConfig` and `ObjectStackAdapter.updateViewConfig`. The method opened with a capability gate, and that gate was published under five names that nothing else reads: `ObjectStackAdapter.setSystemCapabilities`, the `systemCapabilities` option of the constructor and of `createObjectStackAdapter`, `VIEW_CONFIG_CAPABILITY`, `ViewConfigPermissionDeniedError` and `isViewConfigPermissionDeniedError`. Measured: the only thrower of the error was `updateViewConfig`, and the only reader of the capabilities was the private `maySetViewConfig`, which only `updateViewConfig` called. The only caller of `setSystemCapabilities` was the `ObjectView` effect retired above. In objectstack `origin/main` and hotcrm `origin/main` there are zero hits for any of the five names. Keeping them would leave a published setter and a constructor option that do nothing, and an error class nothing throws. That is the "declared but not honoured" shape the ruling's option C was refused for. So they retire with the method, and the changeset's BREAKING paragraph names each one. If the seat's contract review reads the letter narrowly, the names can come back as their own decision. They live in commit `b1708d8f6b` beside the method. ## Mechanism assumptions (PM's A1 to A4), measured on base `830eb1f2dd` - **A1 holds.** A grep of `updateViewConfig` in `packages/*/src` and `apps/*/src` found one call expression outside tests, `dataSource.updateViewConfig?.(...)`. It sat inside `persistViewPatch`, the retired family, with that function's guard read beside it. The other hits by kind: - declarations: the `DataSource` member and the adapter method; - docblocks: in `ObjectView.tsx`, `viewIdentity.ts`, `data.ts`, `objectql.ts`, `data-objectstack` `index.ts`, `ObjectGrid.tsx`, `useDensityMode.ts` and `data-table.tsx`; - tests: the family's pins and harnesses, plus two console probes that list the name in a stub's method array (no call). - **A2 holds, and it was wider than one member.** No types API-surface or exports census pinned `updateViewConfig`. The one presence pin was `adapterFactoryReturn.types.test.ts`, which asserted `setSystemCapabilities` (type and runtime) and now asserts the remaining eight members. The two console probes drop the name from their stub lists. One addition to A2: an object literal annotated as `DataSource` that carries the member is now refused as an unknown property. None exists in this tree, and the type-check is green. - **A3 holds.** The toast key had one producer, the `persistViewPatch` catch. `check:i18n-keys`, `check:i18n-drift` and `check:i18n-dead-keys` accept the removal. `objectView-config-keys-retired-4730.test.ts` records the key as retired, the way the census expects: 123 retired became 124, 104 surviving became 103, and the total of 227 is unchanged. `de-quote-pairing-3876.test.ts` drops one matched pair (87 to 86). - **A4.** 37 test files are touched: - (a) 3 deleted, because they pinned only the family: `ObjectView.viewConfigGate.test.ts`, `ObjectView.densityInsideConfig-11625.test.ts` and `viewConfigPermissionGate.test.ts`. - (b) 33 edited where they mention the family. Write detectors were re-pointed to the surviving doors (`meta.saveItem`, `updateView` / `createView` spies). Rows that were written through the method are now planted at rest in the shape the retired write stored. Firing controls now use `createView`. Comments were corrected. - (c) 1 re-pointed: the objectui#12474 census pin in `ObjectView.overlayPatchOnly.test.ts`, whose `buildPersistedViewBody` write cases retired with the function. **Fork condition: not met.** There is no named caller of `updateViewConfig` outside the retired family. objectstack `origin/main` has 0 call expressions. Its hits are docblocks and test comments in `packages/spec` and `packages/metadata-protocol`, a migration entry string, and one QA checklist step (see Acceptance notes). hotcrm `origin/main` has 0 hits. In objectui, `apps/*` has only the two stub lists and `examples/*` has 0. ## Pins - **Census, re-pointed to absence** (`ObjectView.overlayPatchOnly.test.ts`, describe "objectui#12504 census — the toolbar-to-view write family is retired"). It reads code with comments stripped: - `ObjectView.tsx` defines and reaches none of `persistViewPatch`, `buildPersistedViewBody`, `toolbarWriteInputs`, `CONSOLE_MADE_TAB`, `updateViewConfig`, `setSystemCapabilities`, `isViewConfigPermissionDeniedError` or the toast key; - `DataSource` declares no `updateViewConfig`, pinned off `data.ts` and as a type that `type-check` reads; - `ObjectStackAdapter.prototype` has no `updateViewConfig` and no `setSystemCapabilities`, and the package exports none of the three gate names. The same fact is also pinned as a type. - **CONTROL**: the explicit save still writes through `persistRuntimeMetadata('view', vid, buildViewConfigSaveBody(...))`. This is the same census describe; `ObjectView.userListState-12418.test.tsx` "the view editor's save still writes /meta/view" is unchanged and green. - **CONTROL**: a toolbar sort and a density / Hide Fields change land on the user's `ui.list.OBJECT` row and write no view. This is the unchanged `ObjectView.userListState-12418.test.tsx` and `consoleListStateWall-12418.test.tsx` suites; the wall suite's own CONTROL now writes through the real adapter's `createView`. ## Ablation (through objectstack `scripts/ablation-replace.mjs`, each leg restored and proven) - **Leg A**: the member is re-added to `DataSource` in `data.ts`. Anchor 1 to 0, blob `3b3996403088` to `1acc16bfed4b`. Predicted: only the DataSource census case goes red. Observed: `Tests 1 failed | 14 passed (15)`, the red being "`DataSource` declares no `updateViewConfig` (@object-ui/types)". Restore: blob equals HEAD `3b3996403088`, and `git diff HEAD` is empty. - **Leg B**: an `updateViewConfig` method is re-added to `ObjectStackAdapter`. Anchor 1 to 0, blob `1a202c973005` to `b87a7a2f451f`. Predicted: the adapter census case and the `viewOverlayMarker` "no overlay writer left" case go red. Observed: `Tests 2 failed | 13 passed (15)`, exactly those two. Restore: blob equals HEAD and the diff is empty. - **Leg C** (the type-level half, read through the rebuilt `.d.ts`): the Leg A mutation is held, and `@object-ui/types` is rebuilt (exit 0; marker in `dist/data.d.ts`: 1). Then app-shell `tsc -p tsconfig.test.json` exits 2 with exactly one error, TS2322 at the census `Absent` assertion. Restore: blob equals HEAD and the diff is empty. After a rebuild, the marker count in dist is 0. - Baseline on the unmutated tree: `Tests 15 passed (15)`. Controls stayed green in every leg. ## Local gates (at `3643cc1e6e`, the merge of `origin/main` `3e09c1e8d5`) - Dependency closure `pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' build` under the verify lock: VERDICT command-exit 0. The packages the gates read (app-shell, plugin-ai, gantt, map, markdown, timeline, tree, cli) were built after it, and plugin-list and app-shell were rebuilt after the merge. - `type-check` of types, data-objectstack, app-shell, plugin-grid, plugin-list, react, i18n, components, plugin-detail and console: all `Done`, VERDICT command-exit 0. The app-shell, data-objectstack, react, i18n, components, plugin-grid, plugin-list and plugin-detail scripts compile their tests as well. - Vitest union at `3643cc1e6e` under the lock: every `ObjectView*` and `InterfaceListPage*` app-shell suite, `view-filter-fold.ratchet`, `writeRefusalCensus-11583`, `consoleListStateWall-12418`, `src/context/__tests__/`, four app-shell `__tests__` sweeps, the whole of `packages/data-objectstack/` and `packages/i18n/`, every touched plugin, components, types and console test, the readers of the skill guide and the docs page, the `AFFORDANCE_GRANTS` census (`affordanceGrantMap-12082`), and the edited gate's own suites. Result: `Test Files 282 passed (282)`, `Tests 3794 passed | 13 skipped (3807)`, VERDICT command-exit 0. - These gates exit 0: `check:i18n-keys`, `check:i18n-drift`, `check:i18n-dead-keys` (report), `check:i18n-designer-parity`, `check:readme-exports`, `check:spec-symbols`, `check:unreferenced-sources`, `check:metadata-write-doors`, `check:control-bytes`, `check:new-line-citations` (0 new), `check:test-path-roots`, the three `check:vi-mock-*`, `check:skills-paths`, `check:skill-examples`, `check:doc-snippets`, `check:doc-examples`, `check:doc-types`, `check:doc-json`, `check:doc-fences`, `scripts/check-doc-links.mjs`, `check:changeset-claims`, `check:pending-changeset-literals`, `check-changeset-presence` ("57 source file(s) of 10 released package(s) changed, and this change declares 1 changeset(s)"), `check-changeset-no-major` and `check-changeset-fixed`. - ESLint on the 55 changed TS files: 0 errors. `ObjectView.tsx` now carries 182 warnings, against the 197 the objectui#12474 dev reported at their head. - `check-governed-queue-guard --test` on the diff: GOVERNED (one path, `skills/**`). ## What the landing seat's browser reading should show On a console over a served object list, as a session WITHOUT `manage_metadata`: 1. Change the density, hide a field, sort by a header and drag a column width. The network panel shows no `PUT /api/v1/meta/view/...` and no error toast. Each change lands as a `sys_user_preference` write of the user's `ui.list.OBJECT` row, and survives a reload. 2. As an admin, open "Edit view config" and Save. A `PUT` to `/meta/view` is still sent, and the edit is visible to another user. 3. A view that already carries a personalization overlay row (`_isOverride: true`, written by an earlier console) still shows that row's density and columns. It does not appear as a saved view in the switcher. 4. Nothing anywhere shows the old "View settings apply to everyone who uses this view..." refusal toast. ## Acceptance notes - **Not class a/b/c, noted, not filed.** objectstack still describes objectui's `persistViewPatch` / `updateViewConfig` as the live overlay writer in prose. The places are two docblocks in `packages/spec/src/ui/view.zod.ts`, the string of the spec migration entry `18.view-overlay-judged-by-viewkind-arm`, comments in `view-metadata-schema.test.ts`, `view-overlay-viewkind-arm.test.ts` and `metadata-protocol` `protocol.graft-folded-form-sections.test.ts`, and the platform-checklist step in `docs/qa/platform-checklist/areas/records-forms.json` that says "or the persisted view override via dataSource.updateViewConfig". None of these has a runtime effect, and they are outside this claim (objectstack files). 承接者:无. - **Not edited: ADR-0034** names `persistViewPatch`. It is a decision record and a governed path. 承接者:无. - **Pending changesets in the same release.** `11625-density-inside-config`, `11642-toolbar-writes-compose` and `11643-fallback-tab-session-only` describe the toolbar's view write, which objectui#12418, objectui#12474 and this change moved away and then retired. All are still pending (`pre.json` has consumed none), so they publish beside this one. They are other cards' declarations and are not edited here. 承接者:无. - **The overlay read path now serves only rows at rest.** Nothing writes a personalization overlay any more. Whether to migrate or retire those rows (the marker, `narrowPersonalizationOverlay`, `VIEW_OVERLAY_OWNED_KEYS`) is a separate question that no deployment measurement here informs. 承接者:无. - `ListView.tsx`'s comment on the forwarded `onColumnStateChange` still says a parent persists "alongside the view definition". It does not name the retired method, and objectui#12474's report already noted it. 承接者:无. - **Repaired in passing, in files this change touches:** the cross-file line addresses in `gridNonAuthorKeys.test.tsx`'s producer strings, in `ObjectGrid.tsx`'s columnState docblock and in the `InterfaceListPage` overlay test's docblock. All are now cited by symbol. ## 维护者速读(草稿) ### 改了什么 控制台列表工具栏里"把改动写进共享视图"的整条代码路径删除了。对外发布的数据源接口去掉了 `updateViewConfig` 方法。只为这个方法服务的权限门接口(5 个公开名字)和一条报错提示文案也一起删除了。发布给客户 AI 的技能文档同步去掉了这个方法。 ### 为什么改 自 objectui#12418 / objectui#12474 起,排序、列宽、行高、隐藏字段都已是每个用户自己的列表状态,这条写入路径已无人调用。您在 objectui#12504 上裁定 A:整组立即退役,不留过渡窗口。共享视图从此只有一条写入路径:视图编辑器的显式保存。 ### 风险与代价(含回滚) - 外部若有代码调用 `updateViewConfig`,或引用被删的权限门名字,升级后会编译失败。changeset 已写明 BREAKING,版本号按约定仍为 minor。仓内、objectstack、hotcrm 实测零调用方。 - 权限门的 5 个名字超出了裁决原文的字面范围。它们只为这个方法服务,留下会变成"声明了却不生效"的空接口,席位复核时请确认。 - 旧版控制台已写下的个性化覆盖行仍会被读取,用户看到的效果不变。 - 回滚:revert 本 PR 即可。技能文档改动是单独一个 commit,可单独撤回或拆出。 ### 席位意见 ### 你要做的 本 PR 改到了发布给客户的技能文档(`skills/**`,受管面),因此需要您在 PR 上留一条批准,才能进入合并队列。若您希望代码先落地、文档另走,告诉席位拆分即可。 --- _Generated by [Claude Code](https://claude.ai/code/session_01JZnppgHRp4sREcouhkQYDB)_ --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: os-zhuang <jack@objectstack.ai>
1 parent 1b3b5b1 commit 3eb3ec1

61 files changed

Lines changed: 595 additions & 2090 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@object-ui/types': minor
3+
'@object-ui/data-objectstack': minor
4+
'@object-ui/app-shell': patch
5+
'@object-ui/i18n': patch
6+
'@object-ui/plugin-grid': patch
7+
'@object-ui/plugin-list': patch
8+
'@object-ui/react': patch
9+
'@object-ui/components': patch
10+
'@object-ui/plugin-detail': patch
11+
'@object-ui/console': patch
12+
---
13+
14+
The console's list toolbar no longer has a write into the shared view, and the data-source method that write used is retired (objectui#12504).
15+
16+
**BREAKING:** `DataSource.updateViewConfig` is removed from `@object-ui/types`, and `ObjectStackAdapter.updateViewConfig` is removed from `@object-ui/data-objectstack`. The capability gate that only that method read goes with it: `ObjectStackAdapter.setSystemCapabilities`, the `systemCapabilities` option of the adapter constructor and of `createObjectStackAdapter`, `VIEW_CONFIG_CAPABILITY`, `ViewConfigPermissionDeniedError` and `isViewConfigPermissionDeniedError`. A class that implements `DataSource` and keeps an `updateViewConfig` method still compiles, but nothing calls the method any more; an object literal annotated as `DataSource` that carries it is refused as an unknown property. Code that calls `updateViewConfig` through a `DataSource` or an `ObjectStackAdapter`, or imports one of the gate names, no longer compiles. To change a view for everyone, save the view: `createView` / `updateView` on the data source, or the console's view editor, which writes through the runtime metadata seam.
17+
18+
Since objectui#12418 and objectui#12474, the toolbar's sort, column layout, density and Hide Fields are each user's own list state, so the toolbar write had no caller. The view editor's explicit save is now the one write path to the shared view, and it is unchanged.
19+
20+
Personalization rows that earlier consoles wrote into `/meta/view` stay readable: the overlay marker, `narrowPersonalizationOverlay` and `listViews()` exclusion still apply to them. Nothing new writes such a row.
21+
22+
`@object-ui/i18n` drops `console.objectView.viewConfigPermissionDenied` from all ten packs. It was the toast the retired write raised when the gate refused it. The other packages change only in comments and tests that named the retired path.

‎apps/console/src/__tests__/public-block-binding-reach.test.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ const DATA_SOURCE_METHODS = [
118118
'getView',
119119
'listViews',
120120
'listViewOverrides',
121-
'updateViewConfig',
122121
'onMutation',
123122
] as const;
124123

‎apps/console/src/__tests__/record-block-record-reach.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const PROBE_OBJECT_SCHEMA = {
177177
const DATA_SOURCE_METHODS = [
178178
'find', 'findOne', 'create', 'update', 'delete', 'aggregate', 'count',
179179
'getObjectSchema', 'getObjects', 'getView', 'listViews', 'listViewOverrides',
180-
'updateViewConfig', 'onMutation',
180+
'onMutation',
181181
] as const;
182182

183183
/**

‎content/docs/utilities/data-objectstack.mdx‎

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,6 @@ function createObjectStackAdapter<T = unknown>(config: {
136136
autoReconnect?: boolean; // default true
137137
maxReconnectAttempts?: number; // default 3
138138
reconnectDelay?: number; // default 1000 ms
139-
140-
/**
141-
* [ADR-0066] The session's system capabilities, when the host already has them
142-
* at construction time. Most hosts do NOT — `/me/permissions` resolves after
143-
* the adapter exists — and push them in later via `setSystemCapabilities`.
144-
* Omit for "unreported".
145-
*/
146-
systemCapabilities?: string[];
147139
}): ObjectStackAdapter<T>;
148140
```
149141

@@ -250,11 +242,11 @@ either form):
250242
- `onBatchProgress(listener)` - Subscribe to bulk progress (returns unsubscribe)
251243

252244
Those six bullets cover nine members, and they are the documented subset.
253-
`ObjectStackAdapter` declares **20** members beyond `DataSource` in all
254-
(`Exclude<keyof ObjectStackAdapter<unknown>, keyof DataSource<unknown>>`); the
255-
other eleven are lower-level seams — client discovery, cache-key invalidation,
256-
dataset and dashboard access, advisory subscriptions and capability configuration
257-
among them — which this page does not document and which carry no compatibility
245+
`ObjectStackAdapter` declares more members beyond `DataSource` than these —
246+
`Exclude<keyof ObjectStackAdapter<unknown>, keyof DataSource<unknown>>` lists
247+
them all; the rest are lower-level seams — client discovery, cache-key
248+
invalidation, dataset and dashboard access and advisory subscriptions among
249+
them — which this page does not document and which carry no compatibility
258250
promise here.
259251

260252
### Per-element data binding

‎packages/app-shell/src/console/__tests__/consoleListStateWall-12418.test.tsx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
* NO metadata write on the wire, raise no error, and land as ONE
3030
* preference write each, of the same row.
3131
* 3. CONTROL — the wall is live: a metadata write made in this same tree
32-
* (the real adapter's own view write, the call the density toggle used
33-
* to reach) is answered 403. Since objectui#12474 no list toolbar control
34-
* makes one, so the control is the adapter's call itself.
32+
* (the real adapter's own view write, `createView`) is answered 403.
33+
* Since objectui#12474 no list toolbar control makes one, so the control
34+
* is the adapter's call itself. (It was `updateViewConfig`, the call the
35+
* density toggle used to reach, until objectui#12504 retired it.)
3536
*/
3637

3738
import '@testing-library/jest-dom/vitest';
@@ -263,12 +264,12 @@ describe('a user\'s list state under a walled posture (objectui#12418)', () => {
263264
boot();
264265
await waitFor(() => expect(typeof listProps?.schema?.onDensityChange).toBe('function'), { timeout: 5000 });
265266
await wait(100);
266-
expect(typeof pageAdapter?.updateViewConfig).toBe('function');
267+
expect(typeof pageAdapter?.createView).toBe('function');
267268

268269
let refused: unknown = null;
269270
await act(async () => {
270271
try {
271-
await pageAdapter.updateViewConfig(OBJECT_NAME, ALL_ID, { rowHeight: 'compact' }, { isSavedView: false });
272+
await pageAdapter.createView(OBJECT_NAME, { name: `${OBJECT_NAME}.probe`, label: 'Probe', type: 'grid' });
272273
} catch (err) {
273274
refused = err;
274275
}

‎packages/app-shell/src/utils/viewIdentity.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ export function defaultListViewId(objectName: string, list: unknown): string | u
7171
* stored override therefore REDEFINED the tab's identity.
7272
*
7373
* The third spelling is the defect. A stored view body can legitimately carry
74-
* an `id` key — `persistViewPatch` writes the whole tab object (`id` included)
75-
* back through `updateViewConfig`, and a duplicated view copies its source
76-
* artifact's `id` verbatim — so the spread handed the tab an identity the
74+
* an `id` key — the console's toolbar write (`persistViewPatch` →
75+
* `updateViewConfig`, retired in objectui#12504) wrote the whole tab object
76+
* (`id` included), and those rows are still at rest; a duplicated view copies
77+
* its source artifact's `id` verbatim — so the spread handed the tab an identity the
7778
* overlay read had never heard of. `isSavedView` then answered false for a view
7879
* that *is* saved, which both hid the set-default / rename / delete menu
7980
* entries (`readonly: !saved`) and short-circuited the handlers behind them.

‎packages/app-shell/src/views/InterfaceListPage.hollowOverlayHydration.test.tsx‎

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,27 @@
99
* > DOCUMENT … and `InterfaceListPage` hydrates a hollow view out of that
1010
* > document.
1111
*
12-
* `InterfaceListPage`'s hollow-view hydration effect (lines ~270-315) fetches
12+
* `InterfaceListPage`'s hollow-view hydration effect fetches
1313
* a view's per-view overlay row through `listViewOverrides`/`getView` — the
1414
* SAME undocked-narrowing read path the docblock is talking about — whenever
1515
* the ADR-0017 expansion serves a source view with no `columns`. Before
1616
* objectui#5233, `persistViewPatch` wrote a system view's overlay as
1717
* `{ ...baseViewDef, ...patch }`, so that row carried a frozen COPY of the
1818
* source view's columns at write time; the merge `{ ...resolvedView,
1919
* ...hydratedView }` picked those up and the page rendered STALE columns.
20-
* After #5233 the same write site stores the patch alone — no `columns` key
20+
* After #5233 the same write site stored the patch alone — no `columns` key
2121
* — so the merge contributes nothing towards `hasColumns`, and the page's own
2222
* defaulting (`defaultColumnsFromObject`) fires instead.
2323
*
24-
* This is the card's step 1: CONSTRUCT the case (a hollow ADR-0017 expansion
25-
* item for a system view that also carries a personalization overlay row),
26-
* driven through the REAL `ObjectStackAdapter` write (`updateViewConfig` /
27-
* `buildPersistedViewBody`, the same seam `ObjectView.overlayPatchOnly.test.ts`
28-
* uses) and the REAL `InterfaceListPage` render — not reasoned about, and not
29-
* a hand-written override fixture, because the coupling lives in what the
30-
* hydration effect does with a row it actually fetched.
24+
* That write site is retired (objectui#12504: `persistViewPatch` and the
25+
* adapter's `updateViewConfig`), so both row shapes are now rows an install
26+
* already carries, and the hydration effect still reads them. This is the
27+
* card's step 1: CONSTRUCT the case (a hollow ADR-0017 expansion item for a
28+
* system view that also carries a personalization overlay row), with the row
29+
* put in the store in the shape the retired write stored it, read through the
30+
* REAL `ObjectStackAdapter` and the REAL `InterfaceListPage` render — not
31+
* reasoned about, because the coupling lives in what the hydration effect does
32+
* with a row it actually fetched.
3133
*
3234
* Two cases, so the second is a control that PROVES the first discriminates
3335
* something real: with the CURRENT (post-#5233) thin overlay shape the page
@@ -87,7 +89,6 @@ vi.mock('@object-ui/react', async (importOriginal) => {
8789
});
8890

8991
import { ObjectStackAdapter } from '@object-ui/data-objectstack';
90-
import { buildPersistedViewBody } from './ObjectView';
9192
import { InterfaceListPage } from './InterfaceListPage';
9293

9394
const OBJECT_NAME = 'crm_lead';
@@ -119,6 +120,15 @@ function makeMetaStore() {
119120
return { meta, rows };
120121
}
121122

123+
/**
124+
* Put a personalization overlay in the store the way the retired toolbar write
125+
* (`updateViewConfig`, objectui#12504) stored one: the body, with `object`,
126+
* `name` and the `_isOverride` marker stamped on it.
127+
*/
128+
function plantOverlay(rows: Map<string, any>, body: Record<string, unknown>) {
129+
rows.set(`view::${VIEW_ID}`, { ...body, object: OBJECT_NAME, name: VIEW_ID, _isOverride: true });
130+
}
131+
122132
function makeAdapter(meta: any) {
123133
const ds: any = new ObjectStackAdapter({
124134
baseUrl: 'http://test.local',
@@ -162,20 +172,15 @@ const page = {
162172

163173
describe('objectui#5773 — InterfaceListPage hollow view + personalization overlay hydration', () => {
164174
it('REACHABLE: a hollow system view + a thin post-#5233 overlay row hydrates to renderer DEFAULTS, not a hollow grid', async () => {
165-
const { meta } = makeMetaStore();
175+
const { meta, rows } = makeMetaStore();
166176
const ds = makeAdapter(meta);
167177
testDataSource = ds;
168178
testObjects = [makeObjectDef()];
169179

170-
// The CURRENT `persistViewPatch` write for a toolbar toggle on this
171-
// system view (a density change) — patch alone, no `columns`, exactly
172-
// objectui#5233's write half. Written through the REAL adapter, not
173-
// dropped into the store as a fixture.
174-
await ds.updateViewConfig(
175-
OBJECT_NAME,
176-
VIEW_ID,
177-
buildPersistedViewBody({ viewKind: 'list' }, { rowHeight: 'compact' }, { isSavedView: false }),
178-
);
180+
// The LAST shape the retired toolbar write stored for a toggle on this
181+
// system view (a density change): the patch alone plus the tab's
182+
// `viewKind`, no `columns` — objectui#5233's write half.
183+
plantOverlay(rows, { rowHeight: 'compact', viewKind: 'list' });
179184

180185
// Confirms the row really is thin at rest — the premise this case
181186
// depends on, measured rather than assumed.
@@ -198,18 +203,17 @@ describe('objectui#5773 — InterfaceListPage hollow view + personalization over
198203
});
199204

200205
it('CONTROL: the same hollow view with a PRE-#5233 fat overlay row still renders the frozen stale columns (proves the pin discriminates old vs. new row shapes)', async () => {
201-
const { meta } = makeMetaStore();
206+
const { meta, rows } = makeMetaStore();
202207
const ds = makeAdapter(meta);
203208
testDataSource = ds;
204209
testObjects = [makeObjectDef()];
205210

206-
// What `persistViewPatch` USED TO send — the whole active tab (frozen at
207-
// write time) plus the one changed key. An install that has not touched
208-
// this view since before objectui#5233 is still carrying a row shaped
209-
// exactly like this one (`ObjectView.overlayPatchOnly.test.ts`'s own
210-
// "PRE-FIX" framing) — this is that row, written through the REAL write
211-
// path (`updateViewConfig`), not hand-assembled as a display fixture.
212-
await ds.updateViewConfig(OBJECT_NAME, VIEW_ID, {
211+
// What `persistViewPatch` USED TO send before objectui#5233 — the whole
212+
// active tab (frozen at write time) plus the one changed key. An install
213+
// that has not touched this view since then is still carrying a row
214+
// shaped exactly like this one (`ObjectView.overlayPatchOnly.test.ts`'s
215+
// own "PRE-FIX" framing).
216+
plantOverlay(rows, {
213217
viewKind: 'list',
214218
type: 'grid',
215219
columns: ['status'],

‎packages/app-shell/src/views/ObjectView.defaultViewIdentity.test.tsx‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,15 @@ describe('default list view identity → _views translation key (objectui#3770)'
290290
/**
291291
* Stored-data surface, measured before the behaviour change and pinned here.
292292
*
293-
* `ObjectView.persistViewPatch` writes a view override by VIEW ID:
294-
* `dataSource.updateViewConfig(objectName, view.id, cfg)` →
295-
* `client.meta.saveItem('view', view.id, { …cfg, object, name: view.id })`, i.e.
296-
* one `sys_metadata` row of type `view` NAMED by the id. The id therefore doubles
297-
* as the persistence key, and `ViewItemNameSchema` is the spec's judgment on
298-
* which strings are legal view identities:
293+
* A view's stored row is keyed by VIEW ID: the explicit save writes
294+
* `persistRuntimeMetadata('view', vid, …)`, and the override rows the page
295+
* reads back (`loadViewOverrides`) are found by the same id — one
296+
* `sys_metadata` row of type `view` NAMED by the id. (The toolbar's
297+
* `persistViewPatch` → `updateViewConfig` wrote its overlays the same way,
298+
* `saveItem('view', view.id, { …cfg, object, name: view.id })`, until
299+
* objectui#12504 retired it; those rows are still at rest.) The id therefore
300+
* doubles as the persistence key, and `ViewItemNameSchema` is the spec's
301+
* judgment on which strings are legal view identities:
299302
*
300303
* /^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/
301304
*

0 commit comments

Comments
 (0)