Episode 2 — React Frontend Architecture NextJS / 2.15 — Advanced Forms and Validation

2.15.c — Zod schema validation: type-safe strategy

<< 2.15 Overview


Learning outcomes

  1. Model user input with z.input vs transformed z.output awareness.
  2. Use safeParse at boundaries; map errors to UI fields.
  3. Compose schemas for maintainability.

Baseline schema

import { z } from "zod";

export const signupSchema = z
  .object({
    email: z.string().email("Invalid email"),
    password: z.string().min(8, "At least 8 characters"),
    confirm: z.string(),
  })
  .refine((data) => data.password === data.confirm, {
    message: "Passwords must match",
    path: ["confirm"],
  });

export type SignupInput = z.input<typeof signupSchema>;
export type SignupOutput = z.output<typeof signupSchema>;

safeParse vs parse

  • parse throws—OK internally when failure is exceptional.
  • safeParse returns { success, data | error }—ideal for HTTP handlers and UI mapping.

Resolver integration (React Hook Form)

import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";

useForm<SignupInput>({
  resolver: zodResolver(signupSchema),
  defaultValues: { email: "", password: "", confirm: "" },
});

Server-only constraints

Add checks that must not be client-bypassable:

  • uniqueness of email
  • permission to modify resource
  • anti-abuse rate limits

Use .superRefine async carefully; never trust client-only async validation for security.


Coercion pitfalls

z.coerce.number() can surprise with empty strings depending on configuration. Prefer explicit transforms with tests.



Appendix — Scenario bank (basic → advanced)

Each scenario is a mini design review: what users see, what breaks, what you change, what you say in an interview. Cover five per day and narrate fixes out loud.

