Skip to content

fix(plugin-grid,react): one column spelling — retire the undeclared accessorKey/header round trip - #5345

Merged
os-support-ai merged 1 commit into
mainfrom
claude/issue-5068-grid-column-accessorkey-tolerance
Aug 19, 2026
Merged

fix(plugin-grid,react): one column spelling — retire the undeclared accessorKey/header round trip#5345
os-support-ai merged 1 commit into
mainfrom
claude/issue-5068-grid-column-accessorkey-tolerance

Conversation

@os-support-ai

Copy link
Copy Markdown
Collaborator

Fixes#5068
Fixes#5340

One column spelling. ObjectGridSchema.columns is declared string[] | ListColumn[], and ListColumnSchema in @objectstack/spec/ui is a strict object — field required, accessorKey / header refused by name with unrecognized_keys and a prescriptive message. Two places disagreed with that contract, and they were the two halves of one round trip:

  • ObjectGrid accepted the refused spelling through a branch that sniffed columns[0] for an accessorKey and synthesized a ListColumn from it (ObjectGrid.tsx:1451-1489);
  • bridgeListView produced that spelling, by down-translating columns that arrived already canonical — its own parameter is the spec's ListColumn.

Both retire here, in one PR. That is the disposition #5068 inherits from #3951 applied the way #3951 itself applied it: PR4909 migrated its consumer in packages/fieldsand its producer deriveMasterDetail in packages/plugin-form together. Landing the consumer alone is not a smaller version of this change — it is a silent regression, measured below.

accessorKey is not retired as a concept. It stays the data-table adapter's column key, which @object-ui/core deliberately holds outside the metadata identity fold (TABLE_ADAPTER_COLUMN_KEY) and which ObjectGrid still writes when it hands columns to the adapter (:1636, untouched). Metadata vocabulary in, adapter vocabulary out, one translation at one boundary.

Why both halves, in one PR

Measured on this branch, producer reverted and consumer retired — the state a one-package PR would have shipped:

packages/react/src/spec-bridge/bridges/list-view.ts reverted to origin/main
packages/plugin-grid/src/ObjectGrid.tsx this PR
× specBridgeColumnSpelling > renders every column of a bridged view
-> Unable to find an element with the text: Ada
✓ specBridgeExportFormats > offers the formats a legacy bare array declared ... (all 5 green)

The bridged grid loses every column and every cell, with no error and no console line — while specBridgeExportFormats.test.tsx, which renders bridge output throughObjectGrid, stays green: it asserts the export menu and never the columns. On the first dispatch of this card the same deletion left all 715 plugin-grid tests passing. Neither CI nor review would have caught it, which is why this PR adds the pin that would have.

Changes

packages/plugin-grid/src/ObjectGrid.tsx — the tolerance branch is deleted, and the columns[0] sniff goes with it. Column identity is a per-column property, and one filter now judges it (col?.field && typeof col.field === 'string'). Previously the first entry decided the fate of the whole array: a declared column standing behind an undeclared one was dropped with it, and the reverse order threw TypeError: Cannot read properties of undefined (reading 'toLowerCase') mid-render (observed — inferColumnType reads col.field.toLowerCase() on a synthesized column whose field came from a missing accessorKey). Removing the sniff is named here rather than left implicit: it is the same defect one level down, it is mechanical, and the filter it defers to is existing behaviour, not new judgement.

The diff in this file is mostly re-indentation from removing one nesting level — git diff -w is 65 lines against 403.

packages/react/src/spec-bridge/bridges/list-view.tsmapColumn emits { field, label? }; the spec's bare-string shorthand columns: ['name'] maps to { field: 'name' }.

It also stops inventing a label. header: col.label ?? col.field turned "the author declared no label" into "the author declared the machine name", and that synthesized value pre-empted ObjectGrid's own header chain — the column's label, then the object field's label, then the prettified machine name — whose middle step exists so a localized field label wins on a non-English app. A bridged view therefore rendered raw machine names where a directly authored object-grid rendered the field's real label. Pinned both ways: SpecBridge.test.ts asserts nothing is invented, specBridgeColumnSpelling.test.tsx asserts the rendered header is now the object field's label.

