Repository navigation
feat(core,fields): a number field's authored useGrouping decides its thousands separator, relayed to every cell (objectui#11026) - #11089
Conversation
…elayed to every cell formatDisplayNumber / shouldGroupDisplayNumber take the field's authored useGrouping; an authored boolean overrides the scale-0 heuristic in either direction, unset keeps the heuristic. NumberFieldMetadata declares the key (derived from FieldSchema), NumberCellRenderer reads it, and every site that hand-copies scale into a cell's field relays it beside scale: ObjectGrid's three column paths, plugin-detail's enrichment key list, RecordDetailPanel, RelatedList and ObjectGallery. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec
…d each relay site One pin per scale-copy site (the grid's three column paths, detail enrichment, the quick-look panel, related tables, gallery cards), the formatter rows the card's acceptance lists, the NumberFieldMetadata declaration, the number field docs, and the changeset. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec
|
changeset-claim-re-read
|
✅ Console Performance Budget
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
Size Limits
|
Contract reviewServed-tier: Inputs: card #11026 (body; triage Check-runs on the head (43 with Binding direction: triage ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
Fixes #11026
Clause-②: yes
The renderer half of
FieldSchema.useGrouping, the digit-grouping hint@objectstack/specdeclares on a field. A number field's authoreduseGroupingnow decides its thousands separator, and every site that hand-copiesscaleinto a cell's field relays it besidescale. This is the objectui end of objectstack-ai/objectstack#20313; that parent keeps the ledger flip.What changed
@object-ui/corenumber-display.ts:DisplayNumberFormatOptionsgainsuseGrouping?: boolean.shouldGroupDisplayNumber(scale, currency, useGrouping)is still the one decision point: an authored boolean answers first, in either direction (money included), and when it is unset the existingscale/currencyheuristic decides, unchanged. There is no second heuristic.Intlnote the card asked to mind. The renderer still never writesuseGrouping: trueon its own behalf. The heuristic's "group" answer omits the key, so the locale's "auto" applies. The onlytruewritten is the author's own: the spec's docblock says the key "maps 1:1 ontoIntl.NumberFormat'suseGroupingoption", and itstruemeans "the author pins grouping ON". So an authoredtrueis "always". The difference only shows where a locale leaves a four-digit number alone under "auto": es-ES renders1234with the key unset and1.234with an authoredtrue, and pl-PL renders1 234. This is pinned, with the premise asserted in the same test.@object-ui/typesNumberFieldMetadatadeclaresuseGrouping?: SpecField['useGrouping'], derived by reference from the spec's type, asdependsOnalready is. This is a file-surface addition beyond the claim's list. The dispatch said to read the key as the spec's type and not to cast around a missing key. The cell receivesFieldMetadata, and without the declaration the only read would be through the existingas any.@object-ui/fieldsNumberCellRendererreadsfield.useGroupingoff the typed field. It narrows with'useGrouping' in field, so there is no cast, and it takes booleans only. It passes the value toformatDisplayNumber.scaleis copied (see the census below).content/docs/fields/number.mdx(the key in the schema snippet, plus a grouping table under Cell Renderer). Changeset:.changeset/11026-number-use-grouping.md.Relay census (re-derived, not copied from the card)
Instrument:
git grep -nE "\bscale\b" -- 'packages/*/src/**' ':!**/*.test.*' ':!**/__tests__/**', dropping comment lines and CSS/transformscale, then reading each hit. I also checked every consumer ofgetCellRenderer/CellRendererunderpackages/*/srcfor how it builds the cell'sfield.plugin-gridObjectGrid.tsx, path A (ListColumn objects,objectDefField.scale)gridUseGrouping-11026.test.tsx, "ListColumn objects" rowsplugin-gridObjectGrid.tsx, path B (string columns)plugin-gridObjectGrid.tsx, path C (inline rows +fieldsprojection)plugin-detailfieldEnrichment.tsENRICHED_FIELD_METADATA_KEYS(DetailSection, HeaderHighlight, summary chips)useGroupingRelay-11026.test.tsx, "DetailSection"plugin-detailRecordDetailPanel.tsxbuildRecordDetailFieldsplugin-detailRelatedList.tsxmakeCellbagplugin-listObjectGallery.tsxbuildEnrichedFieldObjectGallery.useGrouping-11026.test.tsxplugin-griduseColumnSummary.tsscaleonly sets the percent footer width, and number sums format throughtoLocaleStringplugin-formsectionFields.tsscalefeeds the form input'sstep; the read-onlyNumberFieldrenders the raw valueplugin-formderiveMasterDetail.ts(two)GridFieldcomputed column;GridFieldrenders numbers throughtoLocaleString, outside the policyplugin-formObjectForm.tsx,plugin-detailDetailView.tsx(percent chip),fieldspercent/number/grid widgets,percent-scale.tsscaleas a width or stepapp-shellObjectFieldInspector.tsx/form-spec.tsscalecontroltypesfield-types.ts,corenumber-display.ts/dataset-format.tsListViewtimeline, charts, mobile, react animation, designer minimap, image cropperscale(time axis, zoom, CSS)ObjectGridauto-generated columns and expand panel,ObjectKanbancards,ReportViewerplugin-dashboardrecordFields.tsxbuildFieldMetascalenoruseGroupingVerification (all on
0d24f3624)Type-check, rebuilding the dependency closure first (
pnpm --filter '@object-ui/plugin-grid^...' --filter '@object-ui/plugin-detail^...' --filter '@object-ui/plugin-list^...' build, exit 0):@object-ui/core,@object-ui/types,@object-ui/fieldsall printedtype-check: Done, exit 0. So did@object-ui/plugin-grid,@object-ui/plugin-detailand@object-ui/plugin-list(exit 0). Each chain includestsc -p tsconfig.test.json, so the types pin'sEqualassertions and its@ts-expect-erroron a stringuseGroupingwere compiled.New pins: 6 files, 32 tests passed.
Suites (
pnpm exec vitest run --maxWorkers=2 DIRfrom the worktree root):packages/core/src/utils/: 98 files, 1813 tests passed;packages/fields/src/: 219 passed and 1 skipped (220 files), 3497 tests passed and 7 skipped;packages/plugin-list/src/: 107 files, 1182 tests passed;packages/plugin-detail/src/: 219 passed and 1 skipped (220 files), 2152 tests passed and 8 skipped;packages/plugin-grid/src/: 166 files, 1550 tests passed;packages/types/src/: 280 files, 6434 tests passed;number-display.test.ts,number-display.reexport-identity.test.ts): 2 files, 18 tests passed. The i18n source is unchanged, but it re-exports the widened names.Each run printed
VERDICT command-exit 0. The CLI tier split does not apply: nopackages/clifile is touched.Ablations, each through
ablation-replace.mjs(the anchor must hit, the blob change is checked on disk, and the restore is proven by blob == HEAD and an emptygit diff HEAD). Vitest aliases@object-ui/*tosrc, so no dist rebuild sits between a mutation and its reading.'useGrouping'fromENRICHED_FIELD_METADATA_KEYS: DetailSection red, RecordDetailPanel and RelatedList green.useGroupingfromNumberCellRenderer's formatter call: 13 red across the cell, grid, detail and gallery pins, including the grid's auto-generated reference; the 4 controls stay green.shouldGroupDisplayNumber: 6 red.truespelling branch: only the es-ES and pl-PL "always" rows red.eslint on the 14 changed
.ts/.tsxfiles: 0 errors. The warning count on each of the 8 touched source files equals its count on the base, linted fromgit show(for exampleObjectGrid.tsxhas 209 on both). The two newno-explicit-anywarnings are theas anyfixture casts in two new test files. This is a narrowed run, notpnpm lint. The 14 files are the whole diff's TS population (git diff --name-only), and eslint's--format jsonoutput lists all 14, none of them ignored by the config.eslint.config.jssets noparserOptions.project/projectService, so linting is not type-aware and this diff cannot move a verdict on an untouched file.Gates, all exit 0:
check-changeset-presence("14 source file(s) of 6 released package(s) changed, and this change declares 1 changeset(s)"),check-changeset-no-major,check-control-bytes,check:new-line-citations(0 new),check:test-path-roots,check:vi-mock-specifiers/-inherit/-override-shape,check:changeset-claims,check:pending-changeset-literals,check:spec-symbols,check:doc-types,check:doc-fences,check:doc-example-ids.check:changeset-claimslisted 10 pending changesets that name a file this diff touches. I read each named paragraph, and none makes a claim this diff falsifies.NOT MEASURED:
check:doc-snippets. It exited 2 with PRECONDITION NOT MET: 22 of the 34 packages its program resolves against are unbuilt here, and that scoped build was not run locally. The one snippet this diff edits is aNumberFieldMetadataliteral withuseGrouping: true. The same annotated-literal shape compiles in the types pin (undertsconfig.test.json). CI runs the full gate.Dist pins: the dispatch lead named
plugin-grid's dist pins. The dist project's glob ispackages/*/src/**/*.dist.spec.tsx, which matches two files, incomponentsandtypes, andplugin-gridhas none. Thetypesone reads the zod subpath modules, which this diff does not touch (the new member is type-only). Not run locally; CI runs it.Acceptance notes
plugin-dashboardrecordFields.tsxbuildFieldMetacopies neitherscalenoruseGrouping. So a number cell in the dashboard's object table and record drawer gets neither the scale-0 heuristic nor the author's hint. This is a read-only reading, not measured at a running door, so it is not filed. It is outside the card's "copiesscale" census, so it is not relayed here. Carrier: none.GridField(the master-detail line grid) formats number cells withtoLocaleString. It ignores the scale-0 heuristic and the hint alike. This is a read-only reading, not filed. Carrier: none.FieldSchema.useGroupingdocblock describes today's interim heuristic as bound-sensitive ("scale: 0+ no upper bound reads as a plain count and keeps grouping"). The renderer's heuristic isscale === 0alone, bounds unread. That is doc drift on the objectstack side. Carrier: the parent fields: number rendering honours the authoreduseGrouping(1 key) objectstack#20313 if it touches that docblock, otherwise none.useGroupingcontrol, so authoring it today means writing metadata by hand. This is an observation, not filed.Generated by Claude Code