#3851·sure

Bug: Transactions that Plaid retracts are never deleted

Author: DTTerastarCreated Sep 29, 2026Updated Sep 29, 2026

Before you start (required)

General checklist

  • I have removed personal / sensitive data from screenshots and logs
  • I have searched existing issues and discussions to ensure this is not a duplicate issue

How are you using Sure?

  • I was a paying Maybe customer (hosted version)
  • I use it on PikaPod, Umbrel or similar (VPS included)
  • I am a self-hosted user (local only)

Self hoster checklist

  • Self hosted app version: v0.7.5-alpha.12
    • I have confirmed that my app's commit is the latest version of Sure — the code is unchanged on current main
  • Where are you hosting?
    • Docker Compose

Bug description

When Plaid's /transactions/sync reports transactions as removed, Sure stores them in raw_transactions_payload but never deletes the matching entries. They stay in the account indefinitely.

Cause

PlaidAccount::Transactions::Processor#remove_plaid_transaction looks the entry up by plaid_id:

ruby
account.entries.find_by(plaid_id: raw_transaction["transaction_id"])&.destroy

Plaid entries are imported by PlaidEntry::Processor through Account::ProviderImportAdapter#import_transaction, which keys them on external_id + source and does not set plaid_id. On my instance plaid_id is null on every Plaid entry (0 of 32), so the lookup can never match.

The existing test passes because it creates its entry by hand with plaid_id set, which the real import path never does.

How I hit it

Two credit cards under one institution login. Plaid's first pull listed one card's six purchases under the other card as well, then corrected itself on the next sync: it sent the second card's real history as added and the six misattributed transactions as removed. Sure imported the additions and kept the six, so the same purchases appeared on both cards. Querying Plaid's /transactions/get directly returned clean data with no duplicates.

To Reproduce

  1. Import a Plaid transaction through the normal sync path.
  2. Have a later /transactions/sync response list that transaction_id under removed.
  3. Sync. The entry is still present.

Expected behavior

Entries for transactions that Plaid retracts are deleted.