Skip to content

Commit 23f4bc5

Browse files
committed
fix(lint): note a table filter made only of references as not checked
1 parent 5f64837 commit 23f4bc5

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎apps/sim/lib/workflows/application/read-workflow-lint-tables.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,14 @@ describe('standalone table diagnostics against the actual Table block', () => {
498498
)
499499
})
500500

501+
it('reports a filter group made only of references as not checked', async () => {
502+
setGraph(block('query', { filter: '{"all":[<start.a>,<start.b>]}' }))
503+
const result = await lint()
504+
expect(result.notes).toContain(
505+
'Table filter in block "query" is not a static query object; its column references were not checked.'
506+
)
507+
})
508+
501509
it('does not treat dynamic field names as missing columns', async () => {
502510
setGraph(block('query', { sort: '{"<start.column>":"asc"}' }))
503511
const result = await lint()

‎apps/sim/lib/workflows/application/read-workflow-lint.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,9 @@ function normalizeTableInputs(
295295
* with the same text is never mistaken for one. A quoted reference fits row values and most
296296
* filter values; the value of an `in`/`nin` condition must be a list, so it becomes a one-item
297297
* list, and a condition or group made only of references has no literal part, so it is left out
298-
* of an `all`/`any` group that keeps a literal member. `runtimeOnly` marks a field whose whole
299-
* value is such a reference or group.
298+
* of an `all`/`any` group that keeps a literal member. A field whose whole value is such a
299+
* reference or group has nothing to check before runtime, so its text becomes one JSON string,
300+
* the same shape a whole-field reference takes, and `runtimeOnly` marks it.
300301
*/
301302
function withReferencePlaceholders(json: string): { value: string; runtimeOnly: boolean } {
302303
const nonce = generateShortId()
@@ -340,7 +341,8 @@ function withReferencePlaceholders(json: string): { value: string; runtimeOnly:
340341
})
341342
)
342343
}
343-
return { value: JSON.stringify(adapt(parsed)), runtimeOnly: isDynamic(parsed) }
344+
if (isDynamic(parsed)) return { value: JSON.stringify(json), runtimeOnly: true }
345+
return { value: JSON.stringify(adapt(parsed)), runtimeOnly: false }
344346
}
345347

346348
function replaceBareReferences(json: string, placeholder: (reference: string) => string): string {

0 commit comments

Comments
 (0)