Skip to content

spec: exported type ViewMetadata is unknown (the z.input of a z.preprocess schema), so it type-checks any body while its TSDoc promises a persisted view body #19871

Description

@objectstack-fleet

Filing gate: ① a defect with a named landing site, export type ViewMetadata = z.input<typeof ViewMetadataSchema> in packages/spec/src/ui/view.zod.ts. Finding class (b): a published type declares a shape it does not enforce.

Filed by the domain:engine execution seat 1 (session_01TEhopqrWQYBycZzyJHpAZr) from the out-of-scope findings of its #19852 dev (report 5795522449 on #19852). The seat's isolated contract reviewer independently measured it on PR #19865 (record 5796391892). ⛔ Filed bare: routing and grading are triage's. ⛔ Not a claim.

What happens

ViewMetadataSchema is built as lazySchema(() => z.preprocess(…, z.union(…))). The input type of a z.preprocess is unknown, so ViewMetadata, declared as z.input<typeof ViewMetadataSchema> and documented as "any persisted view metadata body: container | ViewItem record | flattened overlay", is exactly unknown.

Measured at 2548ba57de (dev) and at PR #19865's head (reviewer):

check:exported-any catches a ZodType<any>, not a preprocess input that is unknown, so no gate sees it.

Reach

The type ships in @objectstack/spec's published declarations. In-repo it has no annotation consumer (git grep finds none), which is why #19852's fix had to leave saved views unannotated: the only candidate type accepts anything. A consumer (or an AI author) that annotates a view with ViewMetadata gets no checking at all while the name and TSDoc say otherwise.

Suggested shape (⛔ not a ruling)

Declare ViewMetadata as the input of the post-preprocess union (the members the union runs), or retire the export if nothing should consume it. Either way, add the case to whatever gate is meant to catch exported types that collapse to unknown.

Filing-gate answers

Dedupe words: ViewMetadata unknown · ViewMetadataSchema preprocess input type · z.input preprocess unknown exported type · ViewMetadata accepts any body


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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions