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 |
Summary\n\nColumn types can now declare source-aware type conversion and per-table cardinality limits. Generic table services and pickers honor those declarations, so a new limited type can plug into the registry without adding its own validation and picker branches.\n\nCSV import coercion remains in the existing switch in import.ts. This PR does not introduce or move that behavior into the column-type registry.\n\nThis is the foundation of the row TTL stack. PR #7071 is the first consumer and adds TTL itself; PR #7072 consolidates the shared timezone conversion.\n\n## Type of Change\n\n- [ ] Bug fix\n- [ ] New feature\n- [ ] Breaking change\n- [ ] Documentation\n- [x] Other: Internal refactor\n\n## Testing\n\n- Focused tests pass for registry-defined limits, source-aware type conversion, schema validation, and picker behavior.\n- Verified a registry-defined limit disables but does not hide the type, while the current type remains selectable during edit.\n- Type-check, lint, API validation, and client-boundary validation pass.\n\nReview the registry limit and source-conversion hooks and their default unlimited or identity behavior first. Existing column types do not change behavior in this PR.\n\n## Checklist\n\n- [x] Code follows project style guidelines\n- [x] Self-reviewed my changes\n- [x] Tests added/updated and passing\n- [x] No new warnings introduced\n- [ ] I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)\n\n## Screenshots/Videos\n\nNot applicable. This PR adds registry behavior and generic picker states; the first limited column type is introduced upstack.\n