Skip to content

[AI] Respect user notes when rules append or prepend on new transactions (#7303)#7320

Open
pranayseela wants to merge 5 commits intoactualbudget:masterfrom
pranayseela:fix/7303-rule-notes-on-new-transactions
Open

[AI] Respect user notes when rules append or prepend on new transactions (#7303)#7320
pranayseela wants to merge 5 commits intoactualbudget:masterfrom
pranayseela:fix/7303-rule-notes-on-new-transactions

Conversation

@pranayseela
Copy link
Copy Markdown
Contributor

@pranayseela pranayseela commented Mar 29, 2026

Fixes #7303

Made with Cursor


Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 27 12.09 MB → 12.09 MB (-118 B) -0.00%
loot-core 1 4.83 MB 0%
api 4 4.06 MB 0%
cli 1 7.88 MB 0%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
27 12.09 MB → 12.09 MB (-118 B) -0.00%
Changeset
File Δ Size
home/runner/work/actual/actual/packages/loot-core/src/shared/util.ts 📈 +388 B (+4.27%) 8.87 kB → 9.25 kB
src/components/mobile/transactions/TransactionEdit.tsx 📉 -76 B (-0.13%) 58.28 kB → 58.2 kB
src/components/transactions/TransactionList.tsx 📉 -42 B (-0.24%) 17.15 kB → 17.11 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller

Asset File Size % Changed
static/js/index.js 3.23 MB → 3.23 MB (-76 B) -0.00%
static/js/useTransactionBatchActions.js 4.29 MB → 4.29 MB (-42 B) -0.00%

Unchanged

Asset File Size % Changed
static/js/BackgroundImage.js 119.98 kB 0%
static/js/FormulaEditor.js 846.44 kB 0%
static/js/ReportRouter.js 1.02 MB 0%
static/js/TransactionList.js 81.29 kB 0%
static/js/ca.js 182.91 kB 0%
static/js/da.js 104.66 kB 0%
static/js/de.js 174.79 kB 0%
static/js/en-GB.js 7.16 kB 0%
static/js/en.js 170.76 kB 0%
static/js/es.js 182.09 kB 0%
static/js/fr.js 177.47 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.46 kB 0%
static/js/it.js 166.25 kB 0%
static/js/narrow.js 354.27 kB 0%
static/js/nb-NO.js 152.2 kB 0%
static/js/nl.js 108.93 kB 0%
static/js/pl.js 88.34 kB 0%
static/js/pt-BR.js 177.84 kB 0%
static/js/resize-observer.js 18.03 kB 0%
static/js/sv.js 80.58 kB 0%
static/js/th.js 179.94 kB 0%
static/js/theme.js 30.68 kB 0%
static/js/uk.js 213.14 kB 0%
static/js/wide.js 418 B 0%
static/js/workbox-window.prod.es5.js 7.28 kB 0%

loot-core

Total

Files count Total bundle size % Changed
1 4.83 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
kcab.worker.CwpE34S5.js 4.83 MB 0%

api

Total

Files count Total bundle size % Changed
4 4.06 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
index.js 3.84 MB 0%
from-Bl-Hslp4.js 167.73 kB 0%
multipart-parser-BnDysoMr.js 8.1 kB 0%
src-iMkUmuwR.js 43.64 kB 0%

cli

Total

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

…ons (actualbudget#7303)

Add shouldApplyRuleDiffField in loot-core; use when merging rule output
into new transactions on desktop TransactionList and mobile TransactionEdit.

Made-with: Cursor
@actual-github-bot actual-github-bot bot changed the title [AI] Respect user notes when rules append or prepend on new transactions (#7303) [WIP] [AI] Respect user notes when rules append or prepend on new transactions (#7303) Mar 29, 2026
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 29, 2026

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit ab453bd
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget/deploys/69c983a40abbd70008012117
😎 Deploy Preview https://deploy-preview-7320.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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
  • ✅ 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.

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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7cba40f8-b0d4-4c7e-af0f-40257b82ad3f

📥 Commits

Reviewing files that changed from the base of the PR and between 548c185 and ab453bd.

📒 Files selected for processing (1)
  • packages/loot-core/src/shared/util.test.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/loot-core/src/shared/util.test.ts

📝 Walkthrough

Walkthrough

A new exported helper, shouldApplyRuleDiffField, centralizes the decision logic for merging rule-derived field diffs into transactions. Two desktop client components now call this helper when applying rule diffs; tests and release notes were added, and a sync-server test was made async.

Changes

Cohort / File(s) Summary
Rule Diff Helper
packages/loot-core/src/shared/util.ts
Added shouldApplyRuleDiffField(field, prev, next, updatedFieldName?): centralizes acceptance rules for diffs (always accept when updatedFieldName === 'payee', accept empty/falsy prev, special append/prepend semantics for notes).
Unit Tests
packages/loot-core/src/shared/util.test.ts
Added tests for shouldApplyRuleDiffField, covering notes append/prepend scenarios, payee influence, and empty/null previous values.
Desktop Client Components
packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx, packages/desktop-client/src/components/transactions/TransactionList.tsx
Replaced inline empty/falsy/payee checks with calls to shouldApplyRuleDiffField when applying rule-generated diffs to transactions.
Release Notes
upcoming-release-notes/7320.md
Added release note documenting notes append/prepend behavior and updated rule-diff application semantics.
Sync Server Test
packages/sync-server/src/app-sync.test.ts
Test seeding changed to use await fs.promises.writeFile(..., 'utf8') instead of callback-style fs.writeFile.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nudged a helper, small and neat,
It tucks notes on ends, not overwrites sweet,
Payee still nudges when change is due,
Empty fields welcome what rules construe,
Hoppity—transactions now sing anew 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Most changes are in-scope. However, the app-sync.test.ts change converting fs.writeFile from callback to promise-based is unrelated to #7303 as acknowledged by the author. Separate the app-sync.test.ts file-write refactoring into a distinct PR to keep this PR focused on fixing the rule-merge behavior for notes.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly references the main change: respecting user notes when rules append or prepend on new transactions, and directly links to issue #7303.
Description check ✅ Passed The description is related to the changeset, fixing issue #7303 by implementing logic for rule-based append/prepend behavior on notes.
Linked Issues check ✅ Passed The PR successfully implements the fix for issue #7303 by adding shouldApplyRuleDiffField helper that enables append/prepend note behavior while respecting existing user notes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@pranayseela pranayseela changed the title [WIP] [AI] Respect user notes when rules append or prepend on new transactions (#7303) [AI] Respect user notes when rules append or prepend on new transactions (#7303) Mar 29, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 29, 2026
Removes a race where fs.writeFile(..., callback) could complete after
the upload handler wrote the new content, leaving old content on disk
and flaking CI (e.g. PR test job).

Made-with: Cursor
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 29, 2026
@pranayseela
Copy link
Copy Markdown
Contributor Author

For reviewers

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 29, 2026
@matt-fidd matt-fidd force-pushed the master branch 2 times, most recently from 5c7c70d to d262f7d Compare April 5, 2026 17:13
@matt-fidd matt-fidd removed their assignment Apr 8, 2026
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]: Append to notes rule not working if a note already exists

2 participants