Add linked account balance adjustments
TI
11d ago+487+487+012345678901234567890123456789-33-33-01234567890123456789
Closes #3631
Summary
- add an explicit signed balance adjustment and required reason for linked accounts
- apply the adjustment after provider balance normalization while retaining the raw provider balance
- preserve the adjustment across Plaid, SimpleFIN, and other linked-provider syncs
- show the active adjustment on the account page and allow clearing it from account settings
This keeps valid transaction history intact and avoids creating a synthetic reimbursement when an institution changes its reported balance outside the transaction feed.
Validation
bin/rails test: 9,271 runs, 37,496 assertions, 0 failures, 0 errorsDISABLE_PARALLELIZATION=true bin/rails test:system: 141 runs, 717 assertions, 0 failures, 0 errors- focused provider and controller tests: 52 runs, 345 assertions, 0 failures, 0 errors
- RuboCop passed
- changed ERB files passed erb_lint
- Biome passed
- Brakeman: 0 security warnings
Summary by CodeRabbit
-
New Features
- Added provider balance adjustments for eligible linked accounts, including an amount and reason.
- Adjusted balances are applied during provider syncs while the original provider-reported balance is preserved.
- Account forms allow adjustments to be entered, updated, or cleared.
- Account pages show adjustment details and indicate when a provider balance reflects an adjustment.
-
Bug Fixes
- Nonzero adjustments require a reason.
- Adjustments stop being applied once the provider balance reflects them.