actual icon indicating copy to clipboard operation
actual copied to clipboard

[Bug]: Transaction deduplication happens even if transactions have different `imported_id`s

Open jacopo-j opened this issue 10 months ago • 2 comments

Verified issue does not already exist?

  • [X] I have searched and found no existing issue
  • [X] I will be providing steps how to reproduce the bug (in most cases this will also mean uploading a demo budget file)

What happened?

I'm using a custom script to add transaction to Actual. The script uses the importTransactions function of the actual API. If I import two "similar" transactions, albeit with different import_ids, Actual's deduplication function merges the two transactions even if it should not.

As an example, I imported the following transaction:

{
    "account": "73157c52-9179-4d3b-85c1-01dd5db1cf28",
    "date": "2024-04-05",
    "amount": -1239,
    "imported_payee": "Acme Inc.",
    "payee_name": "Acme Inc.",
    "imported_id": "b85cdd57-5a1c-4ca5-bd54-12e5b56fa02c",
    "notes": "TEST TRANSACTION",
    "cleared": true
}

Import was successful and the transaction appeared on Actual. Then, I imported the following transaction, which differs in date and imported_id, but has the same amount and other properties of the previous one:

{
    "account": "73157c52-9179-4d3b-85c1-01dd5db1cf28",
    "date": "2024-04-06",
    "amount": -1239,
    "imported_payee": "Acme Inc.",
    "payee_name": "Acme Inc.",
    "imported_id": "ca1589b2-7bc3-4587-a157-476170b383a7",
    "notes": "TEST TRANSACTION",
    "cleared": true
}

The second import was also successful, but the transaction did not get added to Actual. Instead, the date of the first transaction got updated to match the second one (or the second transaction was added and the first disappeared, depending on how you want to see it).

As a sanity check, I changed the amount and tried importing the transaction again (with a fresh imported_id):

{
    "account": "73157c52-9179-4d3b-85c1-01dd5db1cf28",
    "date": "2024-04-06",
    "amount": -9876,
    "imported_payee": "Acme Inc.",
    "payee_name": "Acme Inc.",
    "imported_id": "3497767b-3d28-4887-bb9d-80fb7f113d4e",
    "notes": "TEST TRANSACTION",
    "cleared": true
}

This time, a separate transaction was added to Actual.

This behavior suggests that the deduplication feature does not take different imported_ids into account, while it should to avoid unintentionally merging different transactions.

This issue was previously discussed on Discord.

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Firefox

Operating System

Mac OSX

jacopo-j avatar Apr 06 '24 19:04 jacopo-j

Currently investigating this

ttlgeek avatar Apr 15 '24 13:04 ttlgeek

@jacopo-j Check Matiss' comment on this PR #2618

ttlgeek avatar Apr 17 '24 10:04 ttlgeek

Patch was rolled back.

MatissJanis avatar Jun 22 '24 21:06 MatissJanis

@MatissJanis Is there someone else I could tag to review the PR to address this issue?

pmoon00 avatar Jul 14 '24 09:07 pmoon00