feat(tables): return only selected columns from the Table block query - #6954
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview The v2 query API accepts The Table block adds a Columns to Return multi-select ( Reviewed by Cursor Bugbot for commit 02f9be3. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR adds selected-column projection to Table v2 queries and carries the selection through the block, tool, API, and row-fetch layers.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/table/rows/service.ts | Projects selected columns before response-byte accounting and adds stored-average and widest-seen caps to prevent previously observed oversized follow-up fetches. |
| apps/sim/app/api/table/[tableId]/query/route.ts | Resolves requested column references against the authorized table schema and returns unmatched references without widening an invalid selection. |
| apps/sim/blocks/blocks/table_v2.ts | Adds the output-column selector and validates or forwards canvas- and model-supplied column selections. |
| apps/sim/hooks/selectors/providers/sim/selectors.ts | Adds the output-column selector and reads table-detail data through an invalidation-aware query path. |
| apps/sim/ee/workspace-forking/lib/remap/remap-references.ts | Preserves stable column-ID selections when their parent table is copied while continuing to clear them for mapped tables. |
Sequence Diagram
sequenceDiagram
participant Block as Table Block
participant Tool as Query Rows Tool
participant Route as Table Query Route
participant Service as Row Fetch Service
participant DB as Postgres
Block->>Tool: columns (stable IDs or names)
Tool->>Route: query request
Route->>Route: resolve references against schema
Route->>Service: resolved columnIds
loop bounded drain
Service->>DB: fetch full row batch
DB-->>Service: stored JSON rows
Service->>Service: project selected columns
Service->>Service: account projected and stored bytes
end
Service-->>Route: projected rows
Route-->>Tool: rows + ignoredColumns
Reviews (3): Last reviewed commit: "fix(tables): bound projected batches by ..." | Re-trigger Greptile
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit cb241af. Configure here.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c8151ac. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 02f9be3. Configure here.
| const rowBytes = Buffer.byteLength(JSON.stringify(row.data)) | ||
| const rowStoredBytes = columnIds | ||
| ? Buffer.byteLength(JSON.stringify(fetchedRow.data)) | ||
| : rowBytes |
There was a problem hiding this comment.
Empty projection bypasses query budget
Medium Severity
When every columns reference fails to resolve, the route passes an empty Set as columnIds. That value is truthy, so the drain projects each row to {} and the 5MB fail-fast guard only counts those tiny payloads. An unbounded query on a large table can therefore return the full match set (ids and row metadata included) instead of failing at the budget, which risks oversized responses and memory pressure when all selected columns were deleted or mistyped.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 02f9be3. Configure here.


Summary
columnsto the v2 table row query: stable column ids or names, resolved against the table schema; a reference that matches no column is skipped and reported back inignoredColumnstable.outputColumnsselector — stores ids, shows names) for the query operation; the tool and block exposeignoredColumnsas an output, and the block's description, best practices, and canvas sentence cover the new fieldfetchQuerywith no second cache layer, so a deletion is reflected without a reloadcolumnssurvives when the block runs as an Agent tool; a malformed selection fails fast instead of widening to every column; anullfilter (the sub-block default) is treated as absent<reference>in the advanced Table ID no longer leaks into selector fetchesType of Change
Testing
Unit tests across the route, service drain loop (including batch sizing), block transformer, selectors, dropdown, subblock context, and fork remap;
type-check,lint,check:api-validation,tool-metadata:check, and the fullcheck:auditssuite pass. Reviewers: the projection-before-budget change inlib/table/rows/service.tsis the part worth a close read — the drain now measures projected bytes for the budget but sizes batches from stored bytes.Checklist
Screenshots/Videos
UI change: the Table block's query operation gets a "Columns to Return" multi-select under the table picker; a selected column that has since been deleted shows as its raw
col_…id with a matching row in the list so it can be toggled off. No screenshots attached.