fix(ack-pay): validate string payment amounts - #159
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
WalkthroughThe payment option schemas now restrict string amounts to positive integers. Valibot and Zod accept large positive integer strings and reject malformed, fractional, zero, negative, empty, and nonnumeric values. Tests cover both implementations, and a patch changeset records the update. ChangesPayment amount validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change restricts string payment amounts to positive integer representations while preserving large-integer support; no actionable merge-blocking risk remains beyond normal checks and review. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Summary
Tighten
paymentOptionSchema.amountvalidation so string amounts follow the same positive-integer contract as numeric amounts.Currently the numeric branch requires a positive integer, while the string branch accepts any string. This allows values such as
"","0","-1","1.5", and"abc"through schema validation even though payment amounts are expressed as integers in the smallest currency unit.Changes
@agentcommercekit/ack-paypatch changesetValidation
The regression tests cover positive numeric/string integers and reject zero, negative, fractional, empty, and non-numeric values in both schema implementations.
This is opened as a draft so the repository's PR checks can validate the full build/check workflow before marking it ready for review.
AI usage disclosure
This contribution was prepared with ChatGPT assistance for repository analysis, identifying the validation inconsistency, implementing the schema changes, and drafting regression tests. I reviewed the scope and can explain the behavior being changed: string payment amounts are restricted to decimal representations of positive integers, matching the existing numeric validation while retaining support for integer values too large to safely represent as JavaScript numbers.
Summary by CodeRabbit
Bug Fixes
Tests
Chores