Skip to content

Conversation

@1cu
Copy link
Contributor

@1cu 1cu commented Oct 24, 2025

Problem

The duplicate transaction filter in Importer.ts was broken due to an async callback in Array.filter(). This caused all transactions to pass through the filter, leading to unnecessary OpenAI API calls for payee transformation of duplicate transactions.

Solution

Remove the async keyword from the filter callback since Array.some() is already synchronous. This enables proper duplicate filtering before payee transformation.

Impact

  • Fixes broken duplicate detection that was causing all transactions to pass through
  • Prevents unnecessary OpenAI API calls for duplicate transactions
  • Reduces API costs and improves import performance
  • No behavior change for users - duplicate detection still works via Actual Budget API

Testing

Verified with real import showing proper filtering:

  • Previously all transactions would have been sent to the API
  • Now found 146 total transactions in MoneyMoney
  • All accounts correctly show "No new transactions found"
  • No OpenAI calls made for existing transactions

Summary by CodeRabbit

  • Refactor
    • Streamlined the transaction import filtering to remove unnecessary asynchronous overhead. Result: import runs more efficiently while preserving existing behavior and outcomes.

- Remove async keyword from filter callback in Importer.ts
- Fixes broken duplicate detection that was causing all transactions to pass through
- Now properly filters out existing transactions before OpenAI payee transformation
- Prevents unnecessary OpenAI API calls for duplicate transactions
- Significantly reduces API costs and improves import performance
@coderabbitai
Copy link

coderabbitai bot commented Oct 24, 2025

Walkthrough

A filter predicate in the transaction import utility was refactored from asynchronous to synchronous. The logic excluding transactions with matching imported_id in existingActualTransactions is unchanged; async/await usage was removed to simplify control flow.

Changes

Cohort / File(s) Summary
Filter Optimization
src/utils/Importer.ts
Replaced an async Array.filter predicate with a synchronous equivalent; preserved logic that excludes transactions with matching imported_id, removed unnecessary async/await usage.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I hopped through lines of code today,
I swapped async hops for a smoother sway,
No awaiting steps, just a tidy leap,
Filters now wake, no promises to keep,
A small refactor — the meadow sleeps in peace.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix: remove async from duplicate filter to enable proper filtering" directly and clearly describes the primary change: removing the async keyword from the filter callback to restore proper duplicate transaction filtering. The title is concise (10 words), uses the conventional "fix:" prefix, and is specific enough that a teammate reviewing git history would understand this is about fixing duplicate detection in the Importer. It accurately reflects both the technical change (removing async) and its purpose (enabling proper filtering), without unnecessary noise or vague terminology.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d97f17c and eaf3e82.

📒 Files selected for processing (1)
  • src/utils/Importer.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/utils/Importer.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e006e0 and d97f17c.

📒 Files selected for processing (1)
  • src/utils/Importer.ts (1 hunks)

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.

1 participant