fix(db-ivm): treat 0 and empty string as valid min/max extremes - #1809
fix(db-ivm): treat 0 and empty string as valid min/max extremes#1809aakbarpour wants to merge 1 commit into
Conversation
min() and max() used truthiness to detect an unset accumulator, so 0, 0n, and "" were skipped or overwritten. Compare against undefined. Fixes TanStack#1775
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe ChangesFalsy min/max aggregate handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to Falsy numeric, bigint, and string extremes are preserved with regression coverage for direct and grouped aggregates. The change is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎯 Changes
min()andmax()in@tanstack/db-ivmtreated a missing accumulator as any falsy value. A group whose true extreme is0,0n, or""therefore returned the wrong aggregate.The reducers now compare against
undefinedonly.Fixes #1775
✅ Checklist
pnpm test.🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
minandmaxgrouping results so valid falsy values—including0,0n, and empty strings—are correctly considered.Tests