fix(sql-editor): fail closed on incomplete @set captures#104
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(sql-editor): fail closed on incomplete @set captures#104cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Column/table @set previously wrote truncated page-0 / capped rows into variables with no error, so later ${{…}} expansion could silently miss rows. Refuse incomplete or over-cap captures; scalar @set is unchanged. Co-authored-by: huy.phan9 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug and impact
-- @set name = column …/-- @set name = tablecould capture only the current result page (or silently trim to the 500-row/value cap) while still succeeding. Later${{…}}expansion then ran against a partial variable with no error — e.g.DELETE … WHERE id IN (${{ids}})missing most IDs when Max rows/page was smaller than the SELECT.Root cause
applySetDirectivesignoredhasNext/truncatedfrom paged SQL results and sliced list/table payloads to the variable caps without failing.Fix
@setwhen the result is incomplete (hasNextortruncated) or would exceed the list/table caps.@setstill allows a partial page (only the first cell is used).Validation
npx vitest run apps/web/src/frontend/lib/sql-variables.test.ts— 28 passed.