Skip to content

fix: prevent duplicate/missing transactions when syncing shared accounts#54

Merged
tim-smart merged 3 commits intotim-smart:mainfrom
alecpirillo:fix/multi-account-import-id-collision
Mar 3, 2026
Merged

fix: prevent duplicate/missing transactions when syncing shared accounts#54
tim-smart merged 3 commits intotim-smart:mainfrom
alecpirillo:fix/multi-account-import-id-collision

Conversation

@alecpirillo
Copy link
Copy Markdown
Contributor

@alecpirillo alecpirillo commented Mar 3, 2026

Two bugs caused transactions to be dropped or duplicated when the same account (e.g. a joint account) was included in multiple sync runs for joint accounts. This is a realistic scenario as if you want both 2 UP (Joint) account holders to have their transfers/covers identified correctly to their respective transaction accounts, you need to include the joint account in both sync runs. This could also causes issues in other situations as detailed below;

  1. findImported queried imported transactions across all accounts, so a same-date/same-amount transaction in account A could shadow a transaction in account B, silently dropping it from import.

  2. The import ID counter in makeImportId was shared across all accounts in a single run, causing the same transaction to receive a different ID depending on which other accounts were included — bypassing the duplicate check on subsequent runs.

Fixes: scope findImported query to the target account, and track the import ID counter per account rather than globally.

Potential future state - specifying PAT per account mapping (and associated logic changes at bank level), but this maybe overkill given this should solve the problem trivially.

daman and others added 3 commits March 3, 2026 21:23
Two bugs caused transactions to be dropped or duplicated when the same account (e.g. a joint account) was included in multiple sync runs:

1. `findImported` queried imported transactions across all accounts, so a same-date/same-amount transaction in account A could shadow a transaction in account B, silently dropping it from import.

2. The import ID counter in `makeImportId` was shared across all accounts in a single run, causing the same transaction to receive a different ID depending on which other accounts were included — bypassing the duplicate check on subsequent runs.

Fixes: scope `findImported` query to the target account, and track the import ID counter per account rather than globally.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@tim-smart tim-smart merged commit 2926328 into tim-smart:main Mar 3, 2026
@github-actions github-actions bot mentioned this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants