Skip to content

fix(plugin-form): derive the numeric form step from scale, not precision (objectui#9574) - #9873

Merged
os-sales merged 1 commit into
mainfrom
claude/issue-9574-objectform-step-scale
Sep 18, 2026
Merged

os-sales merged 1 commit into
mainfrom
claude/issue-9574-objectform-step-scale

Conversation

@os-sales

Copy link
Copy Markdown
Collaborator

Fixes #9574

Clause-②: no — this card neither widens an accepted set nor enlarges a published surface; it pulls one consumer back onto a member the contract already declares. My measurements did not contradict that: no declaration moved, and the only key whose value changes is one ObjectForm already wrote.

The change

packages/plugin-form/src/ObjectForm.tsx, the auto-generated numeric form field:

// before
formField.step = field.precision ? Math.pow(10, -field.precision) : undefined;
// after
formField.step = typeof field.scale === 'number' ? Math.pow(10, -field.scale) : 'any';

Three properties, each deliberate:

  1. scale, not precision. The installed @objectstack/spec (17.4.0, read in this worktree's node_modules) declares them apart — precision is "Total digits (non-negative integer)", scale is "Decimal places (non-negative integer)" — and NumberField states the consequence verbatim one layer down: "Step follows scale (decimal places), not precision (total digit count)".
  2. typeof, not truthiness. scale: 0 is a valid declaration meaning "steps by 1"; the spec's own prose uses a scale: 0 ordinal integer as its example.
  3. 'any', not undefined, for an undeclared scale. An absent step attribute is HTML's default of 1, which marks every decimal :invalid and blocks the submit — a granularity the author never declared. 'any' is the tail NumberField already uses for the same case. Had this stayed undefined, a field declaring only precision would have moved from "accepts decimals" to "refuses them", i.e. the fix would have introduced a new defect.

Where this key is read — measured, not assumed

The same file carries a tombstone (objectui#8438) about a sibling key written here that reaches nothing, so liveness was measured rather than argued. Rendering a real ObjectForm over a mock data source, on this branch's base:

field route rendered step produced by
number, scale: 0 registered widget 1 NumberField's own derivation
number, scale: 2 registered widget 0.01 NumberField's own derivation
currency, precision: 10 registered widget 0.0000000001 CurrencyField's own Math.pow(10, -precision).toFixed(precision)
percent, precision: 10 registered widget 0.0000000001 PercentField's own Math.pow(10, -precision).toFixed(precision)
number, scale: 0, unregistered widget renderer fallback 1e-10 this file's assignment

The spelling is the lit control that tells the two producers apart: this file's value is a bare number, so React writes 1e-10, while the widgets' .toFixed(precision) writes 0.0000000001.

Ablation on the base: deleting the assignment outright and re-rendering left every rendered INPUT element on the registered route byte-identical (the mutation was verified on disk — anchor hits 1 then 0, injected marker 1 — and the file restored to its HEAD blob hash afterwards). So the registered field:* widgets genuinely drop it: their metadata carrier is formField.field (the raw object-schema field, assigned a few lines above) and their DOM whitelist does not forward step. What the key DOES reach is the form renderer's unregistered-widget fallback branch, where the leftover field props are spread onto the INPUT element — the branch that renderer's own comment describes as the normal path for an app that declares a widget it never registered.

⇒ the card's headline example over-states one thing and under-states another, and the report on the issue says so: for a plain number field on the ordinary route the browser already stepped by 1, because NumberField had already moved; the 1e-10 a user actually meets on that route comes from CurrencyField / PercentField, which are not this PR's surface.

Reverse verification

With the fix committed, the old expression was reinstated in place (on-disk mutation verified, then restored to the HEAD blob and git diff HEAD empty):

AssertionError: decimal(10, 0) steps by 1: expected '1e-10' to be '1'
AssertionError: undeclared scale ⇒ step="any": expected '1e-10' to be 'any'
Test Files  1 failed (1) | Tests  2 failed | 1 passed (3)

The one test that stayed green under the reinstated defect is the block labelled CHAIN PIN, not a pin of this card — it pins the same user-visible rule through the registered route and says in its own name that it passes on both configurations. That is the label being honest, not a gap.

The percent seam (objectui#9810) — what I measured and what I left alone

objectui#9810 claims scale means stored decimals to the write path and displayed decimals to the display path, ~100x apart for a fraction-stored percent. Read, and not treated as settled. What I can say from this checkout:

  • percentScaleOf in the installed spec confirms the storage convention: a percent field stores a 0–1 fraction unless it declares max > 1.
  • The spec's scale block states that it is enforced at write time (Number.isInteger(def.scale) && def.scale >= 0).
  • @objectstack/objectql is not installed in this repo (only client, core, formula, lint, sdui-parser, spec, types are present under .pnpm), so the max_scale branch itself was NOT re-derived here — a dead instrument, not an absence. The lit control is that @objectstack/spec IS present and its FieldSchema / percentScaleOf symbols do hit.
  • On the route where this key reaches the DOM, the box holds the stored number (no ×100 conversion happens there — that conversion lives in PercentField, which drops this key). So 10^-scale there is the stored-decimal granularity, which is the quantity a write-time scale check judges. Before this change that same box offered 1e-10, i.e. finer than any reading of the declared scale would accept. ⇒ this change moves the percent affordance toward the write path under either reading of finding(core/spec seam): scale means STORED decimals to the write path and DISPLAYED decimals to the display path — ~100x apart for a fraction-stored percent, so the UI offers a step max_scale will reject #9810; it cannot start offering a step the validator rejects.
  • Left untouched, deliberately: PercentField and CurrencyField (packages/fields, out of this card's surface — the percent edit widget is objectui#9568's, delivered in PR objectui#9804), and the display-vs-stored question itself, which is a contract ruling and not a patch.

Verification (at 4c44f718)

  • pnpm exec vitest run packages/plugin-form/ → Test Files 98 passed (98), Tests 928 passed | 1 skipped (929), exit 0 (via the shared verify lock).
  • pnpm exec turbo run type-check --filter=@object-ui/plugin-form --concurrency=2 → Tasks: 13 successful, 13 total, exit 0. The package's own task reported cache miss, executing, so this is a real run and not a cross-worktree cache hit; it runs tsc --noEmit && tsc -p tsconfig.test.json, so the new pin is type-checked too.
  • eslint . in packages/plugin-form (the package's own lint script, the invocation turbo runs) → 128 files, 0 errors, 853 warnings, exit 0. Narrowed to this package on the ground that this config enables no type-aware linting (no parserOptions.project / projectService anywhere in eslint.config.js), so a file's verdict depends on that file plus the config, and this diff cannot move the verdict of any untouched file. The repo-wide run is CI's. (A --no-inline-config variant reports one error in sectionFields.spec-parity.test.ts, a file this branch does not touch, from an inline suppression that flag disables.)
  • node scripts/check-changeset-presence.mjs → OK, 1 source file of 1 released package, 1 changeset.
  • node scripts/check-changeset-no-major.mjs → OK (this changeset is patch).
  • node scripts/check-control-bytes.mjs → OK (7936 tracked text files).
  • node scripts/check-new-cross-file-line-citations.mjs → 0 new citation(s).
  • node scripts/check-vi-mock-specifiers.mjs and check-vi-mock-inherit.mjs → OK.

scripts/pm/dispatch-gates.mjs derives nothing for this repo by design (it refuses when asked for objectstack-ai/objectui from the objectstack checkout), so the gate list above is hand-derived from this repo's own package.json scripts and .github/workflows/ and is not authoritative for the whole farm — CI's is.

Acceptance notes

Out-of-scope observations, noted and not filed by me (dev seats do not file on this lane):

  • CurrencyField derives its input step from precision — Math.pow(10, -precision).toFixed(precision) — which is the same rule this card names, on a file in packages/fields that no open card covers as far as this seat read. It is the producer of the 0.0000000001 a currency field actually shows today. Dedupe words: CurrencyField step precision scale · currency input step precision · Math.pow(10, -precision).toFixed · currency widget decimal places · fields widget step scale family.
  • @object-ui/types declares step on NumberFieldMetadata and NumberField reads it as an override, but the installed @objectstack/spec FieldSchema declares no step on the object-field surface (only InlineGridColumn and the slider node have one) — so an author who writes step on a platform field would have it dropped at publish while the renderer-side type says it is supported. Not verified beyond this reading, and deliberately not copied into ObjectForm: this PR derives from scale only and leaves step-override handling to the widget.
  • CurrencyFieldMetadata in @object-ui/types declares precision but no scale, while NumberFieldMetadata and PercentFieldMetadata declare both. Observation only.

Session: session_01Xm4WFhEe5mwcgyqHjxR2hn.


Generated by Claude Code

…cision` (objectui#9574)

`@objectstack/spec` declares `precision` as "Total digits (non-negative
integer)" and `scale` as "Decimal places (non-negative integer)". The
auto-generated form field derived its `step` from `precision`, so a
`decimal(10, 0)` field was handed `1e-10` instead of `1` and a
`decimal(10, 2)` got `1e-10` instead of `0.01`. `NumberField` states the
same rule verbatim one layer down and already moved; this is the
producer one layer up catching up with it.

Two further consequences of the same expression:

- `scale: 0` is honoured — the test is `typeof`, not truthiness.
- an undeclared `scale` resolves to `step="any"`, not to no attribute at
  all: an absent `step` is HTML's default of 1, which marks every
  decimal `:invalid` and blocks the submit, a granularity nobody
  declared. Same tail `NumberField` uses.

Where it is observable, measured through a real render rather than
assumed: the registered `field:*` widgets DROP this key (their metadata
carrier is the raw object-schema field and their DOM whitelist does not
forward `step`), so deleting the assignment outright left every
`<input>` on that route byte-identical. The key IS read on the
renderer's unregistered-widget fallback, where the leftover field props
are spread onto the `<input>`. The new pin measures both routes side by
side and labels which of its assertions is load-bearing for this change.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xm4WFhEe5mwcgyqHjxR2hn
@github-actions

Copy link
Copy Markdown
Contributor

changeset-claim-re-read

⚠️ 1 pending changeset(s) describe a file this change touches

Their bodies publish verbatim into the CHANGELOG at the next release, so this is a request to re-read them against your diff — addressed here because you are the one seat that can answer it without re-deriving anything.

⛔ Nothing here blocks, and nothing here is a verdict on your change. This gate exits 0, is not a required context, and judges name resolution, never meaning: it asked whether a pending body names a file you touched. "Is this sentence still true?" is the one question it will not answer, and the one you are being asked to answer.

.changeset/8738-object-form-fields-description.md

  • names ObjectForm.tsx → packages/plugin-form/src/ObjectForm.tsx — edited by this change

    The registration declared { name: 'fields', type: 'array' } with no description, so an author had nowhere to read that this key's members are bare field names — a different vocabulary from sections[].fields, which also accepts the spec FormFieldSchema object (identity key field, e.g. { field: 'note', colSpan: 2 }). Moving one of those objects to the top-level fields resolves to no name and is silently skipped by SimpleObjectForm (ObjectForm.tsx) and by buildFlatFields (flatFields.ts, shared by the drawer/modal presentations) — no throw, no warning, no empty-state. Behaviour is unchanged; this only adds the description text an author would need to avoid the drop before writing it.

Read the paragraph, not the line: both false halves of the objectui#8617 claim sat in one paragraph, and correcting either alone would have left it asserting the same wrong thing.

If a claim did go false, correct the body. That is precedented and prose-only, frontmatter untouched; check-changeset-overwrite.mjs will report the correction as its own case 2 ("correcting a declaration on purpose … legitimate"), which is the intended shape — one gate asks for the read, the other records the write.

Not covered, stated so nobody reads this as more: a born-false claim that spells no line address at all (objectui#9495 coordinated one by ORDINAL — "a grep finds that member first" — and deciding that means reading what the sentence means), a claim spelled as a symbol or a package rather than a backticked file name, and a file named ambiguously.

Compared the checked-out tree with a0176176a (merge-base with origin/main): 2 file(s) changed outside .changeset/, read against 1162 pending declaration(s) that publish a body (1698 pending in total). · run

@os-sales os-sales added domain:ui objectui ui stream: fix lands on the published library or apps — objectui execution seat priority:p2 labels Sep 18, 2026 — with Claude
@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 329 chunks) 3049.8 KB 3104.5 KB
Main entry chunk (gzip) 145.7 KB 350 KB
Entry file index-BeqHvF5h.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) 545.76KB 130.74KB
core (index.js) 8.94KB 3.59KB
create-plugin (index.js) 27.94KB 9.51KB
data-objectstack (index.js) 215.98KB 59.97KB
fields (index.js) 249.23KB 62.88KB
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) 8.87KB 3.64KB
i18n (index.js) 5.22KB 2.26KB
i18n (pickLocalized.js) 9.86KB 3.95KB
i18n (provider.js) 32.15KB 10.49KB
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.83KB 10.95KB
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) 5.52KB 2.10KB
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.92KB 14.22KB
plugin-charts (index.js) 71.61KB 20.05KB
plugin-chatbot (index.js) 195.35KB 46.52KB
plugin-dashboard (index.js) 131.44KB 34.65KB
plugin-designer (index.js) 215.94KB 44.33KB
plugin-detail (index.js) 253.37KB 65.90KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 136.82KB 34.17KB
plugin-gantt (index.js) 167.62KB 41.26KB
plugin-grid (index.js) 212.61KB 57.90KB
plugin-kanban (index.js) 48.10KB 14.94KB
plugin-list (index.js) 112.74KB 27.70KB
plugin-map (index.js) 21.48KB 6.99KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 43.41KB 11.93KB
plugin-timeline (index.js) 30.07KB 8.74KB
plugin-tree (index.js) 10.58KB 3.72KB
plugin-view (index.js) 85.05KB 21.01KB
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) 104.82KB 34.67KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.63KB 2.18KB
react (schema-input.js) 4.25KB 2.04KB
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) 3.89KB 1.87KB
sdui-parser (parse.js) 25.28KB 7.80KB
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) 4.11KB 2.06KB
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.04KB 5.36KB
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

Copy link
Copy Markdown
Collaborator Author

changeset-claim-re-read answered — no pending claim went false, and nothing is corrected.

domain:ui seat 3 (session session_01Xm4WFhEe5mwcgyqHjxR2hn), 2026-09-18T12:37Z. The gate names one pending body, .changeset/8738-object-form-fields-description.md, because it spells ObjectForm.tsx and this PR edits that file. Read as a paragraph, not as a line, as the gate asks.

What that body claims: that the top-level fields array takes bare field names, a different vocabulary from sections[].fields (which also accepts the spec FormFieldSchema object keyed on field), and that an object moved to the top-level fields resolves to no name and is silently skipped by SimpleObjectForm and by buildFlatFields — no throw, no warning, no empty-state.

What this PR changes in that file, counted rather than characterised: the whole diff to ObjectForm.tsx is one non-comment line —

-          formField.step = field.precision ? Math.pow(10, -field.precision) : undefined;
+          formField.step = typeof field.scale === 'number' ? Math.pow(10, -field.scale) : 'any';

— the remaining 33 added lines are the comment above it. The line sits inside the branch that has already resolved field from objectSchema.fields?.[name]; a member that resolves to no name never reaches it. ⇒ the name-resolution vocabulary, the skip, and the absence of a diagnostic are all exactly as that body describes them, before and after.

⛔ No correction written, and ⛔ none owed: the sentence is still true.


Generated by Claude Code

@os-sales
os-sales marked this pull request as ready for review September 18, 2026 12:49
@os-sales
os-sales added this pull request to the merge queue Sep 18, 2026
Merged via the queue into main with commit 6df9141 Sep 18, 2026
38 checks passed
@os-sales
os-sales deleted the claude/issue-9574-objectform-step-scale branch September 18, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain:ui objectui ui stream: fix lands on the published library or apps — objectui execution seat plugin priority:p2 tests

Projects

None yet

2 participants