Speaking the declared spelling also routes bridged views through the renderer's full ListColumn path instead of its type-inference-only one: object-schema field enrichment, hidden filtering, primary-field auto-linking and per-column link / action now apply to a bridged ListView exactly as to an authored grid.

Testspackages/plugin-grid/src/__tests__/columnDeclaredSpellingOnly.test.tsx (consumer: declared renders, undeclared does not resolve, both mixed orders, the legibility pin, string[] unaffected) and packages/plugin-grid/src/__tests__/specBridgeColumnSpelling.test.tsx (the seam that had no pin). SpecBridge.test.ts's two pinned identity assertions move to the canonical spelling and gain toBeUndefined() on the retired keys, so a pin that would pass against both spellings is not what replaced them.

Two changesets, both minor: the acceptance set narrows in @object-ui/plugin-grid, and bridgeListView's exported output shape changes in @object-ui/react.

Legibility — what a mis-spelled column does now, and what this PR deliberately does NOT do

Pinned as behaviour, not left as folklore: an undeclared column does not throw, does not render an empty header cell, and produces no console line. It is dropped; a grid whose columns are all mis-spelled renders as the row-number column alone. The card asked whether that silence deserves a loud rejection or a dev-time warning. On the ground the ruling named — the shape circulating in docs history — the answer is no: the spec already rejects these keys by name with a migration-shaped message, and the docs page for object-grid mentions accessorKey only to forbid it (content/docs/plugins/plugin-grid.mdx:90, :107). The broader question (should the renderer say something when a non-empty columns resolves to nothing?) is #5068's Q2, deferred by the PM to its own card. No warning channel is implemented here.

Census — re-verified, including a corpus the first sweep did not name

The first dispatch measured a clean zero for authored accessorKey-shaped object-grid columns across examples/, content/docs/, apps, skills and e2e (924 files, three methods, one of which it discarded for failing its own control). Re-verified, and extended to package READMEs, which that sweep did not enumerate. Every hit outside the two files this PR touches is the table / data-table component, which legitimately owns the key:

packages/plugin-dashboard/README.md:473 "type": "table"
packages/types/README.md:94 type: 'data-table'
content/docs/guide/quick-start.md:85 type: 'data-table'
content/docs/index.md:29 "type": "data-table"
content/docs/components/complex/table.mdx the table component's own interface
content/docs/plugins/plugin-grid.mdx:90 prose FORBIDDING the spelling for object-grid