ZOD-001 — Zod schemas scenario #1

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 13 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-002 — Zod schemas scenario #2

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 26 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-003 — Zod schemas scenario #3

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 39 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-004 — Zod schemas scenario #4

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 52 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-005 — Zod schemas scenario #5

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 65 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-006 — Zod schemas scenario #6

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 78 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-007 — Zod schemas scenario #7

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 91 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-008 — Zod schemas scenario #8

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 104 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-009 — Zod schemas scenario #9

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 117 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-010 — Zod schemas scenario #10

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 10 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-011 — Zod schemas scenario #11

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 23 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-012 — Zod schemas scenario #12

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 36 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-013 — Zod schemas scenario #13

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 49 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-014 — Zod schemas scenario #14

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 62 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-015 — Zod schemas scenario #15

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 75 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-016 — Zod schemas scenario #16

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 88 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-017 — Zod schemas scenario #17

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 101 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-018 — Zod schemas scenario #18

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 114 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-019 — Zod schemas scenario #19

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 7 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-020 — Zod schemas scenario #20

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 20 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-021 — Zod schemas scenario #21

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 33 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-022 — Zod schemas scenario #22

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 46 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-023 — Zod schemas scenario #23

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 59 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-024 — Zod schemas scenario #24

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 72 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-025 — Zod schemas scenario #25

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 85 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-026 — Zod schemas scenario #26

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 98 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-027 — Zod schemas scenario #27

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 111 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-028 — Zod schemas scenario #28

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 4 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-029 — Zod schemas scenario #29

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 17 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-030 — Zod schemas scenario #30

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 30 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-031 — Zod schemas scenario #31

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 43 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-032 — Zod schemas scenario #32

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 56 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-033 — Zod schemas scenario #33

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 69 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-034 — Zod schemas scenario #34

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 82 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-035 — Zod schemas scenario #35

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 95 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-036 — Zod schemas scenario #36

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 108 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-037 — Zod schemas scenario #37

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 1 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-038 — Zod schemas scenario #38

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 14 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-039 — Zod schemas scenario #39

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 27 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-040 — Zod schemas scenario #40

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 40 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-041 — Zod schemas scenario #41

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 53 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-042 — Zod schemas scenario #42

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 66 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-043 — Zod schemas scenario #43

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 79 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-044 — Zod schemas scenario #44

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 92 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-045 — Zod schemas scenario #45

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 105 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-046 — Zod schemas scenario #46

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 118 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-047 — Zod schemas scenario #47

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 11 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-048 — Zod schemas scenario #48

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 24 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-049 — Zod schemas scenario #49

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 37 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-050 — Zod schemas scenario #50

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 50 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-051 — Zod schemas scenario #51

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 63 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-052 — Zod schemas scenario #52

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 76 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-053 — Zod schemas scenario #53

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 89 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-054 — Zod schemas scenario #54

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 102 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-055 — Zod schemas scenario #55

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 115 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-056 — Zod schemas scenario #56

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 8 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-057 — Zod schemas scenario #57

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 21 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-058 — Zod schemas scenario #58

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 34 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-059 — Zod schemas scenario #59

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 47 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-060 — Zod schemas scenario #60

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 60 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-061 — Zod schemas scenario #61

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 73 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-062 — Zod schemas scenario #62

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 86 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-063 — Zod schemas scenario #63

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 99 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-064 — Zod schemas scenario #64

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 112 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-065 — Zod schemas scenario #65

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 5 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-066 — Zod schemas scenario #66

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 18 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-067 — Zod schemas scenario #67

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 31 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-068 — Zod schemas scenario #68

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 44 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-069 — Zod schemas scenario #69

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 57 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-070 — Zod schemas scenario #70

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 70 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-071 — Zod schemas scenario #71

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 83 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-072 — Zod schemas scenario #72

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 96 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-073 — Zod schemas scenario #73

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 109 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-074 — Zod schemas scenario #74

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 2 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-075 — Zod schemas scenario #75

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 15 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-076 — Zod schemas scenario #76

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 28 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-077 — Zod schemas scenario #77

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 41 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-078 — Zod schemas scenario #78

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 54 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-079 — Zod schemas scenario #79

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 67 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-080 — Zod schemas scenario #80

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 80 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-081 — Zod schemas scenario #81

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 93 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-082 — Zod schemas scenario #82

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 106 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-083 — Zod schemas scenario #83

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 119 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-084 — Zod schemas scenario #84

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 12 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-085 — Zod schemas scenario #85

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 25 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-086 — Zod schemas scenario #86

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 38 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-087 — Zod schemas scenario #87

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 51 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-088 — Zod schemas scenario #88

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 64 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-089 — Zod schemas scenario #89

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 77 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-090 — Zod schemas scenario #90

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 90 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-091 — Zod schemas scenario #91

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 103 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-092 — Zod schemas scenario #92

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 116 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-093 — Zod schemas scenario #93

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 9 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-094 — Zod schemas scenario #94

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 22 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-095 — Zod schemas scenario #95

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 35 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-096 — Zod schemas scenario #96

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 48 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-097 — Zod schemas scenario #97

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 61 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-098 — Zod schemas scenario #98

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 74 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-099 — Zod schemas scenario #99

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 87 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-100 — Zod schemas scenario #100

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 100 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-101 — Zod schemas scenario #101

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 113 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-102 — Zod schemas scenario #102

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 6 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-103 — Zod schemas scenario #103

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 19 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-104 — Zod schemas scenario #104

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 32 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-105 — Zod schemas scenario #105

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 45 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-106 — Zod schemas scenario #106

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 58 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-107 — Zod schemas scenario #107

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 71 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-108 — Zod schemas scenario #108

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 84 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-109 — Zod schemas scenario #109

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 97 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-110 — Zod schemas scenario #110

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 110 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-111 — Zod schemas scenario #111

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 3 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-112 — Zod schemas scenario #112

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 16 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-113 — Zod schemas scenario #113

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 29 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-114 — Zod schemas scenario #114

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 42 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-115 — Zod schemas scenario #115

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 55 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-116 — Zod schemas scenario #116

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 68 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-117 — Zod schemas scenario #117

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 81 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-118 — Zod schemas scenario #118

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 94 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-119 — Zod schemas scenario #119

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 107 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-120 — Zod schemas scenario #120

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 0 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-121 — Zod schemas scenario #121

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 13 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-122 — Zod schemas scenario #122

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 26 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-123 — Zod schemas scenario #123

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 39 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-124 — Zod schemas scenario #124

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 52 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-125 — Zod schemas scenario #125

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 65 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-126 — Zod schemas scenario #126

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 78 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-127 — Zod schemas scenario #127

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 91 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-128 — Zod schemas scenario #128

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 104 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-129 — Zod schemas scenario #129

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 117 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-130 — Zod schemas scenario #130

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 10 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-131 — Zod schemas scenario #131

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 23 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-132 — Zod schemas scenario #132

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 36 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-133 — Zod schemas scenario #133

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 49 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-134 — Zod schemas scenario #134

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 62 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-135 — Zod schemas scenario #135

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 75 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-136 — Zod schemas scenario #136

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 88 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-137 — Zod schemas scenario #137

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 101 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-138 — Zod schemas scenario #138

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 114 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-139 — Zod schemas scenario #139

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 7 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-140 — Zod schemas scenario #140

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 20 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-141 — Zod schemas scenario #141

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 33 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-142 — Zod schemas scenario #142

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 46 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-143 — Zod schemas scenario #143

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 59 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-144 — Zod schemas scenario #144

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 72 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-145 — Zod schemas scenario #145

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 85 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-146 — Zod schemas scenario #146

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 98 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-147 — Zod schemas scenario #147

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 111 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-148 — Zod schemas scenario #148

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 4 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-149 — Zod schemas scenario #149

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 17 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-150 — Zod schemas scenario #150

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 30 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-151 — Zod schemas scenario #151

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 43 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-152 — Zod schemas scenario #152

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 56 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Internationalized messages hard-coded in schema without i18n layer.
  • Primary remediation: Separate input vs output types; document transforms in UI copy.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-153 — Zod schemas scenario #153

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 69 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: .parse throws in UI paths instead of safeParse causing uncaught errors.
  • Primary remediation: Use safeParse at boundaries; map issues to field errors deterministically.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-154 — Zod schemas scenario #154

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 82 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Coerce misuse turning empty strings into unintended numbers.
  • Primary remediation: Split schemas: addressSchema, accountSchema, compose with .merge / .and.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-155 — Zod schemas scenario #155

  • Level: Advanced
  • User-visible symptom: validation flicker, double submit, or lost input after 95 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Refinements on wrong step (client vs server) leading to duplicated rules drifting.
  • Primary remediation: Be explicit with z.coerce vs z.string transforms; test edge cases.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-156 — Zod schemas scenario #156

  • Level: Advanced+
  • User-visible symptom: validation flicker, double submit, or lost input after 108 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Async refinements without debounce causing race conditions on fast typing.
  • Primary remediation: Use discriminatedUnion with a literal discriminator; render variants explicitly.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-157 — Zod schemas scenario #157

  • Level: Beginner
  • User-visible symptom: validation flicker, double submit, or lost input after 1 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Transforms hiding invalid states from users until too late in the pipeline.
  • Primary remediation: Share one schema module; add server-only checks via .superRefine where needed.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-158 — Zod schemas scenario #158

  • Level: Beginner+
  • User-visible symptom: validation flicker, double submit, or lost input after 14 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Schema too large to reuse between client and server without modularization.
  • Primary remediation: Normalize fieldErrors paths to RHF nested naming conventions.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

ZOD-159 — Zod schemas scenario #159

  • Level: Intermediate
  • User-visible symptom: validation flicker, double submit, or lost input after 27 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Discriminated union field not narrowed; impossible states rendered.
  • Primary remediation: Debounce async checks; cancel stale requests with AbortController.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Server validation always wins over client Zod for security.

ZOD-160 — Zod schemas scenario #160

  • Level: Intermediate+
  • User-visible symptom: validation flicker, double submit, or lost input after 40 ms async checks.
  • Form architecture symptom: state thrashes, unnecessary renders, or impossible-to-test validation scattered in JSX.
  • Root cause class: Error map shape mismatched to UI expectations for nested arrays.
  • Primary remediation: Pipe Zod messages through i18n keys; keep schema mostly structural.
  • Accessibility check: associate errors with fields via aria-describedby / aria-invalid; do not rely on color alone.
  • Interview one-liner: Zod encodes invariants; UI encodes presentation—keep both but avoid duplication drift.

<< 2.15 Overview