Skip to content

Resolve payee name during rule evaluation - #8360

Merged
jfdoming merged 1 commit into
actualbudget:masterfrom
julienvincent:jv/resolve-payee-name
Jun 29, 2026
Merged

jfdoming merged 1 commit into
actualbudget:masterfrom
julienvincent:jv/resolve-payee-name

Conversation

@julienvincent

@julienvincent julienvincent commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

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:desktop wherein 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

  • Release notes added (see link above)
  • No obvious regressions in affected areas
  • Self-review has been performed - I have read every line of this diff and can explain what each change does and why it is needed

Fixes #8359


Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 29 13.1 MB → 13.12 MB (+25.1 kB) +0.19%
loot-core 1 4.82 MB → 4.82 MB (+291 B) +0.01%
api 2 3.87 MB → 3.87 MB (+279 B) +0.01%
cli 1 8.02 MB 0%
crdt 1 11.12 kB 0%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
29 13.1 MB → 13.12 MB (+25.1 kB) +0.19%
Changeset
File Δ Size
locale/pl.json 📈 +19.47 kB (+16.27%) 119.69 kB → 139.16 kB
locale/de.json 📈 +5.63 kB (+3.25%) 173.1 kB → 178.73 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
static/js/pl.js 119.69 kB → 139.16 kB (+19.47 kB) +16.27%
static/js/de.js 173.1 kB → 178.73 kB (+5.63 kB) +3.25%

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
static/js/index.js 7.63 MB 0%
static/js/AppliedFilters.js 36.47 kB 0%
static/js/BackgroundImage.js 121.09 kB 0%
static/js/FormulaEditor.js 735.67 kB 0%
static/js/PayeeRuleCountLabel.js 7.1 kB 0%
static/js/ReportRouter.js 1.24 MB 0%
static/js/TransactionList.js 85.19 kB 0%
static/js/ca.js 175.04 kB 0%
static/js/da.js 98.1 kB 0%
static/js/en-GB.js 9.19 kB 0%
static/js/en.js 197.48 kB 0%
static/js/es.js 168.09 kB 0%
static/js/extends.js 435.48 kB 0%
static/js/fr.js 170.22 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.46 kB 0%
static/js/it.js 155.93 kB 0%
static/js/narrow.js 358.79 kB 0%
static/js/nb-NO.js 139.47 kB 0%
static/js/nl.js 116.97 kB 0%
static/js/pt-BR.js 176.96 kB 0%
static/js/th.js 170 kB 0%
static/js/theme.js 31.02 kB 0%
static/js/uk.js 204.73 kB 0%
static/js/useTransactionBatchActions.js 9.71 kB 0%
static/js/wide.js 306.06 kB 0%
static/js/workbox-window.prod.es5.js 7.21 kB 0%
static/js/zh-Hans.js 109.86 kB 0%

loot-core

Total

Files count Total bundle size % Changed
1 4.82 MB → 4.82 MB (+291 B) +0.01%
Changeset
File Δ Size
home/runner/work/actual/actual/packages/loot-core/src/server/transactions/transaction-rules.ts 📈 +291 B (+1.34%) 21.25 kB → 21.54 kB
View detailed bundle breakdown

Added

Asset File Size % Changed
kcab.worker.BI4lxjlp.js 0 B → 4.82 MB (+4.82 MB) -

Removed

Asset File Size % Changed
kcab.worker.Xleo7SE_.js 4.82 MB → 0 B (-4.82 MB) -100%

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged
No assets were unchanged


api

Total

Files count Total bundle size % Changed
2 3.87 MB → 3.87 MB (+279 B) +0.01%
Changeset
File Δ Size
home/runner/work/actual/actual/packages/loot-core/src/server/transactions/transaction-rules.ts 📈 +279 B (+1.31%) 20.83 kB → 21.11 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
index.js 3.87 MB → 3.87 MB (+279 B) +0.01%

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
models.js 0 B 0%

cli

Total

Files count Total bundle size % Changed
1 8.02 MB 0%
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

Asset File Size % Changed
cli.js 8.02 MB 0%

crdt

Total

Files count Total bundle size % Changed
1 11.12 kB 0%
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

Asset File Size % Changed
index.js 11.12 kB 0%

@actual-github-bot actual-github-bot Bot changed the title Resolve payee name during rule evaluation [WIP] Resolve payee name during rule evaluation Jun 29, 2026
@netlify

netlify Bot commented Jun 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit df79048
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget/deploys/6a42517e730b0d00088960bd
😎 Deploy Preview https://deploy-preview-8360.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hello contributor!

We would love to review your PR! Before we can do that, please make sure:

  • ✅ All CI checks pass
  • ✅ The PR is moved from draft to open (if applicable)
  • ✅ The "[WIP]" prefix is removed from the PR title
  • ✅ The PR description follows the provided template, with all checklist boxes filled in
  • ✅ All CodeRabbit code review comments are resolved (if you disagree with anything - reply to the bot with your reasoning so we can read through it). The bot will eventually approve the PR.
  • ✅ Any AI usage is disclosed (see our AI Usage Policy)

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.

@julienvincent julienvincent changed the title [WIP] Resolve payee name during rule evaluation Resolve payee name during rule evaluation Jun 29, 2026
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
@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

runRules now resolves payee_name to a payee id during rule execution instead of waiting for finalization. A helper was extracted for the resolution logic, with a new test and release note added.

Changes

Eager payee_name resolution during rule execution

Layer / File(s) Summary
resolvePayeeNameForRules helper and runRules integration
packages/loot-core/src/server/transactions/transaction-rules.ts
Extracts payee_name to payee id resolution into a shared helper, calls it during runRules after schedule-linked and non-scheduled rule application, and uses the helper again during finalization.
Test coverage and release note
packages/loot-core/src/server/transactions/transaction-rules.test.ts, upcoming-release-notes/resolve-payee-name-eagerly.md
Adds a rule test that stages a computed payee_name and verifies a later rule matches on the resolved payee, and adds a release note for the bugfix.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • joel-jeremy
  • matt-fidd

Poem

🐇 A payee once wore the mask of "new",
then found its name before rules were through.
Later stages matched ঠিক?—no, just true,
and category hopped in right on cue.
Tiny fix, but the rulebook smiled anew.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: resolving payee names during rule evaluation.
Linked Issues check ✅ Passed The implementation matches #8359 by resolving payee_name during rule execution so later rules can match the resolved payee.
Out of Scope Changes check ✅ Passed The added test and release note support the fix and stay within the issue scope.
Description check ✅ Passed The description matches the code changes by explaining immediate payee_name resolution so later staged rules can match on the resolved payee.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 617fe63 and 2d5c2bb.

📒 Files selected for processing (3)
  • packages/loot-core/src/server/transactions/transaction-rules.test.ts
  • packages/loot-core/src/server/transactions/transaction-rules.ts
  • upcoming-release-notes/resolve-payee-name-eagerly.md

@jfdoming jfdoming left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fix makes sense to me, thanks!

@jfdoming
jfdoming added this pull request to the merge queue Jun 29, 2026
Merged via the queue into actualbudget:master with commit d9c69b0 Jun 29, 2026
44 checks passed
RafaelEspino pushed a commit to RafaelEspino/actual that referenced this pull request Oct 28, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Formula/template payee_name actions do not allow later payee rules to match

2 participants