Structural sweep for producers, whole tracked tree: files mentioning both object-grid and accessorKey are the two this PR edits, their tests, and app-shell/src/views/metadata-admin/i18n.ts (translation keys for the designer's column inspector). RelatedList normalizes to accessorKey but renders type: 'data-table' — the adapter, not this path — so it is unaffected; its four accessorKey fixtures stay green.

Filed from that sweep, unassigned, out of this PR's surface: #5344 — the designer's ViewColumnInspector writes back whichever spelling it found, so editing a stored accessorKey column re-saves a spelling that no longer renders.

#5340

Resolved by this PR, hence the closing keyword above. #5340 is exactly bridgeListView's down-translation, and it is retired in full: mapColumn no longer emits accessorKey or header on any path, including the bare-string shorthand, and SpecBridge.test.ts now asserts their absence rather than merely asserting the canonical keys are present.

Verification

All runs from the repo root (a package-scoped run would use a different config than CI does), at 798482b3, under the shared verify lock. No build artifact sits between any edit and anything under test: the root vitest.config.mts aliases @object-ui/react to packages/react/src (:252) and @object-ui/plugin-grid to packages/plugin-grid/src (:258) — verified in the file, and confirmed empirically by the source-only edits flipping the runs below.

vitest run packages/plugin-grid packages/react -> 130 files, 1392 tests, all passed
pnpm --filter @object-ui/plugin-grid --filter @object-ui/react type-check -> Done, Done
pnpm --filter @object-ui/plugin-grid --filter @object-ui/react lint -> 0 errors
pnpm check:control-bytes -> OK (4730 tracked text files)
pnpm check:phantom-deps -> OK pnpm check:self-import -> OK
pnpm check:doc-types -> OK (143 mdx, 632 code blocks)
vitest run packages/core/src/utils/__tests__/column-identity.ratchet.test.ts -> 7 passed

The #3104 ratchet keeps ObjectGrid.tsx in its CONVERGED list, which requires columnIdentity( to still match in the file — it does, at the three call sites this PR does not touch. pnpm check:doc-snippets refuses to run without a full workspace build ([unbuilt-package] for plugin-view, plugin-markdown, plugin-timeline) and reports so loudly rather than answering wrongly; it is left to CI, where the build precedes it. This PR changes no exported type.

Reverse verification — three legs, predictions recorded before each run

legpredictedobserved
both halves reverted (new tests vs origin/main)9 red of 34: the 3 consumer pins, the 4 bridge-seam pins, 2 of the 3 updated react assertions plus the new oneexactly those 9. Includes the predicted TypeError for the undeclared-first mixed array, and expected [ '#', 'Name', 'Amount' ] to deeply equal [ '#' ] for the tolerance itself
consumer-only revert (tolerance restored, producer canonical)3 red — only the consumer pins; every bridge test green, because a canonical producer needs no toleranceexactly those 3
producer-only revert (tolerance retired, bridge down-translating)7 red — all 4 bridge-seam pins plus the 3 react assertions; specBridgeExportFormatsgreenexactly those 7, with specBridgeExportFormats green across all 5 of its tests

Predicted equalled observed on every leg, in both directions. The third leg is the one that would have shipped the regression.


Generated by Claude Code

…ccessorKey/header round trip (#5068)
`ObjectGridSchema.columns` is declared `string[] | ListColumn[]`, and
`ListColumnSchema` is a strict object that refuses `accessorKey` / `header` by
name. `ObjectGrid` accepted them anyway through a branch that sniffed
`columns[0]`, and `bridgeListView` produced them by down-translating columns
that arrived canonical — a round trip through a spelling the contract rejects.
Both halves land together, the shape objectui#3951 used (PR4909 migrated its
consumer in `packages/fields` and its producer in `packages/plugin-form` in one
PR): deleting the consumer half alone silently blanks every bridged grid, and
the whole plugin-grid suite stays green while it happens.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RV6yuVCxymHYE16PL9vQkE
@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)25.3 KB350 KB
Entry fileindex-DjybddMH.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)9.83KB3.70KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)8.92KB3.41KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)29.33KB7.05KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)40.21KB10.79KB
auth (createAuthenticatedFetch.js)6.34KB2.43KB
auth (index.js)2.71KB1.22KB
auth (invitation-status.js)1.22KB0.70KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)5.02KB0.88KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)505.53KB113.13KB
core (index.js)4.11KB1.62KB
create-plugin (index.js)10.08KB3.26KB
data-objectstack (index.js)159.80KB44.34KB
fields (index.js)237.07KB59.46KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.28KB1.75KB
i18n (index.js)3.42KB1.39KB
i18n (pickLocalized.js)3.69KB1.73KB
i18n (provider.js)23.13KB7.63KB
i18n (useDisplayLocale.js)2.85KB1.45KB
i18n (useObjectLabel.js)29.43KB7.15KB
i18n (useSafeTranslation.js)7.77KB3.13KB
layout (index.js)39.16KB10.97KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)9.35KB3.31KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)4.42KB1.42KB
permissions (evaluator.js)5.12KB1.74KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.81KB0.83KB
plugin-ai (index.js)15.75KB3.80KB
plugin-calendar (index.js)46.62KB12.83KB
plugin-charts (index.js)64.75KB18.37KB
plugin-chatbot (index.js)181.21KB43.14KB
plugin-dashboard (index.js)127.92KB32.80KB
plugin-designer (index.js)212.39KB42.83KB
plugin-detail (index.js)241.46KB60.56KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)124.19KB30.20KB
plugin-gantt (index.js)164.10KB39.87KB
plugin-grid (index.js)197.30KB53.06KB
plugin-kanban (index.js)52.93KB14.60KB
plugin-list (index.js)111.66KB27.13KB
plugin-map (index.js)20.08KB6.62KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)43.49KB11.93KB
plugin-timeline (index.js)26.68KB7.66KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.52KB20.67KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.66KB3.50KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.62KB2.34KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)36.10KB12.26KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.33KB0.69KB
react (schema-input.js)1.45KB0.83KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)5.41KB2.34KB
sdui-parser (index.js)4.77KB2.16KB
sdui-parser (input-type.js)2.84KB1.40KB
sdui-parser (parse.js)10.76KB3.17KB
sdui-parser (provenance.js)3.66KB1.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)6.92KB2.40KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (dashboard-filter-alias.js)6.23KB2.74KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)3.08KB1.53KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@os-support-ai
os-support-ai marked this pull request as ready for review August 19, 2026 17:59
@os-support-aiClaude

