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

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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: Internal refactor

Testing

  • Focused tests cover registry-defined limits, source-aware conversion, explicit null handling, select migrations, schema validation, and both column pickers.
  • Verified limited types remain visible but disabled with a reason, while the current type remains selectable during an edit.
  • Type checking, lint, API validation, and client-boundary validation pass.
  • Review focus: the registry defaults must preserve every existing column type's behavior.

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)

Screenshots/Videos

No screenshots captured. Component tests cover the disabled picker state introduced by the generic cardinality hook.

@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 28, 2026 2:35am

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
j15z added a commit that referenced this pull request Aug 26, 2026
- 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.

j15z added 4 commits August 27, 2026 19:34
- preserve explicit nulls from source-owned conversion normalization
- normalize hooked values before select migration
- cover null and select conversion rewrites
@j15z
j15z force-pushed the refactor/table-column-type-extension-points branch from d29683d to d652f34 Compare August 28, 2026 02:35
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