Skip to content

refactor(tables): add column type extension points - #7119

Open
j15z wants to merge 4 commits into
stagingfrom
refactor/table-column-type-extension-points
Open

refactor(tables): add column type extension points#7119
j15z wants to merge 4 commits into
stagingfrom
refactor/table-column-type-extension-points

Conversation

@j15z

@j15z j15z commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

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

@vercel

vercel Bot commented Aug 26, 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 Aug 26, 2026 10:14pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The 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.

  • Disables unavailable column types in creation and editing controls.
  • Enforces declared type cardinality limits across schema validation and mutation paths.
  • Adds hooks for type-specific import coercion and conversion normalization.
  • Adds focused tests for the new registry extension points and picker behavior.

Confidence Score: 5/5

The 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.

Important Files Changed

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]
Loading

Reviews (1): Last reviewed commit: "refactor(tables): add column type extens..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 16 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/sim/lib/table/column-types/registry.ts Outdated
Comment thread apps/sim/lib/table/columns/service.ts
- preserve explicit nulls from source-owned conversion normalization
- normalize hooked values before select migration
- cover null and select conversion rewrites
@j15z

j15z commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

registry.ts can restore the original value when normalization intentionally returns null.

service.ts validates normalized values during conversion but may migrate raw cells on the write path.

Addressed both findings in 50ecc4cfda: explicit nulls are preserved and written back, and hooked source values now run the bounded rewrite before select migration. Added focused regression coverage for both cases.

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