Skip to content

spec: minLength still has the pre-#11566 defect pair — validated as no more than a number, authorable on every field type #11949

Description

@claude

Found while implementing #11566 (maxLength tightening). Filed unassigned — scope discipline kept it out of that PR, and the correct shape is a judgment call, not mechanical extrapolation.

What

packages/spec/src/data/field.zod.ts still declares:

minLength: z.number().optional().describe('Min character length'),

on the base field schema — the exact defect pair #11566 was ruled on for maxLength:

  1. No shape validation.minLength: -5 and minLength: 2.5 parse cleanly. (Unlike maxLength, minLength: 0 arguably has a defined meaning — "no minimum" — so the lower bound is a genuine decision: .min(0) vs .min(1), which is why this was not folded into spec: maxLength is authorable on every field type and validated as no more than a number — maxLength: 0 and maxLength: 12.5 parse cleanly #11566 as a mechanical rider.)
  2. Authorable on every type.boolean, lookup, autonumber, … accept it; the write-time validator (packages/objectql/src/validation/record-validator.ts) enforces it only on the same ten bounded-string types as maxLength (now exported as BOUNDED_STRING_FIELD_TYPES).
  3. The two authoring forms still carry their pre-convergence lists for minLength: field.form.ts shows it for text/textarea/email only, object.form.ts for nine types (no code). spec: maxLength is authorable on every field type and validated as no more than a number — maxLength: 0 and maxLength: 12.5 parse cleanly #11566 deliberately converged only the maxLength rows (the ruled scope).

Direction (for triage — not prescribing)

The #11566 ruling (comment on that card, 2026-08-24) is the natural template: shape z.number().int().min(0 or 1) + applicability BOUNDED_STRING_FIELD_TYPES + both form rows aligned. The one open question is the lower bound (0 = explicit no-op allowed, 1 = a no-op declaration is refused).


Generated by Claude Code

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions