refactor(tables): add column type extension points - #7119
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThe PR adds registry-level extension points for per-table type limits, CSV coercion, and source-owned conversion normalization, then connects them to schema validation and table UI.
Confidence Score: 5/5The PR appears safe to merge, with no concrete current runtime, data-integrity, build, or security failure identified. All newly added extension hooks are inert unless explicitly configured, and the current production type definitions do not declare limits or custom import and conversion hooks that would activate the investigated edge cases.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/table/column-types/types.ts | Extends the client-safe column-type contract with cardinality, import-coercion, and conversion-normalization hooks. |
| apps/sim/lib/table/column-types/registry.ts | Adds generic dispatch and validation helpers for the new extension points. |
| apps/sim/lib/table/columns/service.ts | Applies source-owned normalization during retype validation and rewriting and validates the resulting schema earlier. |
| apps/sim/lib/table/schema-invariants.ts | Incorporates registry-declared per-type cardinality limits into shared schema validation. |
| apps/sim/lib/table/import.ts | Delegates CSV coercion to a type-specific hook when one is registered while preserving existing fallbacks. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/column-config-sidebar/column-types.ts | Derives picker availability and limit explanations from registry metadata. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/new-column-dropdown/new-column-dropdown.tsx | Displays cardinality-limited types as disabled menu items with explanatory tooltips. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Registry[Column type registry] --> Limits[maxPerTable]
Registry --> Import[coerceImport]
Registry --> Conversion[valueForConversion]
Limits --> Picker[Column type pickers]
Limits --> Schema[Schema validation]
Import --> CSV[CSV coercion]
Conversion --> Retype[Column retype scan and rewrite]
Reviews (1): Last reviewed commit: "refactor(tables): add column type extens..." | Re-trigger Greptile
There was a problem hiding this comment.
All reported issues were addressed across 16 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- preserve explicit nulls from source-owned conversion normalization - normalize hooked values before select migration - cover null and select conversion rewrites
Addressed both findings in |
- preserve explicit nulls from source-owned conversion normalization - normalize hooked values before select migration - cover null and select conversion rewrites
d29683d to
d652f34
Compare
Summary
Column types can now declare table-wide cardinality limits and source-owned conversion normalization in the registry. Generic validation, retyping, and picker code consumes those declarations, so limited types can integrate without adding one-off branches to each table surface.
This is PR 1 of 4 in the row-expiration stack. PR #7071 uses these hooks to add the Expiration column; PR #7072 hardens shared timezone conversion; PR #7161 adds row-delete triggers.
CSV import coercion deliberately remains in the existing import switch because imports preserve invalid raw values for descriptive row-level errors. Existing column types keep unlimited cardinality and identity conversion by default.
Type of Change
Testing
nullhandling, select migrations, schema validation, and both column pickers.Checklist
Screenshots/Videos
No screenshots captured. Component tests cover the disabled picker state introduced by the generic cardinality hook.