This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
refactor(types): bind WidgetInput.type to the shared arm vocabulary, and record the two divergences left unrepaired - #5906
Merged
Conversation
`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
Contributor
✅ 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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fromComponentInputControlTypein 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:Equal in both directions, and in the same order. So the change is a pure convergence: no value a widget author may write changes.
typestays the single-kind form.ComponentInput.typeadditionally 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/coretranslates eachWidgetInputinto aComponentInputand passestypestraight through: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.tsrecords 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.typeis spelled exactlyComponentInputControlType, 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 TERMtrap withgit diff HEAD --statverified empty afterwards.tsc -p tsconfig.test.jsontype WidgetInputControlType = <the same 11 members>inwidget.ts,type:pointed at itorigin/main's shapeThe four that fail in leg A are precisely the identity pins:
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-checkstayed green in both — a member-identical restatement is completely invisible totsc. 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.tsoff disk withreadFileSyncand imports its siblings by relative source path, andpackages/types/tsconfig.test.jsonsets"paths": {}sotscresolves them relatively too. Nodist/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
WidgetRegistryassignment is really type-checked, a probe arm (ComponentInputControlType | 'OS5675_SEAM_PROBE') was added toWidgetInput.typeand@object-ui/core'stype-checkrun. Predicted red.First run came back exit 0 — green. Not because the seam is untyped, but because
@object-ui/coreresolves@object-ui/typesthroughdist/, anddist/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.tsbefore the measurement was read:So the seam is live and the "loud direction" claim is measured, not asserted: widening
WidgetInputby one arm is type-equivalent to the shared vocabulary losing an armWidgetInputretains, 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 afterWidgetInputis published, so the surface change is shown rather than inferred.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.tsbyte-identical reading must not be read as "no published change" — it namesWidgetInputas 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.
optionshere vsenumonComponentInput— rename, or document the split?One concept, two names, one package. It is adapted, not broken:
WidgetRegistry.load()mapsenum: input.optionsat the seam, andsdui-parser's serializer readsenumdownstream. 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.WidgetInput.optionstoenum. One vocabulary end to end, adapter line disappears. But it is a published key on a published type, and the in-repo importer count (zero besides the declaration and its re-export) says nothing about external consumers — the same unmeasurable half [finding]PluginComponentInputis a published name with zero consumers, and after #4972 it is a pure alias ofComponentInput#5674 recorded.ComponentInput.enumtooptions. Strictly worse: far more consumers, andenumis what the published manifest already carries.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
ComponentInputcarries that this face does not — add, or leave?inputType,min,max,step,placeholder(thirteen keys against eight;options/enumaccounts 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
ComponentInputeither, andsdui-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.Gates, each quoting its own printed verdict line:
Two of these are reported with the coverage they actually have, not the coverage they look like they have:
check-spec-symbol-derivationis not evidence about this defect. It guards spec-symbol collisions, and finding(tooling): check-spec-symbol-derivation.mjs skips every non-exported declaration, so the #5652 mirrors it was cited to catch were invisible to both rules #5899 measured that it skips non-exported declarations. It was green onorigin/main— i.e. green on the restatement — so citing it as coverage here would be citing a gate that never looked.check-doc-snippet-typesexited 1 and is reported as NOT RUN, not as failing. Its own verdict line says why:The snippet program was NOT run: the packages it resolves against are not built. It needs a full-repo build; this worktree built only the packages under test. It reads no file this PR touches. CI builds the farm.Lint — a declared narrowing, with its three measurements. Run scoped to the affected package rather than the repo:
packages/types.--format json: 111 files, 0 errors under the invocation CI actually uses (turbo run lint→eslint .;--no-inline-configappears nowhere in CI). Both touched files are in the population, eacherrors=0 warnings=0.eslint.config.jsdeclares no type-aware program —projectService,parserOptions.projectandproject:are all absent (grep count 0) — so no file's lint verdict depends on another file's types, and editingwidget.tscannot 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-configpass surfaces 4 pre-existingno-restricted-importserrors 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.ComponentInputwas not touched.plugin-scope.tswas not touched — #5674's stage-1 deprecation landed there and stage 2 is tracked by #5892; neither is addressed here.ComponentInputas do-not-touch. The fence won — the divergence note lives onWidgetInputonly, which is also what the triage ruling on the card specified.ComponentInputtherefore 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