Repository navigation
fix(plugin-grid): inline cells read the record-grained update verdict the row kebab reads - #27384
Merged
Merged
Conversation
… the row kebab reads A row the server's sharing, ownership or RLS refuses lost Edit from its kebab but still opened a cell editor. DataTableSchema gains the runtime slot isRowEditable (refused by name on the zod mirror); data-table reads it before opening an editor on any trigger, and ObjectGrid supplies it from the same useRecordCrudVerdicts accessor the kebab reads. Unknown verdicts fail open. Claude-Session: https://claude.ai/code/session_01JQwxba6qJDidRrN2u71o5N Co-authored-by: Claude <noreply@anthropic.com>
…le-grid suites An inline-editable grid now asks the record-grained update verdict even when its kebab offers no Edit, so these suites need the explain double instead of reaching the network. Claude-Session: https://claude.ai/code/session_01JQwxba6qJDidRrN2u71o5N Co-authored-by: Claude <noreply@anthropic.com>
…d-grid row colour suite The suite renders an inline-editable ObjectGrid, which now asks the record-grained update verdict for its rows. Test-only; per claim amendment 6487558539. Claude-Session: https://claude.ai/code/session_01JQwxba6qJDidRrN2u71o5N Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#2 · os-warren · session_01JQwxbXpF772qWJjojJvRXw 席位核对ACCEPT · 席位意见:可编辑表格里,服务端按记录拒绝
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Warren · project thread
Fixes #27365
Clause-②: no
Metadata-protocol: none
维护者速读
ui/packages/plugin-grid/src/ObjectGrid.tsx(isRowEditable与update: canEdit || inlineEditable)、ui/packages/components/src/renderers/complex/data-table.tsx(rowMayEdit)、ui/packages/types/src/data-display.ts(新运行时槽位)。pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/inlineEditRecordVerdict-27365.test.tsx,预期 8 个用例全绿。What changes
An inline-editable grid gated its cells on the object-level affordance only (
inlineEditable), while the row kebab on the same rows also read the server's record-grainedupdateverdict (useRecordCrudVerdicts). A row refused by sharing, ownership or RLS lost Edit from its kebab but still opened a cell editor, and the save was refused whole. Now the cells read the same verdict.@object-ui/types:DataTableSchemadeclares a new runtime slot,isRowEditable?: (row: any) => boolean. The zod mirror refuses it by name (handlerKeyRefusal,runtime-slot), likerenderCellEditorandrowGroups. The ledgers move with it: theKnownDriftentry fordata-display.zod.ts#DataTableSchemagains the key (51 entries, 88 keys), and the read lists in thebody/childrentombstones name it.@object-ui/components:data-tablereadsisRowEditablethrough onerowMayEdit(row)check instartEdit(the door click, double-click and Enter all pass through), in the Enter key path, and in the per-cellisEditable. A refused row reads like a row of a read-only table: no editor, no edit cursor, and a click reaches the row's own click handler. With the slot absent, every row behaves as before.@object-ui/plugin-grid:ObjectGridsuppliesisRowEditableasresolveRowRecordCrudAffordance(inlineEditable, recordVerdict(rowRecordId(row), 'update')), the exact accessor the kebab reads. It asks the batched probe whenever the grid is inline-editable (update: canEdit || inlineEditable), so an editable grid whose kebab offers no Edit is narrowed too. That is still one probe, read by both affordances, with no second evaluator (ruling 6457467702 B).ObjectGrid(type: 'object-grid',editable: inlineEdit && inlineEditOffered), so it has no separate door and needs no plugin-list change.ListView.gridRowColorSelect-12393) answer it from an explain double instead of reaching the network. This is test-only, per claim amendment 6487558539. The assertions are unchanged.Why
The card: one grid gave two answers for one row. Fail-open is preserved exactly as the
useRecordCrudVerdictsdocblock requires: an unknown verdict keeps the object-level behaviour.Tests
plugin-grid/src/__tests__/inlineEditRecordVerdict-27365.test.tsx(8): a refused row opens no editor on click or Enter and shows no edit cursor. CONTROLs: an allowed row stays editable; a non-OK response, a network failure, a response with norecords[], and the pre-answer window all keep the row editable. The kebab and the cells agree on both rows from ONEupdateprobe. An editable grid with no kebab Edit still asks and still narrows.components/src/__tests__/data-table-row-editable-27365.test.tsx(7): the seam on its own covers click, double-click and Enter, a click that reachesonRowClick, an allowed-row control, the no-predicate control, and narrows-only.types/src/__tests__/data-table-declared-keys-6882.test.ts: the declared exact shape, a widened-return control (@ts-expect-error), and the zod mirror refusing an authoredisRowEditableby name.Acceptance notes
(_row: any) => trueviascripts/ablation-replace.mjs: 4 of 8 tests in the new grid suite red (the repro, agreement, no-kebab and pre-answer legs). Restored blob equals HEAD andgit diff HEADis empty.rowMayEditreplaced by() => true: 3 of 7 tests in the seam suite red (click, double-click, Enter). Restored blob equals HEAD.ui/apps/sitewas retired on main. After merging main, an ignored leftover directory (node_modules) in the worktree reddenedquick-reference-commands-4149locally. That was a local-state artifact only: the test is green once the leftover is removed, and nothing in the tree changed.Verification
All readings were taken on head
3b46f5a1(origin/mainc4c515admerged in), with the@object-ui/console^...closure built under the lock.Tests
pnpm --dir ui exec vitest runover the two new suites,packages/types/, the ten double-carrying suites,inlineEditPermissionGateandrowRecordCrudVerdict: Test Files 398 passed (398), Tests 10521 passed (10521).e77abe74plus the doubles:packages/plugin-grid/,packages/types/and the data-table suites went 934/935 files green with one skipped; the 9 red files were the network-escape suites that now carry the double (46/46). Across 59 ui consumer suites that render an editable grid, 58 were green and the app-shell one was fixed (2/2).pnpm --dir ui exec vitest run scripts/: 168 passed, 2 skipped, 1 red on a stale ignoredui/apps/siteleftover. That test is green (10/10) once the leftover is removed.pnpm --filter @object-ui/types|components|plugin-grid run type-check: exit 0, all three.Gates
node scripts/pm/dispatch-gates.mjs --commands: 35 families, all run on3b46f5a1, every exit code 0, includingnode scripts/check-sdui-manifest.mjs.dispatch-gates --ran: 35 derived, 35 run, 0 NOT-MEASURED, 0 UNRUN.pnpm --dir ui run check:new-line-citations: 0 new citations.Lint UI,Type Check UI,Test UI).Human Minimum
packages/specholds no runtime logic.pnpm lintwas not run locally (CILint UIandLint & Repo Gatesown it).main, one pull request.packages/spectouched: n/a, not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
Generated by Claude Code