Skip to content

feat(tables): add rich column types — select, url, email, phone, currency, percent, rating#5006

Open
waleedlatif1 wants to merge 7 commits into
mainfrom
feat/tables-rich-column-types
Open

feat(tables): add rich column types — select, url, email, phone, currency, percent, rating#5006
waleedlatif1 wants to merge 7 commits into
mainfrom
feat/tables-rich-column-types

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Adds 7 rich column types to Tables: Select, URL, Email, Phone, Currency, Percent, Rating — each persists as one of the existing storage primitives (string/number) but renders and edits with a richer UI
  • New COLUMN_TYPE_STORAGE map in lib/table/constants.ts is the single source of truth: validation, coercion, SQL casts (::numeric for currency/percent/rating), CSV import, and type-change compatibility all key off the storage primitive, so rich types behave exactly like their primitive everywhere except display/editing
  • Rich cell rendering: select values as colored tags (deterministic color from value hash), url as favicon link (existing), email/phone as mailto:/tel: links with icons, currency/percent as formatted numbers, rating as stars
  • Select columns carry a bounded options: string[] on the column definition (soft constraint — values outside the list stay valid and render as gray tags, so removing an option never strands row data); options editable in the column config sidebar, with a filterable option-list inline editor in the grid
  • Contract: columnOptionsSchema (count/length/uniqueness bounds + options-only-on-select refine) on create/update column bodies; new updateColumnOptions service fn; normalizeColumn and delete-column undo carry options
  • Row modal gets type-appropriate fields (select combobox, email/url/tel inputs, numeric inputs); autosize accounts for badge chrome and star width
  • Workflow input mapping and LLM tool enrichment now resolve rich types through the storage primitive

Type of Change

  • New feature

Testing

  • New unit tests for options validation, rich-type row validation, numeric/text SQL cast selection, and CSV import coercion (361 table tests passing)
  • bunx tsc --noEmit, biome check, and bun run check:api-validation:strict all pass
  • Tested manually

Notes

  • The copilot tool catalog (separate repo) still advertises the original five types in its enum; the server tool validates against COLUMN_TYPES so it already accepts the new ones — catalog bump is a follow-up

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jun 12, 2026 11:46pm

Request Review

@cursor

cursor Bot commented Jun 12, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches shared table schema validation, column PATCH APIs, and coercion/SQL paths used on every read/write; changes are well-tested but affect core data handling beyond pure UI.

Overview
Adds seven rich column types (select, url, email, phone, currency, percent, rating) that still persist as existing string/number primitives, with COLUMN_TYPE_STORAGE / getColumnStorageType driving validation, coercion, SQL casts, CSV import, and type-change checks so behavior matches the underlying primitive outside the UI.

Select columns gain bounded options on the schema: Zod columnOptionsSchema, validateColumnOptions, updateColumnOptions, and PATCH handling that applies type + options atomically via updateColumnType or options-only updates. normalizeColumn and undo paths preserve options.

Grid & editing: colored select tags (hash-based palette), mailto/tel links, locale currency/percent formatters, star ratings, filterable inline select editor, row-modal fields, and column sidebar option list. Workflow input mapping and LLM enrichment resolve types through storage primitives.

Tests cover options validation, rich-type rows, SQL casts/sorts, and CSV coercion.

Reviewed by Cursor Bugbot for commit 5d5160c. Configure here.

Comment thread apps/sim/app/api/table/[tableId]/columns/route.ts
@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds seven rich column types — select, url, email, phone, currency, percent, and rating — to the Tables feature. All new types persist as one of the existing storage primitives via the new COLUMN_TYPE_STORAGE map, which is the single source of truth for validation, SQL casting, CSV coercion, and type-change compatibility.

  • select columns carry a soft-constraint options: string[] on the column definition (values outside the list stay valid, render as gray tags), editable via a new option-list UI in the config sidebar and a filterable inline popover in the grid.
  • Rich cell rendering is added for each type (colored tags, favicon links, mailto/tel anchors, formatted numbers, star widgets), and the row modal, inline editors, workflow sidebar, and LLM enrichment are all updated to route through getColumnStorageType.
  • 361 unit tests pass, covering options validation, rich-type row validation, numeric SQL cast selection, and CSV import coercion.

Confidence Score: 5/5

Safe to merge — the storage-primitive abstraction is consistent across all layers, and the previously flagged type+options atomicity gap is correctly resolved in a single locked transaction.

The COLUMN_TYPE_STORAGE map is applied uniformly across SQL casting, CSV coercion, row validation, inline editors, and the undo system. Both route files received the same atomic fix. No data-loss or schema-corruption path was identified in the new code.

No files require special attention. The two inline comments are minor UX polish items that do not affect data correctness.

Important Files Changed

Filename Overview
apps/sim/lib/table/constants.ts Adds 7 new column types to COLUMN_TYPES, introduces COLUMN_TYPE_STORAGE map and getColumnStorageType helper, and defines RATING_MAX and select-option limits.
apps/sim/lib/table/service.ts updateColumnType now handles options atomically in the same locked transaction; new updateColumnOptions service function added; isValueCompatibleWithType routes through storage primitive.
apps/sim/app/api/table/[tableId]/columns/route.ts PATCH route correctly passes options into updateColumnType for atomic type+options changes; updateColumnOptions called only when options-only update requested.
apps/sim/lib/api/contracts/tables.ts columnOptionsSchema and refines added; Zod prevents options on non-select typed updates at the contract boundary.
apps/sim/lib/table/validation.ts validateColumnOptions added with correct bounds/uniqueness checks; rating normalization applied on every write path.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/inline-editors.tsx InlineSelectEditor added with filter-as-you-type popover, keyboard navigation, and doneRef guard against double-saves.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/cell-render.tsx Rich cell rendering added for email, phone, select, and rating types.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/column-config-sidebar/column-config-sidebar.tsx SelectOptionsField editor added; options sent atomically with type change via combined updates object.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PATCH /columns] --> B{updates.type?}
    B -- yes --> C[updateColumnType\n+ options if present\none locked tx]
    B -- no --> D{updates.options?}
    D -- yes --> E[updateColumnOptions\none locked tx]
    D -- no --> F[other updates]
    C --> G[schema: type + options\nstored atomically]
    E --> H[schema: options only\nupdated]

    subgraph Rich Type Resolution
        I[column.type] --> J[getColumnStorageType]
        J --> K{storage primitive}
        K -- string --> L[SQL text / CSV / validate]
        K -- number --> M[SQL numeric / CSV / validate]
        K -- other --> N[existing paths]
    end
Loading

Reviews (8): Last reviewed commit: "fix(tables): resolve highlighted option ..." | Re-trigger Greptile

Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/utils.ts Outdated
…it-pick select save, locale-aware currency/percent
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/lib/table/service.ts Outdated
…lect tag match, options support in v1 column PATCH
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/utils.ts Outdated
Comment thread apps/sim/lib/table/validation.ts
…, case-insensitive select match in row modal
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 00181cd. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

Addressed the remaining 4/5 concern: updateColumnType now accepts options and applies them inside its single withLockedTable transaction, so a combined type+options change (including the undo path that restores a select column's options) commits atomically — updateColumnOptions is only used for options-only updates. Also fixed the biome formatting nit that failed CI.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5d5160c. Configure here.

Base automatically changed from staging to main June 13, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant