Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

refactor(types): bind WidgetInput.type to the shared arm vocabulary, and record the two divergences left unrepaired - #5906

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-5675-widget-input-vocabulary
Aug 23, 2026
Merged

os-zhuang merged 1 commit into
mainfrom
claude/issue-5675-widget-input-vocabulary

Conversation

@claude

@claude claude Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #5675

One mechanical convergence, pinned. Two design divergences recorded and raised as questions, not changed — the card explicitly declined to pre-judge them, and the triage ruling on it narrowed the scope to exactly this split.

Verified at f2d6a27d5 (the final commit; every result below was produced on that tree).


1. The member-equality measurement — done FIRST, because it decided whether this was mechanical at all

If WidgetInput's eleven inline literals had differed from ComponentInputControlType in either direction, this would have been a behaviour question — silently widening or narrowing what a widget may declare — and would have been reported instead of implemented. Measured by parsing both declarations out of source rather than by eye:

WidgetInput.type     (11): string number boolean enum array object color date code file slot
ComponentInputControlType (11): string number boolean enum array object color date code file slot
ComponentInputControlTypeSchema, the enforced half (11): identical

SET  widget - base : []
SET  base - widget : []
MEMBER-EQUAL      : True
ORDER-SENSITIVE equal : True

Equal in both directions, and in the same order. So the change is a pure convergence: no value a widget author may write changes.

