This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
fix(react,cli): name the case-only spelling an unknown component type missed - #6116
Merged
Merged
Conversation
…e missed Registry lookup stays exactly case-sensitive: a node typed `Page` still misses a registered `page`, still fails, and still renders the OBJUI-001 panel. What changes is only what the two surfaces that report the miss SAY. `SchemaRenderer`'s panel now reads `Unknown component type: Page — did you mean 'page'?`, and `objectui check` reports `Unknown schema type "Page" in <file> — did you mean "page"?`. Neither says anything extra when no known type differs by case alone, and neither reaches for an edit distance. Each surface reads its candidates from the set it can trust — the renderer from the live `ComponentRegistry.getKnownTypes()` (loaded registrations plus pending lazy stubs), the CLI from the registration-derived `KNOWN_SCHEMA_TYPES` snapshot. They cannot share one implementation because they cannot share a candidate set; the reasoning is recorded in both files. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CSoz9uGhaaSgiq3hshtN7L
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 #5247
Implements the maintainer ruling of 2026-08-19 — Option C: keep lookup strict, make the failure teach. Registry lookup stays exactly case-sensitive. A node typed
Pagestill misses a registeredpage, still fails, and still renders the OBJUI-001 panel; only the message changes. Normalising the lookup (option B) is not implemented and is not implementable from this diff — nothing here resolves a mis-cased type.What changed, per surface
packages/react/src/SchemaRenderer.tsx(the registry-lookup-miss branch)Unknown component type: Page — did you mean 'page'?objectui checkpackages/cli/src/commands/check.ts(the single unknown-type warning)⚠️ Unknown schema type "Page" in a.json — did you mean "page"?Quoting follows each surface's own existing convention (the CLI warning already spells the offending type as
"Page"), so each line agrees with itself. The clause itself is identical on both sides and each side pins it in its own test.Verified against the built binary, not just the source:
Candidate sets, and why the two surfaces do not share one implementation
Each surface reads its candidates from the set it can actually trust, never from a list typed alongside it:
ComponentRegistry.getKnownTypes(), loaded registrations plus pendingregisterLazystubs;KNOWN_SCHEMA_TYPES, the snapshot derived from this repository's registration calls byscripts/regenerate-known-schema-types.mjsand pinned byscripts/__tests__/known-schema-types-derivation-5115.test.ts(objectui#5115 / PR fix(cli): objectui check 的 knownTypes 改由注册表推导,消灭手写副本的双向漂移 #5128). It is reused, not re-forked.They cannot share one implementation because they cannot share a candidate set. The published CLI runs inside a user's project and depends on neither
@object-ui/corenor the plugin packages that register most component types — the header ofscripts/regenerate-known-schema-types.mjsrecords the measurement (eleven of the fifteen real types in the old hand-written list are registered by packages the CLI does not depend on) and the reason a runtime registry lookup would answer the wrong question there anyway. The only module both packages could import is@object-ui/react, and putting a helper in its public surface would mint a new published export, which this card's dispatch classifies as out of scope. So each side keeps a short unexported helper, cross-referenced in both files' headers, with the wording pinned behaviourally on both sides.Scope held
pgesuggests nothing — no edit distance, no Levenshtein. Pinned on both surfaces.zzzgains no bogus suggestion. Pinned on both surfaces, in the same runs as the positive cases.The real emit point, established by counter-probe
The OBJUI-001 text is assembled in two candidate places, so it was measured rather than assumed. Mutating
ERROR_CODES['OBJUI-001'].messageinpackages/core/src/errors/index.tsto a marker left the panel byte-identical — that template is dead for the panel (andcreateError('OBJUI-001', …), its only route, has no call site outsidepackages/core/src/errors/__tests__/errors.test.ts). MutatingERROR_CODES['OBJUI-001'].suggestiondid reach the panel, which is the dev-only static hint line it reads. So the sentence is assembled inline inSchemaRenderer.tsx, and that is where the suggestion was added.packages/plugin-report/src/LegacyReportRenderer.tsxprints its own "Unknown component type" string for an unresolved chart type; that is a plugin-local fallback, not the registry-lookup-miss path, and is untouched.Which assertions would still pass on a revert
Stated explicitly, because half of them would:
role="alert"panel is present", "Pageis still reported unknown", and both no-matchnot.toContain('did you mean')legs. The first group is the anti-option-B guard; the second is the counter-probe against a clause that fires unconditionally, which is only meaningful in the same run as a positive case.did you meanassertion. Demonstrated, not asserted: ablating the renderer helper turned exactly the 2 renderer clause cases red (11 others green); ablating the CLI clause turned exactly the 3 CLI clause cases red (10 others green). Both matched the prediction written before the run, and both mutations were proved on disk (injected marker located, removed line separately confirmed absent) and restored undertrap … EXIT INT TERM.One phantom instrument was self-caught along the way: the first counter-probe reported its verdict from a
console.logvitest never surfaced, so it returned "marker did not reach the panel" in the baseline too — the same answer in both states of the world. It was replaced with a probe that writes the panel text to disk and a baseline self-check on a control string present in both versions of the file.Gates (all on
8537adb1c, the final commit)pnpm turbo run type-check --filter=@object-ui/react --filter=@object-ui/cli --force0 cached, 11 totalpnpm --workspace-concurrency=4 --filter '...@object-ui/react' --filter '...@object-ui/cli' run type-checkScope: 33 of 47, 32 realtsc --noEmitruns, no turbo cachepnpm exec vitest run <the two new files>pnpm exec vitest run packages/cli/src/__tests__ packages/react/src/__tests__ packages/core/src/errors/__tests__ scripts/__tests__/known-schema-types-derivation-5115.test.ts scripts/__tests__/check-doc-component-types.test.tspnpm exec eslint <5 changed .ts/.tsx>no-explicit-anywarnings, none on a changed linepnpm turbo run lint --filter=@object-ui/react --filter=@object-ui/cli --force0 cached, 3 total, 0 errorspnpm --filter '@object-ui/cli...' buildthenpnpm check✓ All checks passedon this repositorynode scripts/check-changeset-presence.mjsnode scripts/check-control-bytes.mjsnode scripts/regenerate-known-schema-types.mjs --checknode scripts/check-lint-coverage.mjs,node scripts/check-type-check-coverage.mjsThe downstream filter direction was demonstrated rather than asserted: the prefix form
...@object-ui/reactselects 33 packages (consumers, includingapps/**andexamples/**), the suffix form@object-ui/react...selects 5 (upstream dependencies) — opposite directions.Changeset:
patchfor@object-ui/reactand@object-ui/cli— a message improves; no type moves.Serial fence
None of the six files touched here is held by #5373:
packages/react/src/SchemaRenderer.tsx,packages/cli/src/commands/check.ts,packages/cli/src/utils/known-type-case-suggestion.ts(new), the two new test files, and the changeset. The one adjacency worth naming is that #5373 holdspackages/cli/src/__tests__/check-known-types.test.ts, which exercises thecheck.tsline this PR edits — that test was not modified and passes in the sweep above. Nothing underplugin-grid,plugin-detail,app-shellorpackages/typeswas touched.Generated by Claude Code