Copy link
Copy Markdown
CollaboratorAuthor

ACCEPT — PM review, round 17. Also closes #5340.

  • Path surface: 7 files — ObjectGrid.tsx, list-view.ts, SpecBridge.test.ts, two new tests, two changesets. Exactly the surface I granted; zero governed-surface hits.
  • Gates: every gate job completed: success — Lint, Type Check, Test shards 1–4, Build & E2E, Build Docs, Doc Snippet / Doc Component Type Check, Changeset Declaration / Bump Policy / Fixed Group, Bundle Analysis, Control Byte Scan, Internal Docs Link Check, Skill Guide Path Check. No cancelled, no in_progress.
  • Bumps: minor × 2 (@object-ui/plugin-grid, @object-ui/react). ⛔ not major.

The leg that justifies the scope call

Leg 3 — producer-only revert, i.e. the state that would have shipped if I had kept the one-package surface: predicted 7 red, observed exactly 7, and

x renders every column of a bridged view → Unable to find an element with the text: Ada
✓ specBridgeExportFormats ... all 5 tests GREEN

That green is the whole point. The pre-existing suite renders bridge output throughObjectGrid and cannot see the blanking. The new pin can. My original one-package file surface was the deviation; #3951's own PR4909 landed consumer and producer together, and this now does the same.

Predicted == observed on every leg, both directions, no leg reversing.

What the measurement added beyond the first dispatch

The first agent measured [{field},{accessorKey}] dropping the second column silently. The reverse order does not drop — it throws mid-render: inferColumnType reads col.field.toLowerCase() on a column synthesized from a missing accessorKey. So the "tolerance" was not merely a first-element sniff; in one ordering it was a crash. Predicted as a TypeError before the run and observed as one.

The second defect, which fell out rather than being added

header: col.label ?? col.field was synthesizing a label — turning "the author declared no label" into "the author declared the machine name" — and that value then pre-empted ObjectGrid's own header chain (col.labelthe object field's label → prettified name), whose middle step exists precisely so a localized field label beats the name-derived English one. So a bridged view rendered raw machine names where a directly authored object-grid rendered the field's real, localizable label. Nobody had named that; it is a user-visible i18n defect and it is gone.

The framing in the new docblock is the right one to keep: metadata vocabulary in, adapter vocabulary out; one translation, one place.accessorKey is not retired as a concept — it remains @object-ui/core's TABLE_ADAPTER_COLUMN_KEY, applied at the one boundary that owns it (ObjectGrid's output at :1636, untouched). What died is the round trip.

The pins were strengthened, not swapped: expect(node.columns[0]).toEqual({ field: 'email' }) is a whole-object assertion (an extra key now fails), plus explicit accessorKey/headertoBeUndefined().

Census extended rather than inherited

The first sweep's corpora did not include package READMEs. Swept: plugin-dashboard/README.md:473-479 and types/README.md:94-96 are type: "table" / type: 'data-table', likewise guide/quick-start.md:85 and index.md:29 — each classified by reading its enclosing node type. Still a clean zero for authored accessorKey-shaped object-grid columns. And #5240 was re-checked at both ends of the task — still open, unassigned, no claim — so no race on list-view.ts.

Two follow-ups, both correctly left to me

Merging via the queue.


Generated by Claude Code

@os-support-ai
os-support-ai added this pull request to the merge queueAug 19, 2026
Merged via the queue into main with commit dbbd38aAug 19, 2026
22 checks passed
@os-support-ai
os-support-ai deleted the claude/issue-5068-grid-column-accessorkey-tolerance branch August 19, 2026 18:00
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment