From ace08fd7f0d7dd4ce376682565cfaf4c2b6387e6 Mon Sep 17 00:00:00 2001 From: lovepixel-git Date: Sun, 9 Aug 2026 11:29:03 -0400 Subject: [PATCH] docs(data): describe the built-in value lock that actually exists #303 removed `isBuiltInValueLocked` and `lockedBuiltInCellKey`, but the docs still describe them. Both symbols now have zero references anywhere in the codebase. The paragraph is not just naming dead functions, it states the opposite of current behavior. It says built-in row values are read-only on the structural system tables. They are editable on existing records, exactly as the guard's own header says. What survives is a narrower create-time rule: `protectedBuiltInCreateCellKey` rejects a create that supplies built-in cells for a structural system table, so those rows are born through their own authoring surfaces rather than the generic row endpoint. `posts` is exempt, and the server enforces it in `server/handlers/cms/data/tables.ts`. PageTreeCell and its test carried the same dead reference in comments, justifying the always-read-only button behavior by a predicate that no longer exists. The behavior is right and unchanged; the reasoning is now stated in terms of what a `pageTree` cell is (authored in the visual editor, never typed into a cell) rather than a deleted lock. Docs only, plus two comments. No behavior change. --- docs/features/data-workspace.md | 2 +- .../components/DataGrid/cells/PageTreeCell.test.tsx | 8 ++++---- .../data/components/DataGrid/cells/PageTreeCell.tsx | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/features/data-workspace.md b/docs/features/data-workspace.md index 48383b34f..899d21769 100644 --- a/docs/features/data-workspace.md +++ b/docs/features/data-workspace.md @@ -118,7 +118,7 @@ isLabelLocked(field, table) // true for built-in postType fields and sys deleteTooltip(field, table) // disabled-button tooltip text, or undefined ``` -Built-in field **values** (row cells) are additionally read-only on the *structural* system tables (pages/components/layouts) via `isBuiltInValueLocked` (`@core/data/systemTableGuard`); `posts` built-in values stay editable. The same predicate backs the server's row-write rejection (`lockedBuiltInCellKey`). +Built-in field **values** (row cells) stay editable on existing records everywhere, including the *structural* system tables (pages/components/layouts). The one remaining value lock is at **create** time: `protectedBuiltInCreateCellKey` (`@core/data/systemTableGuard`) rejects a create that supplies built-in cells for a structural system table, so those rows are born through their own authoring surfaces rather than the generic row endpoint. `posts` is exempt (`kind === 'postType'`), and the server enforces this in `server/handlers/cms/data/tables.ts`. `FIELD_TYPE_LABELS` maps every `DataFieldType` to a human-readable string and is shared by `FieldRow` and `FieldSchemaComposer`. diff --git a/src/admin/pages/data/components/DataGrid/cells/PageTreeCell.test.tsx b/src/admin/pages/data/components/DataGrid/cells/PageTreeCell.test.tsx index 6ea4d5e54..367b79913 100644 --- a/src/admin/pages/data/components/DataGrid/cells/PageTreeCell.test.tsx +++ b/src/admin/pages/data/components/DataGrid/cells/PageTreeCell.test.tsx @@ -35,10 +35,10 @@ function button(): HTMLButtonElement { } describe('PageTreeCell', () => { - // A `pageTree` cell on a system table is ALWAYS readOnly — every built-in - // field of `pages` / `components` / `layouts` is value-locked. The button - // navigates to the visual editor rather than editing the cell, so gating it - // on readOnly disabled it on exactly the rows it exists for. + // A `pageTree` cell is never editable inline — the tree is authored in the + // visual editor, not typed into a cell. The button navigates to that editor + // rather than editing the cell, so gating it on readOnly disabled it on + // exactly the rows it exists for. it('stays enabled on a read-only cell when a handler is wired', async () => { let opened = 0 renderCell({ readOnly: true, onOpenEditor: () => { opened += 1 } }) diff --git a/src/admin/pages/data/components/DataGrid/cells/PageTreeCell.tsx b/src/admin/pages/data/components/DataGrid/cells/PageTreeCell.tsx index 80a10b9c3..d8b64a5bb 100644 --- a/src/admin/pages/data/components/DataGrid/cells/PageTreeCell.tsx +++ b/src/admin/pages/data/components/DataGrid/cells/PageTreeCell.tsx @@ -10,11 +10,11 @@ * pattern that `RelationCell` uses for `onOpenPicker`. * * `readOnly` deliberately does NOT gate the button. It means "this value is - * not editable in the grid", which is always true for a `pageTree` cell on a - * system table (`isBuiltInValueLocked` holds for every built-in field of - * `pages` / `components` / `layouts`). The button edits nothing — it navigates - * to the visual editor, which enforces its own permissions. Gating it on - * `readOnly` disabled it on exactly the rows it exists for. + * not editable inline in the grid", which a `pageTree` cell never is — the + * tree is authored in the visual editor, not typed into a cell. The button + * edits nothing, it navigates to that editor, which enforces its own + * permissions. Gating it on `readOnly` disabled it on exactly the rows it + * exists for. */ import type { ReactElement } from 'react' import { Button } from '@ui/components/Button'