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

Closed
opened 2026-06-11 19:45:52 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/7000
Author: @nicepopo86-lang
Created: 2/17/2026
Status: Closed

Base: masterHead: aria/issue-5000-transfer-merge-fix


📝 Commits (1)

  • 676adfb Fix merge to preserve transfer linkage when imported tx is kept

📊 Changes

2 files changed (+68 additions, -0 deletions)

View changed files

📝 packages/loot-core/src/server/transactions/merge.test.ts (+52 -0)
📝 packages/loot-core/src/server/transactions/merge.ts (+16 -0)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/7000 **Author:** [@nicepopo86-lang](https://github.com/nicepopo86-lang) **Created:** 2/17/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `aria/issue-5000-transfer-merge-fix` --- ### 📝 Commits (1) - [`676adfb`](https://github.com/actualbudget/actual/commit/676adfbd117856f06c5aab99ddd4b59e71442a23) Fix merge to preserve transfer linkage when imported tx is kept ### 📊 Changes **2 files changed** (+68 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/transactions/merge.test.ts` (+52 -0) 📝 `packages/loot-core/src/server/transactions/merge.ts` (+16 -0) </details> ### 📄 Description ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-11 19:45:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#121590