type stays the single-kind form. ComponentInput.type additionally accepts an array of arms for a union-typed key (#3832); importing that capability here would be a widening rather than a convergence, so it was deliberately left out — the same disposition #4972 recorded when it left this face alone. A test asserts the restraint, so granting it later is a decision someone makes rather than a line that drifts in.

2. What the convergence buys — one drift direction was silent

WidgetRegistry.load() in @object-ui/core translates each WidgetInput into a ComponentInput and passes type straight through:

inputs: manifest.inputs?.map((input) => ({
  name: input.name,
  type: input.type,
  ...
  enum: input.options,

That assignment is genuinely type-checked (meta?: ComponentMeta, inputs?: ComponentInput[]) — measured below, not assumed. Before this change it compiled only because two independently maintained lists happened to agree. And the two drift directions were asymmetric: an arm removed from the shared vocabulary breaks the assignment loudly, while an arm added to it produced no error anywhere — widget authoring would simply have stayed narrower than component registration, with nothing in the tree saying so. After this change neither direction is expressible.

3. The identity pin, and why the value assertions are not it

A TS type alias erases at runtime, so a member-identical restatement is indistinguishable from the derived type by any assignability or runtime check — the trap spec-derived-unions.test.ts records one file over. Every value assertion in the new suite passes just as green on the defect as on the fix. So the pin is source-text: WidgetInput.type is spelled exactly ComponentInputControlType, the name is imported from ./base.js, no local alias of the vocabulary is declared, and no arm literal is written anywhere in the module's code (comments stripped first, so the scan reads code and not the doc block that discusses the vocabulary).

The member-identical ablation — the contrast IS the evidence

Two legs, each mutated, confirmed on disk by grepping the injected and the removed text (never an editor exit code), each direction predicted before running, each restored by an EXIT INT TERM trap with git diff HEAD --stat verified empty afterwards.

leg mutation vitest tsc -p tsconfig.test.json
A — adversarial a private type WidgetInputControlType = <the same 11 members> in widget.ts, type: pointed at it 4 failed | 8 passed exit 0 — GREEN
B — real relapse the eleven literals inline again, i.e. exactly origin/main's shape 3 failed | 9 passed exit 0 — GREEN
restored — 12 passed exit 0

The four that fail in leg A are precisely the identity pins:

× is spelled exactly `ComponentInputControlType`
× imports that name from the module that declares it
× declares no local alias of the vocabulary
× writes no arm literal anywhere in the module code

Leg B fails three of those (it declares no alias, so that one correctly stays green). Every value, seam and doc assertion stayed green in both legs, and type-check stayed green in both — a member-identical restatement is completely invisible to tsc. That is the whole point: a value-only suite passes on the defect, and a type-only gauge cannot see it either.

No rebuild leg applies to these two: the suite reads widget.ts off disk with readFileSync and imports its siblings by relative source path, and packages/types/tsconfig.test.json sets "paths": {} so tsc resolves them relatively too. No dist/ is anywhere in that resolution path. The mutations turning the pins red is itself the proof that the mutated source is what ran.

Calibrating the seam gauge — the first attempt was a false green, and it is reported as one

To show the WidgetRegistry assignment is really type-checked, a probe arm (ComponentInputControlType | 'OS5675_SEAM_PROBE') was added to WidgetInput.type and @object-ui/core's type-check run. Predicted red.

First run came back exit 0 — green. Not because the seam is untyped, but because @object-ui/core resolves @object-ui/types through dist/, and dist/ had not been rebuilt. That is the classic no-rebuild false green, and it is recorded here rather than quietly re-run: the initial reading was wrong, and the reason a reader should distrust it is the reason itself.

Re-run with the rebuild — mutation confirmed in source, then confirmed to have reached dist/widget.d.ts before the measurement was read:

dist: probe present (expect 1)     : 1
208:    type: ComponentInputControlType | 'OS5675_SEAM_PROBE';

core type-check exit: 2
src/registry/WidgetRegistry.ts(175,11): error TS2322: Type '{ name: string;
  type: ComponentInputControlType | "OS5675_SEAM_PROBE"; ... }[] | undefined'
  is not assignable to type 'ComponentInput[] | undefined'.

So the seam is live and the "loud direction" claim is measured, not asserted: widening WidgetInput by one arm is type-equivalent to the shared vocabulary losing an arm WidgetInput retains, which is exactly that direction. The silent direction follows from assignability — a narrower union is assignable to a wider one — and the pre-change tree was its standing demonstration.

The restore leg rebuilt dist/ too, and is verified byte-exact against the pre-probe build (f4d02d6c…), so no probe survived into any later measurement.

4. Published surface — the emitted .d.ts, before and after

WidgetInput is published, so the surface change is shown rather than inferred.

dist/widget.d.ts   eb9beb7a…  ->  f4d02d6c…     CHANGED
dist/index.d.ts    02ad8ce7…  ->  02ad8ce7…     byte-identical
+import type { ComponentInputControlType } from './base.js';
 export interface WidgetInput {
     name: string;
-    /** Input field type */
-    type: 'string' | 'number' | 'boolean' | 'enum' | 'array' | 'object' | 'color' | 'date' | 'code' | 'file' | 'slot';
+    type: ComponentInputControlType;

Gauge calibration: the gauge registered a difference on this very change, and again on the seam probe, so it is demonstrably not a dead instrument. The index.d.ts byte-identical reading must not be read as "no published change" — it names WidgetInput as a re-export specifier but carries none of its shape, which is the same control #4972 recorded for @object-ui/core's barrel. Exactly one emitted declaration changed.


The two divergences this PR deliberately did NOT change — raised as questions

Both are now recorded in WidgetInput's own doc block, so they stop living only in a closed card's body, and the doc block's load-bearing sentences are pinned (a doc block is the entire deliverable for this half, and nothing else would notice it being deleted).

Q1. options here vs enum on ComponentInput — rename, or document the split?

One concept, two names, one package. It is adapted, not broken: WidgetRegistry.load() maps enum: input.options at the seam, and sdui-parser's serializer reads enum downstream. So nothing fails to arrive; the cost is a hand-written rename every reader of both faces must know about, and that a future key added to either side can forget.

Recommendation: A for this PR, B as a deprecate-then-delete card if the merge question is ever answered "yes". B is right on naming and wrong on mandate — this card had none for a surface change, and a rename with no measured pull is exactly the scope bar the triage ruling applied.

Q2. The five keys ComponentInput carries that this face does not — add, or leave?

inputType, min, max, step, placeholder (thirteen keys against eight; options/enum accounts for the other direction). They are not lost in translation — they are unwritable from a widget manifest to begin with.

Measured before leaving them out, and this is the part that changes the answer: no reader in this repository consumes any of the five on ComponentInput either, and sdui-parser's serializer forwards six keys (name, type, required, enum, binding, description) and none of these. So adding them here would mirror surface that nothing reads on the face it already lives on.

Recommendation: leave them out. Adding inert keys to a second published face is the opposite of the convergence this card is about. The prior question is what to do about them on ComponentInput, which is a different surface and out of this card's fence — filed separately as #5905 for triage.


Verification

Union run after the final commit, at f2d6a27d5. Heavy legs went through the shared verify lock; exit codes captured before any pipe.

vitest widget-input-control-vocabulary + WidgetRegistry   35 passed (2 files)
pnpm --filter @object-ui/types type-check                 exit 0
  > tsc --noEmit && tsc -p tsconfig.examples.json && tsc -p tsconfig.test.json
pnpm --filter @object-ui/core  type-check                 exit 0
  > tsc --noEmit && tsc -p tsconfig.test.json

Gates, each quoting its own printed verdict line:

check-changeset-presence   exit 0  ✅ 2 source file(s) of 1 released package(s) changed, and this
                                      change declares 1 changeset(s)
check-changeset-no-major   exit 0  ✅ No changeset declares a `major` bump.
check-changeset-fixed      exit 0  ✅ All workspace packages are in the changeset fixed group.
check-control-bytes        exit 0  ✅ OK (scanned 4910 tracked text file(s); skipped 85 binary)
check-spec-symbol-derivation exit 0 ✅ 1300 files scanned against 4959 spec export names
check-type-check-coverage  exit 0  ✅ test type-check coverage: 41/41 packages compile their tests
check-lint-coverage        exit 0  ✅ lint coverage: 46/46 packages linted
check-package-self-import  exit 0  ✅ No package names itself inside its own src/.

Two of these are reported with the coverage they actually have, not the coverage they look like they have:

Lint — a declared narrowing, with its three measurements. Run scoped to the affected package rather than the repo:

  1. Population read from eslint's own config, not from a guess about which files count: eslint resolved and linted 111 files in packages/types.
  2. Count read from --format json: 111 files, 0 errors under the invocation CI actually uses (turbo run lint → eslint .; --no-inline-config appears nowhere in CI). Both touched files are in the population, each errors=0 warnings=0.
  3. Invariance for untouched files: eslint.config.js declares no type-aware program — projectService, parserOptions.project and project: are all absent (grep count 0) — so no file's lint verdict depends on another file's types, and editing widget.ts cannot move the verdict of any file that did not itself change.

With all three, the narrowing is a measurement rather than a skipped run. (For completeness: a stricter --no-inline-config pass surfaces 4 pre-existing no-restricted-imports errors in four files that carry sanctioned inline disables — none of them touched here, and not an invocation CI performs.)

Scope

Touched: packages/types/src/widget.ts, one new test, one changeset. ComponentInput was not touched. plugin-scope.ts was not touched — #5674's stage-1 deprecation landed there and stage 2 is tracked by #5892; neither is addressed here.

⚠️ One conflict between the dispatch and the fence, surfaced rather than silently resolved: the dispatch asked for "a comment on both declarations naming the other", and also fenced ComponentInput as do-not-touch. The fence won — the divergence note lives on WidgetInput only, which is also what the triage ruling on the card specified. ComponentInput therefore still has no pointer back at this face; if a note there is wanted, it needs a separate change.

Left draft deliberately: this is a published-surface change and the two questions above want a PM answer before it moves.


Generated by Claude Code

`WidgetInput.type` restated the eleven control-kind literals inline, making it
the third site spelling one vocabulary — after objectui#3832 named it and
objectui#4972 converged the last structural copy of `ComponentInput` onto a
single declaration. It now uses `ComponentInputControlType`.

The restatement was measured member-equal to the shared declaration in both
directions before replacement, so no value a widget author may write changes.
The single-kind form is kept: `ComponentInput.type` also accepts an array of
arms, and importing that capability would be a widening rather than a
convergence.

The pin is source-text, because a TS alias erases at runtime and a
member-identical restatement passes every assignability and runtime check. The
value assertions are kept alongside it and are the ones that stay green on the
defect.

The `options`/`enum` spelling difference and the five keys `ComponentInput`
carries that this face does not are deliberately left alone, and recorded in
`WidgetInput`'s doc block so they stop living only in a closed card's body.

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

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 52 chunks) 3230.3 KB 3990.2 KB
Main entry chunk (gzip) 153.6 KB 350 KB
Entry file index-DR8LDBsX.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) 10.13KB 3.77KB
app-shell (runtime-config.js) 13.57KB 4.78KB
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) 5.13KB 2.35KB
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) 504.16KB 114.08KB
core (index.js) 4.92KB 1.97KB
create-plugin (index.js) 10.08KB 3.26KB
data-objectstack (index.js) 164.55KB 45.67KB
fields (index.js) 238.40KB 59.89KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (currency.js) 1.22KB 0.64KB
i18n (i18n.js) 4.28KB 1.75KB
i18n (index.js) 3.44KB 1.39KB
i18n (pickLocalized.js) 7.62KB 3.26KB
i18n (provider.js) 23.13KB 7.63KB
i18n (useDisplayLocale.js) 2.85KB 1.45KB
i18n (useObjectLabel.js) 33.40KB 8.71KB
i18n (useSafeTranslation.js) 7.77KB 3.13KB
layout (index.js) 38.95KB 10.97KB
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.55KB 0.62KB
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 (useResponsiveConfig.js) 1.37KB 0.63KB
mobile (useSpecGesture.js) 4.32KB 1.64KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 9.53KB 3.38KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 4.64KB 1.50KB
permissions (evaluator.js) 5.12KB 1.74KB
permissions (index.js) 0.93KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.53KB
permissions (usePermissions.js) 1.93KB 0.88KB
plugin-ai (index.js) 15.75KB 3.80KB
plugin-calendar (index.js) 46.62KB 12.83KB
plugin-charts (index.js) 64.66KB 18.32KB
plugin-chatbot (index.js) 187.32KB 44.31KB
plugin-dashboard (index.js) 133.32KB 34.42KB
plugin-designer (index.js) 212.30KB 42.80KB
plugin-detail (index.js) 244.01KB 61.72KB
plugin-editor (index.js) 2.46KB 1.10KB
plugin-form (index.js) 125.63KB 30.64KB
plugin-gantt (index.js) 164.15KB 39.88KB
plugin-grid (index.js) 200.79KB 54.26KB
plugin-kanban (index.js) 52.93KB 14.60KB
plugin-list (index.js) 111.80KB 27.20KB
plugin-map (index.js) 20.06KB 6.62KB
plugin-markdown (index.js) 13.72KB 4.69KB
plugin-report (index.js) 43.49KB 11.93KB
plugin-timeline (index.js) 26.49KB 7.59KB
plugin-tree (index.js) 8.50KB 2.88KB
plugin-view (index.js) 84.57KB 20.74KB
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) 3.77KB 1.33KB
react (SchemaRenderer.js) 52.40KB 17.45KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 1.33KB 0.69KB
react (schema-input.js) 2.32KB 1.24KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 5.41KB 2.34KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 4.93KB 2.24KB
sdui-parser (input-type.js) 2.84KB 1.40KB
sdui-parser (parse.js) 12.13KB 3.65KB
sdui-parser (provenance.js) 3.66KB 1.82KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 7.54KB 2.63KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 0.99KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 0.20KB 0.18KB
types (crud.js) 0.20KB 0.18KB
types (dashboard-filter-alias.js) 6.23KB 2.74KB
types (data-display.js) 0.20KB 0.18KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.87KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
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 (index.js) 3.88KB 1.85KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 2.59KB 1.31KB
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 (spec-report.js) 5.05KB 1.93KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 6.28KB 2.87KB
types (ui-action.js) 3.40KB 1.71KB
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-zhuang
os-zhuang marked this pull request as ready for review August 23, 2026 19:43
@os-zhuang
os-zhuang added this pull request to the merge queue Aug 23, 2026
Merged via the queue into main with commit 1170ed1 Aug 23, 2026
22 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-5675-widget-input-vocabulary branch August 23, 2026 19:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[finding] WidgetInput restates the input vocabulary a third time, and the deferral tracking it is about to be closed with #4972

2 participants