Skip to content

feat(tables): support plain predicates in v2 queries - #6292

Merged
TheodoreSpeaks merged 3 commits into
stagingfrom
feat/no-predicate-table-v2
Aug 5, 2026
Merged

feat(tables): support plain predicates in v2 queries#6292
TheodoreSpeaks merged 3 commits into
stagingfrom
feat/no-predicate-table-v2

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • accept a plain { field, op, value } predicate across v2 table APIs, blocks, tools, saved views, and Copilot
  • normalize shorthand to the existing grouped representation while preserving legacy v1 filter behavior

Type of Change

  • Feature

Testing

  • 167 targeted table predicate tests
  • bun run type-check
  • full lint and ship audit suite

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)

@vercel

vercel Bot commented Aug 5, 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 5, 2026 6:57pm

Request Review

@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes filter parsing and normalization on query, bulk, block, and Copilot paths; mistaken interpretation of legacy bulk filters is explicitly guarded, but any gap could widen or mis-scope row operations.

Overview
v2 table filtering can now be sent as a single condition { field, op, value } instead of always wrapping it in {"all":[...]}. Query APIs, saved views, the table_v2 block editor JSON, and Copilot table tools accept that shorthand and normalize it to the existing grouped TablePredicate before validation and execution.

Contracts: predicateInputSchema parses a root leaf or group, runs shared depth/size checks via getTablePredicateTreeSizeError, then transforms with normalizeTablePredicate. rowQueryBodySchema, v2 query bodies, and tableViewConfigSchema use it. Bulk delete/update still use group-only predicateSchema in the legacy union so a v1-style object is not misread as a predicate when columns are named field/op/value.

Runtime: validatePredicateShape / validatePredicate accept TablePredicateInput, check tree size before recursive walks, and updated error text for plain conditions vs legacy $ grammar. The table_v2 block validates editor JSON with validatePredicateShape and rejects legacy { status: "active" } shapes.

Docs: Block descriptions, filter placeholders, wand prompts, and generated Copilot tool metadata now describe plain predicates and all/any for compound filters.

Reviewed by Cursor Bugbot for commit 1516f07. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds support for plain { field, op, value } predicates across v2 table interfaces while normalizing them to the existing grouped representation.

  • Introduces shared predicate normalization and iterative complexity-limit checks.
  • Updates API contracts, blocks, tools, Copilot handlers, saved views, generated metadata, and associated tests.
  • Preserves grouped predicates and legacy v1 filter disambiguation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported recursion path now performs an iterative complexity check before every recursive predicate validation or parsing entry point.

Important Files Changed

Filename Overview
apps/sim/lib/table/query-builder/predicate.ts Adds canonical plain-predicate normalization and an iterative complexity precheck that prevents deeply nested input from reaching recursive validation.
apps/sim/lib/table/query-builder/validate.ts Extends runtime validation to plain predicates and invokes the shared complexity guard before recursive structural checks.
apps/sim/lib/api/contracts/tables.ts Adds guarded plain-predicate contract parsing and canonical normalization while retaining group-only parsing at dual-grammar legacy boundaries.
apps/sim/blocks/blocks/table_v2.ts Validates and normalizes plain predicate input before table block execution.
apps/sim/tools/table/query_rows_v2.ts Routes v2 tool predicates through guarded validation and normalization before querying.
apps/sim/lib/copilot/tools/server/table/user-table.ts Validates and normalizes plain predicates for Copilot query, update, and delete operations.

Reviews (3): Last reviewed commit: "fix(tables): bound predicate validation" | Re-trigger Greptile

@TheodoreSpeaks
TheodoreSpeaks force-pushed the feat/no-predicate-table-v2 branch from a5e6fa8 to ca7c8d1 Compare August 5, 2026 18:48
Comment thread apps/sim/tools/table/query_rows_v2.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor 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.

✅ 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 ca7c8d1. Configure here.

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor 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.

✅ 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 1516f07. Configure here.

@TheodoreSpeaks
TheodoreSpeaks merged commit 41572a0 into staging Aug 5, 2026
30 checks passed
@TheodoreSpeaks
TheodoreSpeaks deleted the feat/no-predicate-table-v2 branch August 5, 2026 19:10
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