Skip to content

Start Session's custom-identifier path shows a duplicate, contradictory validation error #1471

Description

@joshunrau

Summary

Start Session's Custom Identifier path shows two contradictory errors under the same field: the real format error, plus a spurious "This field is required" on a field the user demonstrably filled.

Where

apps/web/src/components/StartSessionForm/StartSessionForm.tsx

The Custom Identifier superRefine adds a "This field is required" issue when !val.subjectId. When the identifier's own .refine() (the format check) fails, Zod hands superRefine an undefined subjectId even though the user typed a non-empty value — so a genuinely-filled field also gets the required-field error.

Repro

  1. Start Session → Custom Identifier
  2. Type abc$def as the Identifier
  3. Fill a valid Date of Birth and Sex
  4. Submit

Result: two errors under Identifier — "Illegal character: $" and "This field is required".

Suggested fix

Guard the superRefine check so it only fires when the field is genuinely absent from the raw input, rather than inferring absence from a value Zod has already rejected.

Notes

Found while writing the Playwright suite (branch e2e-tests).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions