Skip to content

fix: Fix rule's null value comparisons for is and isNot#198

Merged
bvanelli merged 2 commits into
mainfrom
197-fix-null-rule-value-comparisons
Apr 23, 2026
Merged

fix: Fix rule's null value comparisons for is and isNot#198
bvanelli merged 2 commits into
mainfrom
197-fix-null-rule-value-comparisons

Conversation

@bvanelli
Copy link
Copy Markdown
Owner

@bvanelli bvanelli commented Apr 20, 2026

The JS implementation can be seem on the file condition.ts. On Actual rules, most None evaluations will use the guard:

if (fieldValue == null) {
    return false;
}

When using is and isNot comparing with None values, there is an exception since it uses fieldValue === this.value and fieldValue !== this.value. We should allow the comparison to evaluate with the nullable field instead.

Another bug fix was comparing a null to a string object. There is a specific guard for this behavior:

if (type === 'string') {
    fieldValue ??= '';
}

Here, the correct option is to convert both sides to an empty string, then use the compare function instead.

Closes #197

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.62%. Comparing base (0039ad2) to head (9abdbec).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #198      +/-   ##
==========================================
- Coverage   97.64%   97.62%   -0.03%     
==========================================
  Files          21       21              
  Lines        3231     3237       +6     
==========================================
+ Hits         3155     3160       +5     
- Misses         76       77       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bvanelli bvanelli merged commit 5680e04 into main Apr 23, 2026
9 checks passed
@bvanelli bvanelli deleted the 197-fix-null-rule-value-comparisons branch April 23, 2026 18:18
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.

Not all rules are being run when using bank sync

1 participant