This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit 4f74cd5
fix(console): FormPage degrades an unregistered widget to the type renderer (objectui#10472) (#10553)
Fixes #10472
## What changed
`FormPage`'s `resolveFieldWidgetKey` took an authored `widget` whenever
one was present and returned `resolveFormWidgetType(widget)`. That
resolver answers a spelling nothing registers with the `text` widget, so
a `select` field carrying an unknown `widget` rendered a free-text
input. The spec's `FieldSchema.widget` describe (installed
`@objectstack/spec@17.4.0`, read verbatim; its placeholder is spelled
WIDGET here because GitHub strips angle-bracket fragments): "Form widget
override — names a registered field component (resolved as
`field:WIDGET`) to render this field instead of the `type` default.
Degrades to the `type` renderer when unregistered."
The `widget` leg now runs only when `namesRegisteredWidget(widget)`
holds. Otherwise the row falls through to the arity leg and the `type`
leg of the same resolver.
- Files: `apps/console/src/components/FormPage.tsx` (+44 / -6), new
`apps/console/src/components/FormPage.widgetDegrade-10472.test.tsx`
(+135), new `.changeset/10472-formpage-widget-degrades-to-type.md` (+19,
`@object-ui/console` patch).
- No list of widgets was added. The lookup (H2) is
`resolveFormWidgetType` itself, which is the same call the leg already
made and the resolver whose loaders `getLazyFieldWidget` mounts. It is
read for its documented unknown answer ("anything unknown falls back to
`text`"): a spelling answered with `text` that is not itself `text`
named nothing. A registered key, a retired spelling (its tombstone) and
an alias the resolver knows keep resolving as before.
## Premise check (H1–H4)
- H1 confirmed on `origin/main` `111fa4c`. The widget leg was `if
(field.widget) return resolveFormWidgetType(field.widget);`.
- Before, measured at `111fa4c` with real widgets on `/forms/:name`: `{
type: 'select', options, widget: 'no_such_widget' }` rendered
`INPUT[type=text]`. `{ type: 'boolean', widget: 'no_such_widget' }`
rendered `INPUT[type=text]`.
- After, measured at `735c9ed` with the same probe: the select field
renders `BUTTON[role=combobox]` plus the hidden `SELECT`. The boolean
field renders `BUTTON[role=switch]`. `{ type: 'password', widget:
'no_such_widget' }` renders `INPUT[type=password]`. `{ type: 'select',
multiple: true, widget: 'no_such_widget' }` renders the multiselect
group.
- Controls in the same run: `widget: 'radio'` on a select renders
`radiogroup`. `widget: 'owner'` renders the tombstone. `widget:
'secret'` on a text field renders `INPUT[type=password]`. `widget:
'json'` on a text field renders the code widget's `TEXTAREA`.
- H3, the record form
(`packages/components/src/renderers/form/form.tsx`), was measured with
the dev's probe shape and real widgets after `registerAllFields()`. It
shows the same symptom, and **it is not changed here**. `select` /
`field:select` with `widget: 'no_such_widget'`, and a metadata-carried
`field.widget: 'no_such_widget'`, all render `INPUT[type=text]`.
`field:boolean` with the same widget renders `INPUT[type=text]` too.
- Why form.tsx is a different mechanism: an unregistered spelling there
reaches the ruled "unregistered-widget default" branch (objectui#5322 /
objectui#5375). That branch reads the spelling. Measured at `735c9ed`:
`{ type: 'field:text', widget: 'secret' }` and `{ type: 'field:text',
widget: 'ui:password' }` both render `INPUT[type=password]`.
- A plain degrade-to-type there would hand those rows to the registered
text widget. How the spec's degrade rule composes with that secret
ruling is a decision, so it is reported as a finding, not guessed here.
- A fix in form.tsx would also have to converge three precedence sites:
`resolveWidgetType` (boolean seeding), the cascade-clear effect's own
`widget || type`, and the render `resolvedType`. It would also have to
update the core validator's `resolveAuthoredFieldWidgetId`, which says
it mirrors that precedence.
- H4: the `field:`-qualified spellings are not ones the shared resolver
knows, so after this PR they degrade to the type in `FormPage`. Measured
at `735c9ed`:
- `widget: 'field:owner'` on a `user` field renders the person picker
(`lookup-trigger`), with no refusal. Before this PR it rendered a
working `INPUT[type=text]`, also with no refusal.
- `widget: 'field:textarea'` renders `TEXTAREA` on a `textarea` field
and `INPUT[type=text]` on a `text` field.
- The record form resolves both `field:`-qualified spellings as registry
keys: the tombstone for `field:owner`, and `TEXTAREA` for
`field:textarea` on a text field.
- The bare retired `widget: 'owner'` still reaches the tombstone in
`FormPage`, and that is pinned here. That the tombstone names the row's
live `type` (`data-retired-field-type="user"`) is objectui#10471, left
as is. Whether a `field:`-qualified spelling is authorable on a form
view at all was not measured here (the card lists it as unmeasured).
## Tests (HEAD `735c9ed`, after merging `origin/main`)
- `pnpm exec vitest run
apps/console/src/components/FormPage.widgetDegrade-10472.test.tsx` gave
4 passed (4) on `fb70e86`. The same 4 are inside the directory run
below.
- `pnpm exec vitest run apps/console/src/components/` gave Test Files 31
passed (31), Tests 407 passed (407). VITEST-EXIT=0.
- `pnpm turbo run type-check --filter @object-ui/console
--concurrency=2` gave Tasks 36 successful, 36 total. VERDICT
command-exit 0.
- `tsc --noEmit --listFiles` in `apps/console` lists the new test file
(1 hit). TSC-EXIT=0.
- `pnpm exec eslint` on the two changed source files reported 0 errors
and 20 warnings. All 20 are outside this diff's hunks (react-refresh /
no-explicit-any / set-state-in-effect, already present).
- These gates all exited 0: `check:control-bytes`,
`check:test-path-roots`, `check:vi-mock-specifiers`,
`check:vi-mock-inherit`, `check:vi-mock-override-shape`,
`check:new-line-citations` (0 new), `check:changeset-claims`,
`check:pending-changeset-literals`, `check-changeset-presence.mjs` (1
changeset for 1 released package), `check-changeset-no-major.mjs`,
`check:unreferenced-sources`, `check:comment-mask-corpus`, and
`check-governed-queue-guard.mjs --test` (NOT GOVERNED).
## Ablation (fix committed first, mutated through
`ablation-replace.mjs`, restored to HEAD with an empty `git diff HEAD`)
1. The guard was reverted to `if (field.widget) {`. Result: 2 failed | 2
passed (4). The two degrade pins went red and both controls stayed
green.
2. `namesRegisteredWidget` was made to always answer false. Result: 2
failed | 2 passed (4). The registered-`radio` control and the
retired-`owner` control went red, and the degrade pins stayed green.
## Acceptance notes
- The pending `.changeset/10179-formpage-shared-field-resolver.md` says
"An authored `widget` wins over `type`". After this PR that holds only
for a widget that names something registered. This PR's changeset states
the refinement, and both publish in the same release. That body was not
edited because it is outside the claimed file surface.
- `FormPage` still resolves alias spellings in `widget` (`json` renders
code, `secret` renders password), while the record form treats them as
unregistered (`json` renders `INPUT[type=text]`). Both were measured
above. That difference existed before this PR and is recorded here, not
decided.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01KUxVUa7e39aNjhkKi1gsoy)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 9cbe4db commit 4f74cd5
3 files changed
Lines changed: 198 additions & 6 deletions
File tree
- .changeset
- apps/console/src/components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
621 | 622 | | |
622 | 623 | | |
623 | 624 | | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
624 | 656 | | |
625 | 657 | | |
626 | 658 | | |
627 | 659 | | |
628 | 660 | | |
629 | 661 | | |
630 | | - | |
631 | | - | |
632 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
633 | 669 | | |
634 | 670 | | |
635 | 671 | | |
| |||
646 | 682 | | |
647 | 683 | | |
648 | 684 | | |
649 | | - | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
650 | 688 | | |
651 | 689 | | |
652 | 690 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
0 commit comments