Repository navigation
Resolve payee name during rule evaluation - #8360
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hello contributor! We would love to review your PR! Before we can do that, please make sure:
A quick note on volume: please get one PR reviewed and merged before opening several more. A stack of simultaneous, similar PRs from one author is reviewed slowly, and low-effort, untested, or undisclosed-AI PRs may be closed without a detailed review. We do this to reduce the TOIL the core contributor team has to go through for each PR and to allow for speedy reviews and merges. For more information, please see our Contributing Guide. |
When a rule action sets payee_name, resolve it to the actual payee ID immediately during rule execution instead of waiting until finalization. This allows later staged rules to match on the resolved payee. Previously, payee_name actions temporarily set payee to "new", and the real payee ID was only resolved in finalizeTransactionForRules after rule matching had completed. Fixes actualbudget#8359
2d5c2bb to
df79048
Compare
📝 WalkthroughWalkthrough
ChangesEager payee_name resolution during rule execution
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/loot-core/src/server/transactions/transaction-rules.ts`:
- Around line 373-385: The current loop in transaction-rules.ts updates
finalTrans.payee via resolvePayeeNameForRules, but the candidate rules list is
still the original snapshotted rules array, so newly applicable payee-indexed
rules never get considered. Update the rule evaluation flow around the main loop
(where rules[i].apply and resolvePayeeNameForRules are called) to recompute
applicable rules from the mutated finalTrans after payee resolution, or switch
to an iteration strategy that re-queries RuleIndexer.getApplicableRules whenever
finalTrans changes.
In `@upcoming-release-notes/resolve-payee-name-eagerly.md`:
- Around line 6-7: The release note body is wrapping across multiple lines in
the markdown file, which causes check-release-notes to fail. Update the content
in resolve-payee-name-eagerly.md so the body is a single concise sentence on one
line, keeping it brief and non-technical as appropriate for
upcoming-release-notes/*.md.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: cc9e15ac-39e5-4862-87e0-a7784ee25659
📒 Files selected for processing (3)
packages/loot-core/src/server/transactions/transaction-rules.test.tspackages/loot-core/src/server/transactions/transaction-rules.tsupcoming-release-notes/resolve-payee-name-eagerly.md
jfdoming
left a comment
There was a problem hiding this comment.
Fix makes sense to me, thanks!
When a rule action sets payee_name, resolve it to the actual payee ID immediately during rule execution instead of waiting until finalization. This allows later staged rules to match on the resolved payee. Previously, payee_name actions temporarily set payee to "new", and the real payee ID was only resolved in finalizeTransactionForRules after rule matching had completed. Fixes actualbudget#8359
Description
I took a stab at fixing #8359 as it seemed like a pretty straight forward change to make. Please read the original issue for full context on the problem this is trying to solve.
When a rule action sets payee_name, resolve it to the actual payee ID immediately during rule execution instead of waiting until finalization.
This allows later staged rules to match on the resolved payee. Previously, payee_name actions temporarily set payee to "new", and the real payee ID was only resolved in finalizeTransactionForRules after rule matching had completed.
Testing
I tested this by running the test suite and by running the app with
yarn start:desktopwherein I re-created the rules from my main Budget file and ran a test transaction import. It now does what I expect.AI Usage Disclosure
I used AI for the initial analysis and to propose an approach for the fix, but wrote the implementation presented here myself.
Checklist
Fixes #8359
Bundle Stats
View detailed bundle stats
desktop-client
Total
Changeset
locale/pl.jsonlocale/de.jsonView detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
Smaller
No assets were smaller
Unchanged
loot-core
Total
Changeset
home/runner/work/actual/actual/packages/loot-core/src/server/transactions/transaction-rules.tsView detailed bundle breakdown
Added
Removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
No assets were unchanged
api
Total
Changeset
home/runner/work/actual/actual/packages/loot-core/src/server/transactions/transaction-rules.tsView detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
Smaller
No assets were smaller
Unchanged
cli
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
crdt
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged