Skip to content

finding(react): SchemaRendererProvider's dataSource prop and SchemaRendererContextType are typed any — a string passed where the host adapter belongs raises nothing #7912

Description

@claude

Found while covering packages/react/README.md for #5174 (batch 12, PR #7910). Filed unassigned and NOT fixed there — that card is scoped to the doc-snippet ledger, and this is a shipped type surface.

What

SchemaRendererProvider is the seam every ObjectUI app uses to inject its data source, and the prop that carries it is typed any on both sides — the provider's own props and the context type the whole tree reads back:

packages/react/src/context/SchemaRendererContext.tsx:13
  dataSource: any;          // SchemaRendererContextType

packages/react/src/context/SchemaRendererContext.tsx:31
  dataSource: any;          // SchemaRendererProvider's props

The built artifact carries the any straight through (packages/react/dist/context/SchemaRendererContext.d.ts:11 and :20), so no consumer can be told anything about it.

The shape is not unknown. @object-ui/types exports DataSource<T = any> (packages/types/src/data.ts, export interface DataSource), packages/app-shell/README.md already writes declare const myDataSource: DataSource; against exactly this seam, and useSettledSchema in this same package declares its parameter as DataSource<any> | null | undefined. So the type is known, published and already used one hop away — it is simply not declared here.

Measured

Probe planted on the SchemaRendererProvider example in packages/react/README.md, run under check:doc-snippets at c97bd02cb, direction predicted GREEN in writing before the run:

dataSource={adapter}   ->   dataSource={'not-an-adapter'}

Result: exit 0, zero diagnostics. A bare string passed where the host's adapter belongs raises nothing — in a block that is now compiled, --strict, against the built types. Handing this prop a string is not a hypothetical mistake: it is the shape of a config value read from the wrong place, and it fails at runtime on the first find().

The batch-12 PR states this as the published bound of that document's new coverage rather than letting the green imply more than it checks.

Why it matters here specifically

This is the same defect class as #7483 (ObjectView's props surface typed any in @object-ui/app-shell), on a different and arguably more central surface: ObjectView is one route-level view, whereas SchemaRendererProvider is the injection point for the entire renderer tree, and useSchemaContext() hands the any to every consumer that reads it back. An AI author writing a host integration gets no signal at all from the compiler about what belongs on this key.

Contract-first (AGENTS.md #0.1, #6 "type safety over magic") points one way here: declare the published DataSource contract at the seam rather than widening consumers around it.

Not done here, on purpose

Narrowing dataSource: any to DataSource is a public-contract change on @object-ui/react, and it will red every internal caller that passes an adapter this repo has not typed. That is a scoped piece of work with its own blast radius, not a rider on a documentation-ledger batch. The measurement is recorded; the decision is not taken.


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdomain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatfindingneeds-user-decisionpriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions