[PR #2300] [MERGED] Change lookback and look forward time range when fuzzy matching #4238

Closed
opened 2026-02-28 20:53:30 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/2300
Author: @yoyotogblo
Created: 1/29/2024
Status: Merged
Merged: 2/3/2024
Merged by: @youngcw

Base: masterHead: master


📝 Commits (3)

  • 4094526 Change lookback and look forward time range when fuzzy matching
  • 9a0a87a Merge branch 'master' into master
  • 1f52c90 Merge branch 'master' into master

📊 Changes

2 files changed (+12 additions, -6 deletions)

View changed files

📝 packages/loot-core/src/server/accounts/sync.ts (+6 -6)
upcoming-release-notes/2300.md (+6 -0)

📄 Description

Currently, when a new transaction is imported, if the transaction doesn't match an existing transaction with the same imported ID, Actual tries to fuzzy match the transaction with an existing transaction. To do this, Actual selects all existing transactions 4 days prior and 1 day after the imported transaction date. It then runs some logic to try to find a matching existing transaction from the ones selected.

The problem is 4 days prior and 1 day after is too restricting. The few issues are:

There's no reason why the match logic shouldn't be symmetrical (so 4 days prior and 4 days after)

Quite frequently, this logic fails to find the right transaction because the imported transaction might be 2 days after or 5 days prior. This is extremely noticeable with transfers between accounts. Here's an example:

Scenario A

I have a monthly transfer from Account A to Account B of $50. The transfer is initiated from Account A
On Jan 2nd, Account A records the outgoing transfer of $50. Actual sees this transaction and it's set as a transfer to Account B
On Jan 7th, Account B gets the incoming transfer of $50. Because this newly imported transaction "happened" 5 days after the imported transaction, it doesn't get matched and a new transfer to Account A is created
Scenario B

Let's imagine I delete the transaction on Jan 2nd
Because SimpleFin and GoCardless download all transactions 90 days prior, the transaction on Jan 2nd gets downloaded again
This time, it only tries to fuzzy match transaction up till Jan 3rd and doesn't see the Jan 7th transaction
Every new download of transactions lead to duplicate, unmatched transactions and have to continually be deleted.
Please review this PR and approve. Also, for some context, YNAB 5 actually uses 10 days prior and 10 days after for fuzzy matching (https://support.ynab.com/en_us/approving-and-matching-transactions-a-guide-ByYNZaQ1i).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/2300 **Author:** [@yoyotogblo](https://github.com/yoyotogblo) **Created:** 1/29/2024 **Status:** ✅ Merged **Merged:** 2/3/2024 **Merged by:** [@youngcw](https://github.com/youngcw) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (3) - [`4094526`](https://github.com/actualbudget/actual/commit/4094526033b133e382b9836cba808910ed998bb0) Change lookback and look forward time range when fuzzy matching - [`9a0a87a`](https://github.com/actualbudget/actual/commit/9a0a87abd9f8515d816c77888faf0bb19400f9a5) Merge branch 'master' into master - [`1f52c90`](https://github.com/actualbudget/actual/commit/1f52c9051bbb3c6b091e65608eb61f61dc8b7fe0) Merge branch 'master' into master ### 📊 Changes **2 files changed** (+12 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/accounts/sync.ts` (+6 -6) ➕ `upcoming-release-notes/2300.md` (+6 -0) </details> ### 📄 Description Currently, when a new transaction is imported, if the transaction doesn't match an existing transaction with the same imported ID, Actual tries to fuzzy match the transaction with an existing transaction. To do this, Actual selects all existing transactions 4 days prior and 1 day after the imported transaction date. It then runs some logic to try to find a matching existing transaction from the ones selected. The problem is 4 days prior and 1 day after is too restricting. The few issues are: There's no reason why the match logic shouldn't be symmetrical (so 4 days prior and 4 days after) Quite frequently, this logic fails to find the right transaction because the imported transaction might be 2 days after or 5 days prior. This is extremely noticeable with transfers between accounts. Here's an example: Scenario A I have a monthly transfer from Account A to Account B of $50. The transfer is initiated from Account A On Jan 2nd, Account A records the outgoing transfer of $50. Actual sees this transaction and it's set as a transfer to Account B On Jan 7th, Account B gets the incoming transfer of $50. Because this newly imported transaction "happened" 5 days after the imported transaction, it doesn't get matched and a new transfer to Account A is created Scenario B Let's imagine I delete the transaction on Jan 2nd Because SimpleFin and GoCardless download all transactions 90 days prior, the transaction on Jan 2nd gets downloaded again This time, it only tries to fuzzy match transaction up till Jan 3rd and doesn't see the Jan 7th transaction Every new download of transactions lead to duplicate, unmatched transactions and have to continually be deleted. Please review this PR and approve. Also, for some context, YNAB 5 actually uses 10 days prior and 10 days after for fuzzy matching (https://support.ynab.com/en_us/approving-and-matching-transactions-a-guide-ByYNZaQ1i). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 20:53:30 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#4238