Skip to content

fix(codegen-ts-react): normalize blank optional fields before validation #855

fix(codegen-ts-react): normalize blank optional fields before validation

fix(codegen-ts-react): normalize blank optional fields before validation #855

Triggered via push September 30, 2026 12:21
Status Failure
Total duration 8m 32s
Artifacts –

local-ci.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

3 errors and 5 warnings
ts-fast
Process completed with exit code 1.
error: content mismatch for postgres/Exercise.form.tsx: server/typescript/packages/codegen-ts/test/golden/golden-output.test.ts#L74
@@ -4,11 +4,11 @@ import { Exercise, ExerciseInsertSchema, ExerciseUpdateSchema } from "./Exercise"; import type { Exercise as ExerciseRow } from "./Exercise"; import { useEntityForm } from "@metaobjectsdev/react"; import type { ReactElement } from "react"; import type { SubmitHandler } from "react-hook-form"; + import { z } from "zod"; const BLANK_OPTIONAL_FIELDS = ["sets", "reps", "notes"] as const; /** * Normalize blank optional inputs on the way out of the form (#223). @@ -48,11 +48,14 @@ * Exercise constants directly. */ export function ExerciseForm(props: ExerciseFormProps): ReactElement { const form = useEntityForm( Exercise, - props.defaultValues !== undefined ? ExerciseUpdateSchema : ExerciseInsertSchema, + z.preprocess( + (v) => normalizeBlankOptionals(v as Record<string, unknown>, props.defaultValues !== undefined), + props.defaultValues !== undefined ? ExerciseUpdateSchema : ExerciseInsertSchema, + ), props.defaultValues !== undefined ? { defaultValues: props.defaultValues } : {}, ); return ( <form className={props.className ?? "metaobjects-form"} - Expected - 1 + Received + 5 at <anonymous> (/home/doug/actions-runners/runner-2/_work/metaobjects/metaobjects/server/typescript/packages/codegen-ts/test/golden/golden-output.test.ts:74:76)
error: content mismatch for sqlite/Exercise.form.tsx: server/typescript/packages/codegen-ts/test/golden/golden-output.test.ts#L74
@@ -4,11 +4,11 @@ import { Exercise, ExerciseInsertSchema, ExerciseUpdateSchema } from "./Exercise"; import type { Exercise as ExerciseRow } from "./Exercise"; import { useEntityForm } from "@metaobjectsdev/react"; import type { ReactElement } from "react"; import type { SubmitHandler } from "react-hook-form"; + import { z } from "zod"; const BLANK_OPTIONAL_FIELDS = ["sets", "reps", "notes"] as const; /** * Normalize blank optional inputs on the way out of the form (#223). @@ -48,11 +48,14 @@ * Exercise constants directly. */ export function ExerciseForm(props: ExerciseFormProps): ReactElement { const form = useEntityForm( Exercise, - props.defaultValues !== undefined ? ExerciseUpdateSchema : ExerciseInsertSchema, + z.preprocess( + (v) => normalizeBlankOptionals(v as Record<string, unknown>, props.defaultValues !== undefined), + props.defaultValues !== undefined ? ExerciseUpdateSchema : ExerciseInsertSchema, + ), props.defaultValues !== undefined ? { defaultValues: props.defaultValues } : {}, ); return ( <form className={props.className ?? "metaobjects-form"} - Expected - 1 + Received + 5 at <anonymous> (/home/doug/actions-runners/runner-2/_work/metaobjects/metaobjects/server/typescript/packages/codegen-ts/test/golden/golden-output.test.ts:74:76)
detect
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@v4. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
ts-unit
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@v4. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
gates
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@v4. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
ts-slow
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@v4. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
ts-fast
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@v4. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/