Skip to content

BROWSE per-cell validation hook #45

Description

@DDecoene

Scope

src/ui/Grid.ts currently has no per-column validation — any typed value commits (see commitEdit()). Add real client-side validation so an invalid edit is rejected inline (cell stays in edit mode with a visible error, or the edit is reverted) rather than silently writing bad data.

  • Server needs to tell the client each column's type + constraints. Extend whatever WS message currently carries table structure to BROWSE (check src/shared/types.ts and the grid-open / LIST STRUCTURE message shapes) to include type (CHAR/NUM/DATE/TIME/LOGICAL) and any qualifier (TIME(15), NUM(p,s)). Depends on the TIME type work (TIME column type #43).
  • Grid.ts validates client-side before commit, per type:
    • DATE — valid calendar date in the expected format.
    • TIME / TIME(n)HH:MM, plus minute-granularity check if n is set.
    • NUM(p,s) — numeric, fits precision/scale.
    • LOGICAL.T./.F. (or the existing boolean literal set).
  • Keep server-side validation too (the TIME type validation from TIME column type #43 already covers REPLACE) — the grid hook is a UX improvement, not a replacement for the authoritative check.

Branch

feature/<name> off release/v1.2.0, PR targets release/v1.2.0. Should land after #43 (TIME type) since it validates against TIME columns.

Tests

Playwright coverage: type an invalid time into a TIME grid cell and assert it's rejected/flagged; type a valid one and assert it commits. Extend tests/assistant.spec.ts or add a focused new spec, following existing grid-interaction patterns.

Definition of done

Per CLAUDE.md → Definition of done: tests green (vitest + playwright), CLAUDE.md BROWSE section updated if shortcuts/behavior changed, changelog entry.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions