fix(enable-banking): preserve claimed pending date on subsequent syncs#1797
Conversation
After the first sync claims a pending entry (setting auto_claimed_pending_ids), subsequent syncs find the entry by booked external_id as an existing record. pending_match is never entered so pending_entry_date stays nil, causing `nil || date` to silently overwrite the preserved pending date with the booked settlement date. Fix by checking auto_claimed_pending_ids on the existing entry — its presence signals a prior auto-claim, so entry.date (the original pending date) is kept. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughModified ChangesPending Transaction Date Preservation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
Problem
PR #1783 preserved the original pending transaction date on the first sync by capturing
pending_entry_datefrom the pending match. However, on every subsequent sync the date gets silently overwritten with the booked settlement date.Why: On subsequent syncs the entry is found by its booked
external_id— it's not a new record, so thepending_matchpath is never entered andpending_entry_datestaysnil. The expressionnil || datethen falls through to the incoming booked date.Solution
Add a three-way date resolution before
assign_attributes:pending_entry_date(captured from the pending match, same as before)auto_claimed_pending_idsis present inextra(the signal written during the first claim), keepentry.dateunchangedTesting
"preserves pending date on subsequent syncs after auto-claim"test: imports a pending entry, claims it with a booked entry, then re-imports the same booked entry and asserts the date hasn't changed.🤖 Generated with Claude Code
Summary by CodeRabbit