Compare commits

...
Author SHA1 Message Date
Sonarly Claude Code 6f93ee2748 Fix IS_NOT_NULL operand not supported in workflow relation filter evaluation
https://sonarly.com/issue/32512?type=bug

The workflow filter step's `evaluateRelationFilter` function throws an unhandled error when a relation filter uses the `IS_NOT_NULL` operand, causing the entire workflow run to fail.

Fix: Added `ViewFilterOperand.IS_NOT_NULL` as a handled case in `evaluateRelationFilter`, falling through to `IS_NOT_EMPTY` behavior (`return isNonEmptyString(leftValue)`). This is the correct semantic: IS_NOT_NULL for a relation field means "the relation exists / has a value", identical to IS_NOT_EMPTY.

Added two test cases covering IS_NOT_NULL on RELATION filters:
- Returns true when the left operand is a non-empty string (relation exists)
- Returns false when the left operand is empty (relation does not exist)
2026-04-29 15:01:34 +00:00
2 changed files with 25 additions and 0 deletions
@@ -192,6 +192,30 @@ describe('evaluateFilterConditions', () => {
expect(result).toBe(false); // Objects are different references
});
it('should return true when left operand is non-empty (IS_NOT_NULL RELATION)', () => {
const filter = createFilter(
ViewFilterOperand.IS_NOT_NULL,
'550e8400-e29b-41d4-a716-446655440000',
'',
'RELATION',
);
const result = evaluateFilterConditions({ filters: [filter] });
expect(result).toBe(true);
});
it('should return false when left operand is empty (IS_NOT_NULL RELATION)', () => {
const filter = createFilter(
ViewFilterOperand.IS_NOT_NULL,
'',
'',
'RELATION',
);
const result = evaluateFilterConditions({ filters: [filter] });
expect(result).toBe(false);
});
it('should throw error for unsupported relation filter operand', () => {
const uuid1 = '550e8400-e29b-41d4-a716-446655440000';
const uuid2 = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
@@ -294,6 +294,7 @@ function evaluateRelationFilter(filter: ResolvedFilter): boolean {
return leftValue !== rightValue;
case ViewFilterOperand.IS_EMPTY:
return !isNonEmptyString(leftValue);
case ViewFilterOperand.IS_NOT_NULL:
case ViewFilterOperand.IS_NOT_EMPTY:
return isNonEmptyString(leftValue);
default: