This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
feat(sdui): guard the public contract against silent drift (follow-up to #2953) - #2979
Merged
Merged
Conversation
… to #2953) objectui#2953 — every lazily-registered public block missing from the contract, and so from every kind:'react' page's scope — survived because nothing compared `PUBLIC_BLOCKS` against what an app actually registers. Type-check, lint, build and the whole suite stayed green while seven curated blocks were unusable. Two guards close that class of bug. Console ↔ contract coverage. `apps/console/src/register-plugins.ts` extracts the plugin registration out of `main.tsx` so it can be imported without booting the app (which mounts React, resolves runtime config and inits Sentry). The new `apps/console/src/__tests__/public-contract.test.ts` reads that real list — a hand-copied one would reproduce the original failure by agreeing with itself — and pins as EXACT lists which curated tags the console exposes (35), which are still unimplemented (line_items), and which reach the contract through a pending lazy stub. Exact rather than `toContain`, because the failure mode is a shrinking contract. Reverting the #2953 fix drops coverage 35 -> 28 and fails all four assertions. Manifests must be generated from loaded registrations. New exported `assertFullyLoaded(configs)` in @object-ui/sdui-parser, plus `lazy?: boolean` on `RegistryConfigLike`. A lazy stub carries metadata but no `inputs`, so it would be written into sdui.manifest.json as a block that takes no props — making every prop an author passes it an `unknown-prop` diagnostic in the save gate, wrong quietly, in the artifact everything downstream trusts. `gen-manifest.ts` now throws instead, and `dev/manifest-dump.tsx` also imports the console's real registration list, so a plugin the console lazy-registers but the dump forgets to import eagerly is caught rather than silently emitted propless. Eager registration wins over a stub, so the manifest output itself is unchanged. `scripts/dump-public-manifest.mjs` surfaces that failure instead of timing out for 120s with no message. Also records `object-chart` as a seventh block affected by #2953 — the issue listed six. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4mrr1ihhwnfEHFSWmGoMp
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-zhuang
marked this pull request as ready for review
July 30, 2026 05:24
os-zhuang
added a commit
that referenced
this pull request
Jul 30, 2026
…ecovers when one registers late (#2988) #2953 had a twin one tier over, unreported. The whitelist a kind:'html' page's source compiles against was built from getAllTypes() + getConfig() — both loaded-only — so any block registered via registerLazy() was rejected as "not an allowed component". Worse blast radius than the react tier: a compile diagnostic fails the WHOLE page, so a single <object-kanban> replaced everything with "HTML page failed to compile (2)". And it never recovered — layoutElement was memoised on [schema, pageType] with no registry signal, so the cached error panel outlived the plugin landing. Measured with a probe, not inferred. ComponentRegistry gains three lazy-aware reads: getKnownTypes() (loaded plus pending stubs — the set a whitelist or manifest should be built from), getMeta() (metadata through to a stub), and getVersion() (monotonic counter of changes to the known set; the previous cache key was the type COUNT, which one registration plus one unregistration leaves untouched). getAllTypes() and getConfig() keep their loaded-only meaning and now document it. getJsxManifest() builds from those; PageRenderer subscribes to the registry so a page that could not compile retries when the registry grows. A stub has no `inputs` yet, so its props surface as unknown-prop warnings rather than errors — the page compiles and the inner SchemaRenderer swaps in the real block. The runtime whitelist being permissive and the build-time artifact being strict (assertFullyLoaded, #2979) is deliberate: authoring-time prop validation keeps its full inputs. Tests include a negative control — a tag nothing registered is still rejected, since that whitelist is what keeps a parsed page from rendering arbitrary tags.
os-zhuang
added a commit
that referenced
this pull request
Jul 30, 2026
… actually resolves (#3006) PUBLIC_BLOCKS carried `line_items` — the bare tag. @object-ui/plugin-form registers the block as `record:line_items` with `skipFallback: true`, which exists precisely so the bare name is NOT claimed, so that key never existed and the curated entry could never resolve. Its four siblings in the list are all `record:`-prefixed and plugin-form's own comment says "Register record:line_items"; the bare spelling was a slip. The effect was a block that has shipped all along — a full renderer, a label, five declared inputs — being absent from the public contract, from the JSX type surface, from the generated manifest, and from every kind:'react' page's scope. It read as an unimplemented aspirational entry, which is how it was recorded when #2979 added the contract-coverage guard. With the tag corrected the contract has no gaps left: all 36 curated tags resolve in the console, record:line_items among them with its full inputs. The guard's known-unimplemented list is now empty and stays asserted, so the next entry that cannot resolve surfaces instead of being explained away. Claude-Session: https://claude.ai/code/session_01N4mrr1ihhwnfEHFSWmGoMp Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Oct 17, 2026
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.
Follow-up to #2953 (merged in #2976). No behaviour change — two guards against the class of bug that one was.
Why
#2953 survived because nothing compared
PUBLIC_BLOCKSagainst what an app actually registers. Type-check, lint, build and the whole suite stayed green while seven curated blocks were unusable in everykind:'react'page. Both guards below fail loudly on exactly that.(Seven, not six — the issue listed
object-kanban,object-calendar,object-gantt,object-timeline,object-map,markdown. Building the coverage test surfacedobject-chartas an eighth… seventh. It is now recorded.)1. Console ↔ contract coverage
apps/console/src/register-plugins.tsextracts the plugin registration out ofmain.tsxso it can be imported without booting the app (which mounts React, resolves runtime config and inits Sentry).main.tsxnow justimport './register-plugins'where the block was;registerPlaceholders()still runs after it, inmain.tsx, since it must only fill gaps left by real registrations.apps/console/src/__tests__/public-contract.test.tsreads that real list — a hand-copied one here would reproduce the original failure by agreeing with itself — and pins, as exact lists:line_items), so an advertised-but-absent tag is a listed, reviewable gap rather than a silent one;lazy: trueand nocomponent.Exact lists rather than
toContain, because the failure mode is a shrinking contract:toContainsails right past a block that silently disappeared.Verified meaningful: patching
getContractConfigback to loaded-only drops coverage from 35 to 28 and fails all four assertions.The coverage assertion pins availability, not tier deliberately: whether a block is eager or lazy is a bundling decision that varies by host (and by test setup — the shared DOM setup imports
plugin-dashboard, sodashboard/object-metric/object-pivotarrive loaded here though they are lazy in the real console). "The author can write this tag" must not vary.2. Manifests must be generated from loaded registrations
New exported
assertFullyLoaded(configs)in@object-ui/sdui-parser, pluslazy?: booleanonRegistryConfigLike.A lazy stub carries metadata but no
inputs. Written intosdui.manifest.jsonit becomes a block that takes no props — so every prop an author passes it turns into anunknown-propdiagnostic in the save gate. Wrong quietly, in the artifact everything downstream trusts. The test pins that shape explicitly before asserting the throw:packages/sdui-parser/scripts/gen-manifest.tscalls it, and its doc comment no longer points at@object-ui/console/register-all(never a real export path).apps/console/dev/manifest-dump.tsxcalls it and imports the console's real registration list. Its 15 hand-maintained eager imports had no relationship to what the console ships; now a plugin the console lazy-registers but the dump forgets to import eagerly survives as a stub and fails the build. Eager registration wins over a stub, so the manifest output itself is unchanged — this only makes the drift detectable.scripts/dump-public-manifest.mjswaits for__MANIFEST ?? __MANIFEST_ERRORand rethrows the message, instead of turning any generation failure into a silent 120s timeout.Verification
696 files passed | 1 skipped,8191 tests passed | 24 skipped.pnpm --filter @object-ui/console build(tsc + vite + plugin): clean.type-checkfor@object-ui/console+@object-ui/sdui-parser: clean.lint: 0 errors.changeset:check: clean. Changeset included (@object-ui/sdui-parserminor — new export;@object-ui/consolepatch).🤖 Generated with Claude Code
https://claude.ai/code/session_01N4mrr1ihhwnfEHFSWmGoMp
Generated by Claude Code