Compare commits

...
Author SHA1 Message Date
Sonarly Claude Code 63fee27620 fix: add IS_NOT operand support for UUID filter in turnRecordFilterIntoGqlOperationFilter
https://sonarly.com/issue/33728?type=bug

Workflow "Find Records" actions with UUID field filters using the IS_NOT operand throw an unhandled error, killing the entire workflow run on the worker process.

Fix: Added `RecordFilterOperand.IS_NOT` case to the UUID filter switch in `turnRecordFilterIntoRecordGqlOperationFilter`. The implementation follows the exact same pattern as the RELATION filter's `IS_NOT` case (lines 542-559 in the same file):

1. Wraps the `in` clause in a `not` filter to exclude matching UUIDs
2. OR-s with an `is: 'NULL'` check so that NULL values are also included in the "is not" result set

This matches the SQL semantics: `WHERE id NOT IN (...) OR id IS NULL`, which is the correct behavior for "is not" on nullable UUID fields.

Also added a corresponding test case in `turnRecordFilterIntoGqlOperationFilter.test.ts` that verifies the `IS_NOT` operand produces the expected `or` filter structure with both `not.recordId.in` and `recordId.is: 'NULL'` clauses.
2026-05-03 13:29:22 +00:00
2 changed files with 37 additions and 0 deletions
@@ -918,5 +918,25 @@ describe('turnRecordFilterIntoRecordGqlOperationFilter', () => {
expect(result).toHaveProperty('recordId.in');
});
it('should handle IS_NOT operand', () => {
const result = turnRecordFilterIntoRecordGqlOperationFilter({
filterValueDependencies,
recordFilter: makeFilter(
'f-uuid',
RecordFilterOperand.IS_NOT,
'["550e8400-e29b-41d4-a716-446655440000"]',
),
fieldMetadataItems: fields,
});
expect(result).toHaveProperty('or');
const orFilter = (result as any).or;
expect(orFilter).toHaveLength(2);
expect(orFilter[0]).toHaveProperty('not.recordId.in');
expect(orFilter[1]).toHaveProperty('recordId.is', 'NULL');
});
});
});
@@ -1499,6 +1499,23 @@ export const turnRecordFilterIntoRecordGqlOperationFilter = ({
in: recordIds,
} as UUIDFilter,
};
case RecordFilterOperand.IS_NOT:
return {
or: [
{
not: {
[correspondingFieldMetadataItem.name]: {
in: recordIds,
} as UUIDFilter,
},
},
{
[correspondingFieldMetadataItem.name]: {
is: 'NULL',
} as UUIDFilter,
},
],
};
default:
throw new Error(
`Unknown operand ${recordFilter.operand} for ${filterType} filter`,