feat(tables): add reference columns - #7105
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds workspace-scoped Reference table columns while preserving compatibility when the feature is disabled.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/table/column-types/registry.server.ts | Adds workspace and active-table validation for Reference targets while intentionally preserving metadata across target archival. |
| apps/sim/lib/table/columns/service.ts | Integrates Reference metadata and feature-gate enforcement into column creation and mutation paths. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/column-config-sidebar/column-config-sidebar.tsx | Adds feature-gated Reference target configuration for column creation and editing. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx | Wires Reference-column row-ID copying and navigation without changing the inherited rename undo path. |
| apps/sim/hooks/use-table-undo.ts | Preserves Reference, select, and currency metadata when deleted columns are restored. |
| scripts/openapi/generator.ts | Keeps Reference fields available to runtime contracts while excluding them from generated public OpenAPI output. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
UI[Table column UI] -->|create or update Reference| API[Table columns API]
API --> Gate[Reference feature gate]
Gate --> Validation[Workspace and active-target validation]
Validation --> Persistence[Column schema persistence]
Persistence --> Grid[Reference cells in table grid]
Grid -->|copy row ID| Clipboard[Clipboard]
Grid -->|navigate| Target[Referenced table]
Reviews (4): Last reviewed commit: "fix(tables): keep reference navigation a..." | Re-trigger Greptile
There was a problem hiding this comment.
No issues found across 42 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
|
@cubic-dev-ai review this PR |
@j15z I have started the AI code review. It will take a few minutes to complete. |
|
@cubic-dev-ai review this PR |
@j15z I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 56 files
Requires human review: Auto-approval blocked by 4 unresolved issues from previous reviews.
Fix all with cubic | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@j15z I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 58 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@j15z I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 58 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Re-trigger cubic
Summary
Tables can now store row IDs in a Reference column configured against another table in the same workspace. The type is preserved through contracts, import, persistence, validation, and column mutation paths, while the grid provides target configuration, row-ID copying, and direct navigation to the referenced table.
The foundation now owns the global
table-reference-columnsAppConfig flag, withTABLE_REFERENCE_COLUMNSas the off-AppConfig fallback. When disabled, the UI hides Reference from creation and conversion choices, navigation is unavailable, and server services reject creation, conversion, and retargeting. Existing Reference columns and cell values remain readable, writable, renamable, convertible away, and deletable for rollout safety.Deleted columns retain explicit select, currency, and Reference metadata so undo restores each column without changing its meaning.
User-facing documentation is deferred until the feature is ready to roll out. Runtime contracts continue to accept Reference fields for compatibility, while the generated public OpenAPI omits both the
referenceenum value andreferenceTableId.Stack
This is the foundation layer of the Reference-row stack. #7106 adds inline referenced-row inspection and reuses this flag for preview fetching and rendering. #7390 contains the general column configuration and rename UX split out of this PR. The existing edit-sidebar rename path intentionally remains here so #7390 owns the complete sidebar-to-header rename migration.
Type of Change
Testing
bun run --cwd apps/sim type-checkbun run check:api-validationbun run check:cli-apibun run check:openapi(147 tests and 216 contracts cross-checked)Checklist
Screenshots/Videos
Not attached. The create, configure, copy-row-ID, and reference-navigation flows were exercised locally.
Post-Deploy Monitoring & Validation
TABLE_REFERENCE_COLUMNSis disabled.Error updating column in tableandFailed to update column.PATCH /api/table/:tableId/columnsand table row writes during the first 24 hours of flag exposure.referenceTableId, or restored columns changing type/metadata. DisableTABLE_REFERENCE_COLUMNSand roll back the foundation change if these appear.