Skip to content

fix(fields): honour relative and short on a datetime cell, as the date cell already did (objectui#8853) - #8959

Merged
os-steve merged 1 commit into
mainfrom
claude/issue-8853-datetime-cell-format-vocabulary
Sep 10, 2026
Merged

fix(fields): honour relative and short on a datetime cell, as the date cell already did (objectui#8853)#8959
os-steve merged 1 commit into
mainfrom
claude/issue-8853-datetime-cell-format-vocabulary

Conversation

@os-steve

@os-steve os-steve commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Fixes #8853

DateCellRenderer and DateTimeCellRenderer are neighbours reading ONE authored field.format and handing it to two formatters with different vocabularies: formatDate honours 'short' and 'relative', while formatDateTime's options.style honours 'compact' alone. So format: 'relative' painted the relative face on a date column and the verbose absolute face on a datetime one — no error, no warning, no fallback.

The premise was driven out end to end BEFORE anything changed

The card declared its own gap: "A browser run through a real datetime grid column has not been done… the end-to-end claim is inference from a measured formatter plus a read pass-through." So it was driven, not inferred — a real ObjectGrid over an object carrying a date field and a datetime field, both authored format: 'relative', one row, one instant (2026-09-11T09:30:00.000Z), clock pinned to 2026-09-09T12:00:00.000Z, en-US, TZ=UTC. The grid's own body cells:

run grid body cells
before ["1Open", "Row One", "In 2 days", "Sep 11, 2026, 09:30 AM"]
after ["1Open", "Row One", "In 2 days", "In 2 days"]

Third cell is the date column, fourth is the datetime column beside it. Same key, same instant, same row — honoured on one, dropped on the other. Premise confirmed.

The fix, and the three routes

The card left the fix shape to a ruling and listed three routes. This is route 2, and it is inherited rather than newly decided: this card is, in its own first line, "the same defect class" as objectui#8352, which shipped via PR #8852. That ruling was re-measured on origin/main rather than taken from the card's transcription — formatDateTime's published signature is still (value, options?) with no style parameter, and formatMeasureDate's datetime arm carries its own comment saying it honours the same two words "by choosing a formatter here".

The datetime cell now SELECTS a formatter instead of threading one:

  • 'relative' resolves through formatRelativeDate, the same function the date cell reaches, so one calendar day reads the same phrase in either column.
  • 'short' resolves to the dense face of this type — the compact face this cell already paints, which keeps the time of day.
  • everything else, 'compact' and date patterns such as 'YYYY-MM-DD' included, falls to the default face exactly as before.

formatDateTime's published signature was not widened (route 1) — expanding a published surface is a manual floor. ⛔ No refusal was added for a currently-accepted spelling (route 3) — that would be a breaking narrowing of a published metadata surface. Both refusals are pinned by tests.

The break, spelled out

Two authored spellings render differently than they did, and one loses a component. All three are in the changeset body and each is pinned:

  • format: 'relative' on a datetime field: was Sep 11, 2026, 09:30 AM, is now In 2 days.
  • format: 'short' on a datetime field: was that same verbose face, is now the compact face — 9/11/2026 9:30 am on the measured instant.
  • ⚠️ Beyond the ±7-day window a 'relative' datetime now shows no time of daySep 20 where it was Sep 20, 2026, 09:30 AM. formatRelativeDate falls back to an absolute DATE face out there; that window belongs to that function and is inherited rather than re-decided at the call site (re-deciding it would put a second copy of the convention in the renderer — objectui#4576). 'relative' is day-granular by construction, and any other fallback would make the two columns unequal again, which is the defect this change closes.

Nothing was taken from a working feature: this renderer ignored both words outright before, so it starts honouring a request whose granularity is days, and only for a field whose author actually wrote one of them.

Discriminating power, proven both ways

The defect's signature is a silent drop — the runtime accepts the key, parses it, drops it, and renders something that still looks like a legitimate date — so a green suite proves nothing by itself.

Reverting the call-site change to the pinned base commit and re-running, then restoring:

leg result
mutated Tests 6 failed | 14 passed (20)
restored Tests 20 passed (20)

The six that went RED are the repro, the three locale-agreement cases, the 'short' face and the out-of-window datetime cost. The fourteen that stayed GREEN are the controls and regression pins — they measure surfaces this change does not touch, which is exactly why they can vouch for the run.

The mutation was proven to reach disk before any result was read (blob hash moved 9e593ba1… to 8e9e7621…, both source anchors dropped to 0), and the restore was proven by stategit diff HEAD empty and the on-disk blob back to 9e593ba1… — never by an exit code. The test imports the renderer by relative source path, so no rebuild sits between the mutation and the assertion.

Controls in the committed test

  • Positive control — the date cell, same run, same instant. It already honoured 'relative', so it is what "honoured" looks like; without it a datetime assertion could be measuring a broken clock rather than the vocabulary.
  • Negative control — an out-of-window value, where format: 'relative' and no format at all render identically on the fully working date cell. That is the trap objectui#8352's card recorded: a probe built out there reports "identical" on a working path and a broken one alike. It is pinned explicitly, so the in-window choice everywhere else is a measured decision rather than luck.

Gates

scripts/pm/dispatch-gates.mjs does not exist in this repo, so the families were derived by hand from the changed-file set (packages/fields/src/index.tsx, one new test, one changeset) and are declared as such.

gate exit
pnpm --workspace-concurrency=2 --filter '@object-ui/fields...' build 0
pnpm --filter @object-ui/fields type-check (tsc --noEmit + tsconfig.test.json) 0
pnpm --filter @object-ui/fields lint 0 (990 pre-existing warnings, 0 errors)
pnpm exec vitest run packages/fields/ (repo ROOT) 0 — 155 files, 2658 tests
pnpm exec vitest run packages/plugin-grid/ packages/plugin-detail/ packages/core/src/utils/ 0 — 339 files, 3792 tests
node scripts/check-control-bytes.mjs 0
node scripts/check-changeset-presence.mjs 0
node scripts/check-changeset-no-major.mjs 0
node scripts/check-governed-queue-guard.mjs --test … 0 — NOT GOVERNED, ordinary route

The consumer suites are run because the rendered output changed even though the exported byte surface did not, and both packages render datetime cells.

Acceptance notes

  • No docblock was made false. DateDisplayOptions.style's docblock states the split for the functions ("that function's default face"), and the functions are untouched — the mapping is at the cell. DateTimeCellRenderer's own ||-not-?? note still holds: an authored empty string still lands on the compact face, and that is pinned.
  • dueLike is deliberately not threaded, and it is filed rather than guessed as objectui#8958. Measured while here: dueLike: true on a datetime cell is byte-identical to no dueLike (3 days ago, no red class) while the date cell paints Overdue 3d in text-red-600 — and the Zod describe text for that key names "date/datetime". It is a different authored key whose affordance travels with red styling and a field-name heuristic; acquiring a second key's behaviour while honouring the first would be an unruled change.
  • Serial constraint re-derived, not taken from the claim's snapshot: across all 12 currently-open pull requests, zero touch packages/fields/src/index.tsx. Two touch packages/fields/package.json only (the lucide bumps, chore(deps): lucide-react 1.31.0 -> 1.43.0, with the one retired spelling repaired #8941 and chore(deps): bump lucide-react from 1.31.0 to 1.41.0 #7058); the release bot's changeset-release/main is stale relative to main rather than a concurrent editor. Lit control on the same probe: every branch measured returns a non-zero total changed-file count, so those zeroes are readings. The claim's snapshot named docs(guide,readme): spell the grid child list children, the key grid reads (objectui#8912) #8951, which is no longer open, and predates nine of the twelve.
  • objectui#8263 holds formatMeasureDate in packages/core — a different file and package, untouched here.
  • One repair after publication: a bullet above quoted the 'short' face as 9:00 am; the measured face is 9:30 am, as the changeset body and the pins both say. Corrected in place rather than left standing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MPaVWWMuWeT5LgB1qoXjVB

… date cell already did

`DateCellRenderer` and `DateTimeCellRenderer` are neighbours reading ONE
authored `field.format` and handing it to two formatters with different
vocabularies: `formatDate` honours `'short'` and `'relative'`, while
`formatDateTime`'s `options.style` honours `'compact'` alone. So
`format: 'relative'` painted the relative face on a `date` column and the
verbose absolute face on a `datetime` one — no error, no warning, no fallback.

Driven end to end through a real ObjectGrid column before any change, one row,
one instant, the key authored on both fields: the `date` cell painted
`In 2 days` and the `datetime` cell beside it painted `Sep 11, 2026, 09:30 AM`.

The cell now SELECTS a formatter instead of threading one, which is the ruling
objectui#8352 already made for `formatMeasureDate`'s datetime arm — the same
defect class one surface over. No published signature moved, and no spelling
that rendered before is refused now.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPaVWWMuWeT5LgB1qoXjVB
@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 50 chunks) 3491.1 KB 3512.7 KB
Main entry chunk (gzip) 144.2 KB 350 KB
Entry file index-D3fNf15z.js
Status PASS

The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it.


📦 Bundle Size Report

Package Size Gzipped
app-shell (consoleActionDispatch.js) 0.20KB 0.19KB
app-shell (index.js) 16.69KB 6.21KB
app-shell (runtime-config.js) 20.68KB 7.36KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 10.06KB 3.86KB
auth (ActiveOrganizationStorage.js) 25.05KB 9.16KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 2.07KB 1.00KB
auth (AuthProvider.js) 40.18KB 10.59KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.15KB 5.39KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.65KB 2.22KB
auth (SocialSignInButtons.js) 9.61KB 3.89KB
auth (UserMenu.js) 3.41KB 1.23KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 40.21KB 10.80KB
auth (createAuthenticatedFetch.js) 8.46KB 3.43KB
auth (index.js) 3.19KB 1.44KB
auth (invitation-status.js) 1.22KB 0.70KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 5.30KB 1.02KB
auth (useWorkspaceAdminStatus.js) 11.08KB 4.58KB
collaboration (CommentThread.js) 26.08KB 7.56KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.68KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 500.20KB 114.67KB
core (index.js) 7.48KB 2.96KB
create-plugin (index.js) 28.04KB 9.46KB
data-objectstack (index.js) 205.46KB 56.78KB
fields (index.js) 247.15KB 62.32KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (builtinAggregateLabels.js) 0.86KB 0.49KB
i18n (currency.js) 1.22KB 0.64KB
i18n (fallbackInterpolation.js) 6.25KB 2.77KB
i18n (i18n.js) 6.57KB 2.76KB
i18n (index.js) 3.65KB 1.47KB
i18n (pickLocalized.js) 7.62KB 3.26KB
i18n (provider.js) 26.89KB 9.04KB
i18n (useDisplayLocale.js) 2.85KB 1.45KB
i18n (useObjectLabel.js) 34.34KB 9.17KB
i18n (useSafeTranslation.js) 5.60KB 2.33KB
layout (index.js) 38.84KB 10.94KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.75KB
mobile (index.js) 1.99KB 0.87KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 2.53KB 0.85KB
mobile (useResponsive.js) 0.72KB 0.42KB
mobile (useSpecGesture.js) 4.39KB 1.66KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 13.52KB 4.88KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 6.24KB 2.16KB
permissions (discardProofCache.js) 1.04KB 0.55KB
permissions (evaluator.js) 8.39KB 3.10KB
permissions (index.js) 0.93KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.53KB
permissions (usePermissions.js) 4.83KB 2.27KB
plugin-ai (index.js) 14.81KB 3.63KB
plugin-calendar (index.js) 49.03KB 13.93KB
plugin-charts (index.js) 71.63KB 19.99KB
plugin-chatbot (index.js) 195.32KB 46.51KB
plugin-dashboard (index.js) 132.41KB 34.84KB
plugin-designer (index.js) 215.68KB 44.27KB
plugin-detail (index.js) 253.19KB 65.62KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 136.79KB 34.19KB
plugin-gantt (index.js) 166.96KB 40.93KB
plugin-grid (index.js) 210.86KB 57.28KB
plugin-kanban (index.js) 57.58KB 16.47KB
plugin-list (index.js) 112.54KB 27.65KB
plugin-map (index.js) 20.49KB 6.83KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 43.42KB 11.92KB
plugin-timeline (index.js) 30.10KB 8.74KB
plugin-tree (index.js) 9.55KB 3.32KB
plugin-view (index.js) 84.42KB 20.80KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.66KB 3.50KB
providers (index.js) 0.45KB 0.23KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.62KB 2.34KB
react (LazyPluginLoader.js) 4.47KB 1.63KB
react (SchemaRenderer.js) 83.34KB 27.61KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.63KB 2.18KB
react (schema-input.js) 2.32KB 1.24KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 6.58KB 2.74KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 5.66KB 2.50KB
sdui-parser (input-type.js) 2.84KB 1.40KB
sdui-parser (kanban-quick-add.js) 2.71KB 1.35KB
sdui-parser (parse.js) 20.57KB 5.88KB
sdui-parser (provenance.js) 3.66KB 1.82KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 14.82KB 4.99KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 1.00KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 2.93KB 1.49KB
types (crud.js) 0.20KB 0.18KB
types (dashboard-filter-alias.js) 6.23KB 2.74KB
types (data-display.js) 3.75KB 1.85KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.85KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (expression.js) 0.20KB 0.18KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-inflight.js) 8.87KB 3.73KB
types (http-retry.js) 4.32KB 2.02KB
types (icon-key-migration.js) 4.26KB 1.63KB
types (index.js) 4.74KB 2.25KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 4.73KB 2.28KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 0.20KB 0.18KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (select-option.js) 0.20KB 0.19KB
types (spec-report.js) 5.05KB 1.93KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (strict-authoring-face.js) 14.27KB 5.47KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 6.28KB 2.87KB
types (ui-action.js) 8.11KB 3.32KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

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

@os-steve
os-steve marked this pull request as ready for review September 10, 2026 10:42
@os-steve
os-steve added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit 58be55e Sep 10, 2026
35 checks passed
@os-steve
os-steve deleted the claude/issue-8853-datetime-cell-format-vocabulary branch September 10, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants