[MPDX-10004] - Block savings fund transfers that would overdraw the account - #2059
Open
tjohnson009 wants to merge 1 commit into
Open
tjohnson009 wants to merge 1 commit into
tjohnson009 wants to merge 1 commit into
Conversation
…ount One-time transfers over the source fund's available balance are now blocked at the form level ($0 floor, cent-precision comparison, fail-closed when the fund balance cannot be resolved). Recurring transfers and edits show a non-blocking overdraft warning instead, since their payments process in the future against future balances. The BalanceCard transfer button now gates on the same shared availableBalance helper instead of the old deficit-limit check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Preview branch generated at https://MPDX-10004-Block-Negative-Transfers.d3dytjb8adxkk5.amplifyapp.com |
Contributor
Bundle sizes [mpdx-react]Compared against df619f6 No significant changes found |
Contributor
Author
|
Pre-PR code review findings (multi-agent review of the initial implementation; all addressed in this PR unless noted):
🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Prevents savings fund transfers from taking an account balance below $0 (MPDX-10004).
Per Scott (via stakeholder Crystal): a transfer can never take an account below $0 — fund
deficitLimits apply to salary, not savings fund transfers. Recurring transfers get a warning rather than a block, since their payments process in the future against future balances; each payment is enforced at processing time.Behavior
availableBalancehelper (endBalance <= 0) instead of the old deficit-limit check, so the entry point and the form enforce the same rule.The balance policy lives in one place (
Helper/availableBalance.ts) with the $0 floor documented, including a warning about the two conflictingdeficitLimitsign conventions found in the tree.Not covered client-side (server-side enforcement question)
The form check can't catch a recurring transfer that overdraws in a later month, stacked pending transfers that jointly overdraw, or a balance that changed after page load. Whether SAA rejects these at processing time is pending confirmation with Ethan Tison — if it doesn't, a backend ticket is needed.
Checklist:
🤖 Generated with Claude Code