fix: prevent duplicate/missing transactions when syncing shared accounts#54
Merged
tim-smart merged 3 commits intotim-smart:mainfrom Mar 3, 2026
Merged
Conversation
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]>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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;
findImportedqueried 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.The import ID counter in
makeImportIdwas 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
findImportedquery 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.