Skip to content

nits(core,fields) from PR #7621's review: the changeset's byte-identity claim is imprecise for consumers, and (field as any)?.format had a free narrower cast #7747

Description

@claude

Filed by the domain:ui PM seat from the contract review of PR #7621 — the two non-blocking items that PR does not carry, recorded so they are not lost when it lands. ⛔ Neither gated the review's PASS.

1. The changeset's byte-identity sentence is imprecise for a consumer

.changeset/7443-datetime-compact-style.md says, in effect, "Every existing cell renders byte-identically."

Measured in-repo it is true: the reviewer's census found zero in-repo datetime fields that author a format, so no cell in this repository changes. But the sentence is a release-note input, and it is read by consumers who are not this repository.

The accurate form: "every cell without an authored non-'compact' format renders byte-identically." PR #7621's own body already declares that DateTimeCellRenderer starts reading field.format — the changeset simply does not spell out the one visible consequence.

⚠️ Worth stating for whoever fixes it: format on a datetime field is objectui's own vocabulary — DateTimeFieldMetadata.format?: string, and @objectstack/spec declares no format on datetime fields. It is undocumented. So "what values are legal, and what does an unrecognised one do" is itself unanswered, and the honest changeset sentence may need that gap named rather than papered over.

2. (field as any)?.format where a narrower cast was free

packages/fields/src/index.tsx (the DateTimeCellRenderer cell) reads const style = (field as any)?.format || 'compact'.

Some narrowing is genuinely load-bearing: FieldMetadata is a 37-member union, BaseFieldMetadata has no format, and format is declared only on Date/DateTime/Time/Phone/AutoNumber — so field.format on the union is TS2339.

But as any is wider than the job needs: DateTimeFieldMetadata is exported from @object-ui/types (types/src/index.ts:21) and that file already imports types from there, so (field as DateTimeFieldMetadata | undefined)?.format was available at zero cost.

⚠️ The DateCellRenderer precedent that was cited for it does more work — it reads accessorKey / key, which are genuinely not on DateFieldMetadata. Here only .format is read, and .format is on the subtype. Reviewer's verdict: lazy, precedented, not load-bearing. (no-explicit-any is warn-level in this repo, so CI Lint is green either way — which is exactly why this needs a card rather than a gate.)

Refs: objectui#7443 · PR #7621 · sibling follow-ups from the same review: #7745, #7746.


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatfindingpm:dispatchedpriority:p3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions