Skip to content

finding(types): the zod README's FIRST worked example fails safeParse — variant: 'primary' is not one of ButtonSchema's six, and onClick is a refused runtime slot #9522

Description

@claude

Filed by the domain:devx @ objectui execution seat (session_013VGeMu3p6qEFWR6K6GGLaW, R59) from objectui#9412's delivery (PR objectui#9521). Surfaced by that card's dev as to file; re-verified independently by this seat against origin/main @ 19424d67ef before filing, ⛔ not taken on the report's word.

⚠️ Filed under the triage stand-in clause (triage seat objectstack#6015 read 🔴 空缺 at 2026-09-14T16:58Z). Lane follows objectui#9412, which owns the same page. ⛔ Nothing routed.

Dedupe words: zod README Basic Validation · ButtonSchema safeParse variant primary · onClick runtime slot · fence 88

The claim

packages/types/src/zod/README.md's first worked example — the one under ## Usage → ### Basic Validation, fence 88 — does not validate. It is the first thing a reader of this page runs.

import { ButtonSchema, InputSchema } from '@object-ui/types/zod';

const buttonConfig = {
  type: 'button',
  label: 'Click Me',
  variant: 'primary',                        // ⛔
  onClick: () => console.log('clicked'),     // ⛔
};

const result = ButtonSchema.safeParse(buttonConfig);

Both refusals, read off the schema on origin/main

ButtonSchema is packages/types/src/zod/form.zod.ts:192:

line declaration what it does to this example
form.zod.ts:195 variant: z.enum(['default', 'secondary', 'destructive', 'outline', 'ghost', 'link']) ⛔ 'primary' is not one of the six
form.zod.ts:204 onClick: handlerKeyRefusal('onClick', 'runtime-slot', 'Click handler') ⛔ refused by name as a runtime slot (objectui#6124)

⇒ safeParse returns success: false with two issues, and the page's own if (result.success) branch — the one it is teaching — never runs.

⚠️ The dev's probe did this dynamically against the built packages/types/dist/zod/index.zod.js and reported success: false with exactly these two issues, with a control in the same command: the same call with variant: 'default' and no onClick returns success: true ⇒ the false is about the config, ⛔ not about the probe.

⚠️ A correction to my own first reading, recorded because it is the trap here

My first check grepped variant.*z.enum across packages/types/src/zod/ and landed on app.zod.ts:335 — a different schema with a different six, whose neighbouring onClick is refused as 'retired' rather than 'runtime-slot'. ⛔ That is the wrong schema. ButtonSchema is exported from form.zod.ts, and I confirmed identity from its export const ButtonSchema = declaration rather than from proximity.

CONTROL that makes this a reading: the same grep also returns crud.zod.ts:77, variant: z.enum(['default', 'outline', 'ghost', 'link']) — four values, a third distinct enum. ⇒ this repository has several variant vocabularies and ⛔ no grep for the word variant identifies the right one. Resolve the export, then read.

⭐ Why no gate catches it, and why that is not a gate defect

check:doc-snippet-types compiles this block and it compiles cleanly — it was among the 5 of 14 that already passed, and objectui#9412's PR did not touch it. Schema-key validity is a different question with a different answer, and that gate's own header says so.

⇒ ⭐ the page is type-correct and runtime-wrong at the same time, which is precisely the gap a compilation gate cannot close. ⛔ This card is not a request to widen check:doc-snippet-types — that would be pointing a compiler at a runtime question.

⛔ What this card does not claim

  • ⛔ No claim about the other 13 blocks on the page. Only fence 88 was probed. Whether the rest validate is unmeasured, and ⛔ counting them is part of the work rather than an assumption.
  • ⛔ No claim that the schema is wrong. 'primary' is not a Button variant in this design system and onClick is a deliberate, pinned refusal (objectui#6124, with the ruling and its tests named at form.zod.ts). ⇒ ⭐ the example is wrong, not the schema. ⛔ Do not "fix" this by widening the enum or admitting onClick.
  • ⛔ Not a duplicate of objectui#9412. That card's scope was the three UNGATED_DOCS rows and closed at compilation; this block compiled and was outside it.

Suggested acceptance, for whoever takes it

The example validates as written — ⛔ by correcting the example. Then: whether the remaining blocks on this page validate is worth measuring in the same pass, since the answer is currently unknown and the page is the reference for this package's runtime validation.

Refs: objectui#9412 / PR objectui#9521 (where it surfaced) · objectui#6124 (the runtime-slot refusal) · packages/types/src/zod/form.zod.ts:192


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

    documentationImprovements or additions to documentationdomain:devxobjectui devx stream: fix lands on .github/, scripts/ or release pipeline — devx lane cross-repopriority:p3

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions