Skip to content

[P2][lens] Reject NaN and Infinity in relational number column validation #26

Description

@cevheri

Summary

Relational column type "number" accepts NaN and Infinity because validation uses typeof value === "number" only. Values store as JSON null or break round-trip — schema contract violated silently.

Audit ID: Section 2 Med — Wave 2

Root cause

case "number":
  return typeof value === "number";

Fix

Use Number.isFinite(value); throw with same style as other validation errors in validateRow().

Tests

  • Insert row with NaN column → throws.
  • Insert Infinity → throws.
  • Normal numbers still pass.

Acceptance criteria

  • Non-finite numbers rejected at insert.
  • Test in src/lens/relational.test.ts.
  • bun run gate green.
  • Changeset required.

Verification

bun run gate

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions