actualbudget / actualbudget/actual

[Bug]: payees are created during importTransactions even if they aren't used

Offen Anfängerfreundlich
#8,855 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
needs triage
Vorherrschende Sprache
TypeScript
Sterne
28.8k
Forks
3k
Ø Merge
2 T. 11 Std.
Gemergte PRs (30 T.)
65

Beschreibung

### What happened?

I use a script to import transactions from my banks. I have rules that automatically attribute payees based on bank label. Say I have an operation with bank label "FOOBAR" and a rule that sets the payee to "FooBar, Inc".

Every time I'll run my scripts, it'll send the operation with `imported_payee: "FOOBAR"` to `importTransactions` which will perform the eventual matching, and then apply the rules.

If the operation didn't exist, then a "FOOBAR" payee is created and the operation is associated to it. The rules are then applied, and that payee rightly becomes unused. **This is not a problem, per se. It's easy to delete those from the UI. It would be a QoL feature to automatically delete payees that were created during the import, but this is not the bug.**

However, if the operation did exist, based on the `imported_id` (which is most of the time, since the import will send all the data to Actual), then that "FOOBAR" payee is still created, even though there's nothing to update.

My DB ends up looking like this:

Image

Of course, I can force clearing the tombstone by resetting sync. But then I have to do that every few months otherwise my `payees` table fills with thousands of entries, etc.

### How can we reproduce the issue?

See description.

### Where are you hosting Actual?

Docker

### What browsers are you seeing the problem on?

_No response_

### Operating System

None

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by finding where `importTransactions` is implemented and follow the import flow for transactions matched by `imported_id`. Inspect the section that maps `imported_payee` to payee records and the branch that currently creates a payee before checking whether the operation already exists. Compare behavior with the normal new-transaction import path and add/read transaction-import tests around duplicate `imported_id` cases if available. Done when re-importing an existing transaction no longer inserts a new, unused payee row.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
70/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.