fix(types): AnyComponentSchema prints every category union by name, so its declaration leaves TypeScript's serialization ceiling (objectui#11573) - #11590
Conversation
… lists (objectui#11573) Each of the sixteen category unions composed into `AnyComponentSchema` now has a named exported interface in its own module that extends the union's inferred type and adds no member, so declaration emit prints a reference to it instead of re-serializing every union's body inside `AnyComponentSchema`. The values and the types a consumer reads are unchanged; only the printed `.d.ts` text moves. Claude-Session: https://claude.ai/code/session_01CPvhwGcirXqBGEdPSb72TZ Co-authored-by: Claude <noreply@anthropic.com>
…very member's named/inline status (objectui#11573) Reads the node builder's own counter for `AnyComponentSchema`'s declaration (declaration emit's flags, through `checker.typeToTypeNode`'s run-time `maximumLength` parameter, with a lit control that the parameter is honoured), fails past a tenth of the ceiling below it, enumerates every member as named or inline, and pins with compile-time rows that each named category-union type is its union. Claude-Session: https://claude.ai/code/session_01CPvhwGcirXqBGEdPSb72TZ Co-authored-by: Claude <noreply@anthropic.com>
… (objectui#11573) Claude-Session: https://claude.ai/code/session_01CPvhwGcirXqBGEdPSb72TZ Co-authored-by: Claude <noreply@anthropic.com>
|
changeset-claim-re-read
|
✅ 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
|
Contract reviewServed-tier: Inputs, and nothing else: card objectui#11573 (body; triage 5972917927; claim 5975377899; os-dev-report 5975890312), PR #11590 (body, its 18-file list, the net diff against ① Derived judgmentsAccept set — unchanged. RIGHT.
Public surface — per the package's
The pin (
Card acceptance — met.
Repo rules on the diff — clean.
Gate readings on the head (read at 2026-10-04T02:57Z; each conclusion recorded as read;
② Semver levelClause-②: no — the diff relaxes no accept set (A1–A3) and widens no public surface (P1–P4). The claim declared
③ Boundary flagsDev deviations (os-dev-report 5975890312):
Open questions:
Out-of-scope findings (dev's carriers, confirmed or re-routed):
Implemented-by: VERDICT: PASS Generated by Claude Code |
Fixes #11573
Clause-②: yes
objectstack
mainwas not over the ceiling when this was measured. At objectui BASE7a7660cagainst objectstackmain1a23054,AnyComponentSchema's declaration read 992,625 on TypeScript's own counter (TypeScript 6.0.3). The ceiling is 1,000,000, so the headroom was 7,375 (0.74%), smaller than the card's 9,426. With this PR the declaration reads 12,294, and the reading is the same against both specs.What changed
AnyComponentSchemalists now each have a named type. It is an exported interface in the union's own module. It extends the union's inferred type and adds no member:optionsis restated by reference only because an empty interface is refused by lint. The value is unchanged: the union is bound to a module-privateXSchemaInferredconst, andexport const XSchema: XZodType = XSchemaInferred.LayoutZodType,FormComponentZodType,DataDisplayZodType,FeedbackZodType,DisclosureZodType,OverlayZodType,NavigationZodType,ComplexZodType,ObjectQLComponentZodType,ObjectQLPublicBlockComponentZodType,CRUDComponentZodType,ReportUnionZodType,ViewComponentZodType,AIComponentZodType,DesignerUnionZodType,PublicBlockComponentZodType.ZodTypesuffix followsReportNodeZodType/DrillDownReportZodType, because theXSchemaTypenames in these files arez.inferaliases.AnyComponentSchemainindex.zod.ts, and each union site's docblock points to it. TheRecordLineItemsBlockSchemaTypedocblock inpublic-blocks.zod.tssaid the headroom was "tracked in objectui#11573" and used the present tense for the inline print. It now points to the pin, and the inline print is in the past tense.packages/types/src/__tests__/any-component-emit-headroom-11573.test.ts. It sits besideany-component-union-fanout.test.ts. Nothing in any workflow changed..changeset/11573-any-component-emit-headroom.md, apatchfor@object-ui/types.The printed
.d.tstext of existing exports changes; the types do notAnyComponentSchema's declaration indist/zod/index.zod.d.tsused to spell out every union inline. It now printsimport("./layout.zod.js").LayoutZodTypeand its siblings. The sixteen unions' own declarations now readexport declare const LayoutSchema: LayoutZodType;, and the union's body is printed once, on the privatedeclare const LayoutSchemaInferred.dist/zod/index.zod.d.tswent from 2,300,932 to 1,232,912 bytes.dist/zod/*.d.tstotal went from 4,953,529 to 3,895,071 bytes.node_modules, so they read the samezodand@objectstack/spec.7a7660cdist vs this branch's dist (both built against the installed spec): 56 compile-time rows undertsc --strict, exit 0.AnyComponentSchemaandStrictAnyComponentSchema:Equalonz.input,Equalonz.output, and mutual assignability of the schema types.Equalon the return types ofvalidateSchemaandsafeValidateSchema.@object-ui/types/zodentry. Declaration emit can reference a name from another module only if that module exports it. The barrelindex.zod.tsre-exports none of them, so nothing new is importable.Clause-②: yesabove is copied from the claim. The claim expected the names to widen the./zodsurface and said the review would read the answer from the diff. The answer is that the barrel is unchanged.Readings (TypeScript's
approximateLength, worktree TypeScript 6.0.3)@objectstack/specAnyComponentSchema(counter)7a7660c7a7660cmain1a2305447c8c67(named)47c8c67(named)main1a2305447c8c67,DisclosureSchemaalone un-named (ablation)approximateLengthat the end of declaration emit'sserializeTypeForDeclaration, read from an instrumented copy of the worktree'stypescript.jsin scratch. That is the card's own instrument, and nothing from it lands in the tree.main. Before this PR the two specs differed by +12,296 on this declaration, about 1.2% of the ceiling. After it they differ by 0. The spec's shapes are now printed inside the named unions' own declarations, never inAnyComponentSchema's.ObjectQLPublicBlockComponentSchema, 98,183 → 111,269, withObjectGridBlockSchemainside it going 15,011 → 23,219.LayoutSchemawent 281,061 → 280,333.LayoutSchema281,061 ·PublicBlockComponentSchema143,622 ·ObjectQLComponentSchema119,738 ·ObjectQLPublicBlockComponentSchema98,183 ·FormComponentSchema54,759 ·ComplexSchema51,829 ·DataDisplaySchema45,434 ·ReportUnionSchema33,923 ·OverlaySchema31,460 ·ViewComponentSchema23,790 ·DesignerUnionSchema22,461 ·FeedbackSchema18,982 ·NavigationSchema17,300 ·DisclosureSchema9,245 ·AIComponentSchema9,108 ·CRUDComponentSchema7,528.AppComponentSchema9,042 andCloudPlanStatusSchema2,297.AppSchemaRendererNodeSchemaTypeandPageKindNodeSchemaType.PublicBlockComponentSchemais confirmed: 143,622.The pin
It reads the node builder's own counter and does not use a proxy.
checker.typeToTypeNodepasses its run-timemaximumLengthparameter straight through. The parameter is not on the typed public surface. The pin calls it with declaration emit's flags andAnyComponentSchema's type. WithNoTruncationset, the builder reports truncation to the tracker exactly when the counter crosses the stated maximum, which is the comparison TS7056 makes at the ceiling.noTruncationMaximumTruncationLength), not restated.trackSymbolwithtrue, so the builder caches nothing from a probing call.pnpm testresolves.main. That delta was +12,296 before this PR and is 0 after it.maindelta measured, and about 10× the largest arm ever added inline (record:line_items, 9,871). A green pin under the installed spec leaves the gate's compile under the ceiling with room to spare.inline. A new member, a member that loses its name, or a renamed type turns the pin red until it is classified there. A second assertion encodes the rule: a category union prints by name, while arms may stay inline.inline;H3: naming changes print, not type
NamesItsUnion):z.input,z.outputand_zodequal those ofz.ZodDiscriminatedUnionover its own options;AnyComponentSchemacarries (theExtractrow, as inrecord-line-items-arm-10872.test.ts).A & B.true & falseisnever, andneversatisfiesAssert's constraint.3b4f156). ThenDisclosureZodTypegained_zod: DisclosureSchemaInferredType['_zod'] & { input: any }, through the objectstackscripts/ablation-replace.mjs(wrap mode; anchor 1 → 0, blob0833fd7240cc→24c4d1e693f3).tsc --noEmitexit 0. It is invisible to assignability.tsc -p tsconfig.test.jsonrefused exactly the_Disclosurerow: TS2344, exit 2.git checkout HEAD -- PATH: blob == HEAD0833fd7240cc, andgit diff HEADis empty.DisclosureSchema's annotation was dropped, by the same tool and restore. The pin went red, 2 failed / 2 passed. The diff showsDisclosureSchemachanging fromDisclosureZodTypetoinline. The reading moved 12,260 → 21,458.Gates
All exit codes were read before any pipe.
On landing head
f3d1dce(the last commit only adds the changeset):pnpm --filter @object-ui/types build: exit 0, "dist completeness: 1 package(s) complete (146 emitted files verified)"pnpm --filter @object-ui/types type-check: exit 0; this istsc --noEmit, the examples project and the test projectpnpm --filter @object-ui/types test: exit 0, 351 files / 9,424 tests passed; the pin file is included (350 test files at BASE, 351 here)check:readme-exports: exit 0, "563 of them self-imports judged (563 real, 0 wrong-path, 0 fabricated)"check:skill-examples: exit 0check:doc-snippets: exit 0, "777 of 777 block(s) judged, 0 failed"check:doc-examples: exit 0check:published-dist: exit 0check:doc-types: exit 0check:spec-symbols: exit 0check:changeset-claims: exit 0check:pending-changeset-literals: exit 0check:control-bytes: exit 0changeset:check: exit 0check:new-line-citations: exit 0, "0 new citation(s)"check:test-path-roots: exit 0type-check:coverage: exit 0check-changeset-presence: exit 0Consumers, at
3b4f156(src identical tof3d1dce):turbo run type-checkfor@object-ui/core,@object-ui/cliand@object-ui/react: 12/12 tasks successful.turbo run type-checkfor@object-ui/components,@object-ui/plugin-kanban,@object-ui/plugin-tree,@object-ui/plugin-dashboard,@object-ui/plugin-detailand@object-ui/app-shell: 35/35 tasks successful. Every type-check task was a cache miss, so each one really ran.plugin-*consumers of./zodare left to CI. The structural identity check above is why they cannot differ.Spec Main Shape Gate reproduction, narrowed.
@objectstack/specwas built and packed from objectstackmain1a23054in a separate objectstack worktree, then injected withscripts/spec-main-shape-gate.mjs injectinto a separate objectui worktree.TURBO_FORCE=true turbo run type-checkran for core, cli and react, with their build closure, which includes@object-ui/typesbuild (where TS7056 surfaces).7a7660c): 12/12 tasks successful. After (f3d1dce): 12/12 tasks successful.pnpm type-check, and CI runs it on this PR. The injection never touched this branch's install or any commit.Lint, targeted at the 17 changed
.tsfiles:eslint --no-inline-config, 0 errors. There were 3 warnings, allno-explicit-anyon lines this PR does not touch. The fullpnpm lintbelongs to CI.Acceptance notes
validateSchemaandsafeValidateSchemastill print in full. Their inferred return types print the full output union: counter 446,147 / 446,122 on 17.6.0, and 450,694 / 450,669 onmain. Naming the containers does not change that, becausez.outputis computed structurally. That is about 45% of the ceiling, so it is no reach today. It is an observation, not a finding; carrier: none.node_modules, and the gate workflow's header warns about exactly this.TURBO_FORCE=truereproduction runs against the injectedmainspec wrote main-spec build outputs into that cache, keyed on objectui sources at7a7660candf3d1dce.check:doc-snippetswent red on three blocks ofpackages/plugin-grid/README.md(TS2322). After a forced rebuild against the installed spec it read 0 failed.f3d1dcewere overwritten by that forced rebuild. The 23 entries from the reproduction runs, including the ones keyed on7a7660c(mainat dispatch), could not be removed from here: the deletion was refused by this session's permission check. The run's report names them.packages/plugin-grid/README.mdsnippets fail against declarations built from objectstackmain. It is an observation for the 17.7.0 adoption; carrier: objectui#11334.This PR's attribution, written as prose because a footer does not survive an edit: session
https://claude.ai/code/session_01CPvhwGcirXqBGEdPSb72TZ, dispatched by thedomain:spec @ objectuiPM seat.Generated by Claude Code