[PR #7000] Fix merged transfer losing linkage when imported transaction is kept #6873

Open
opened 2026-02-28 21:33:56 -06:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/7000

State: open
Merged: No


Summary

Fixes transfer merge behavior when merging a manual transfer transaction with an imported duplicate.

When merge keeps the imported transaction, it should preserve transfer linkage from the dropped manual transfer transaction. Previously, transfer linkage could be lost, leaving the counterpart transfer transaction pointing at a deleted id.

Closes #5000.

Reproduction

  1. Create a transfer from account A -> B (so A tx and B counterpart are linked via transfer_id).
  2. Import a duplicate of the A-side transaction.
  3. Merge manual transfer tx + imported tx.

Before

  • Imported transaction is kept.
  • Kept transaction may lose transfer_id.
  • Counterpart transaction can keep transfer_id pointing to dropped (deleted) transaction.
  • Result is no longer a valid linked transfer pair.

After

  • Kept transaction receives merged transfer_id.
  • Counterpart transaction is relinked to kept transaction id.
  • Transfer relationship remains consistent after merge.

Code changes

  • packages/loot-core/src/server/transactions/merge.ts
    • Preserve transfer_id during merge update.
    • Relink counterpart transaction when transfer linkage came from dropped transaction.
  • packages/loot-core/src/server/transactions/merge.test.ts
    • Add regression test: preserves transfer linkage when imported transaction is kept.

Validation

  • Added focused regression test covering issue path.
  • Full test run was not completed in this environment because workspace dependency install (yarn install --immutable) stalled during fetch.
**Original Pull Request:** https://github.com/actualbudget/actual/pull/7000 **State:** open **Merged:** No --- ## Summary Fixes transfer merge behavior when merging a manual transfer transaction with an imported duplicate. When merge keeps the imported transaction, it should preserve transfer linkage from the dropped manual transfer transaction. Previously, transfer linkage could be lost, leaving the counterpart transfer transaction pointing at a deleted id. Closes #5000. ## Reproduction 1. Create a transfer from account A -> B (so A tx and B counterpart are linked via `transfer_id`). 2. Import a duplicate of the A-side transaction. 3. Merge manual transfer tx + imported tx. ### Before - Imported transaction is kept. - Kept transaction may lose `transfer_id`. - Counterpart transaction can keep `transfer_id` pointing to dropped (deleted) transaction. - Result is no longer a valid linked transfer pair. ### After - Kept transaction receives merged `transfer_id`. - Counterpart transaction is relinked to kept transaction id. - Transfer relationship remains consistent after merge. ## Code changes - `packages/loot-core/src/server/transactions/merge.ts` - Preserve `transfer_id` during merge update. - Relink counterpart transaction when transfer linkage came from dropped transaction. - `packages/loot-core/src/server/transactions/merge.test.ts` - Add regression test: `preserves transfer linkage when imported transaction is kept`. ## Validation - Added focused regression test covering issue path. - Full test run was not completed in this environment because workspace dependency install (`yarn install --immutable`) stalled during fetch.
GiteaMirror added the pull-request label 2026-02-28 21:33:56 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#6873